James Moger
2013-04-02 b9afce4d3db8dec34b22b07c952df814efc7335f
Simplify resource loading
14 files renamed
3 files modified
57 ■■■■ changed files
.gitignore 2 ●●●●● patch | view | raw | blame | history
build.xml 44 ●●●●● patch | view | raw | blame | history
src/main/java/com/gitblit/GitBlit.java 11 ●●●● patch | view | raw | blame | history
src/main/java/login.mkd patch | view | raw | blame | history
src/main/java/login_es.mkd patch | view | raw | blame | history
src/main/java/login_ko.mkd patch | view | raw | blame | history
src/main/java/login_nl.mkd patch | view | raw | blame | history
src/main/java/login_pl.mkd patch | view | raw | blame | history
src/main/java/login_pt_br.mkd patch | view | raw | blame | history
src/main/java/login_zh_CN.mkd patch | view | raw | blame | history
src/main/java/welcome.mkd patch | view | raw | blame | history
src/main/java/welcome_es.mkd patch | view | raw | blame | history
src/main/java/welcome_ko.mkd patch | view | raw | blame | history
src/main/java/welcome_nl.mkd patch | view | raw | blame | history
src/main/java/welcome_pl.mkd patch | view | raw | blame | history
src/main/java/welcome_pt_br.mkd patch | view | raw | blame | history
src/main/java/welcome_zh_CN.mkd patch | view | raw | blame | history
.gitignore
@@ -7,7 +7,9 @@
/build.properties
/federation.properties
/mailtest.properties
/test-users.conf
/.settings/
/src/main/java/reference.properties
/src/main/java/WEB-INF/reference.properties
/bin/
/build-demo.xml
build.xml
@@ -93,9 +93,9 @@
            <fileset dir="${project.distrib.dir}/data" />
        </copy>
        
        <!-- copy gitblit.properties to the WEB-INF directory.
        <!-- copy gitblit.properties to the source directory.
             this file is only used for parsing setting descriptions. -->
        <copy tofile="${project.src.dir}/WEB-INF/reference.properties" overwrite="true"
        <copy tofile="${project.src.dir}/reference.properties" overwrite="true"
            file="${project.distrib.dir}/data/gitblit.properties" />
        
        <!-- 
@@ -265,6 +265,26 @@
        <!-- Build the WAR web.xml from the prototype web.xml -->
        <mx:webxml sourcefile="${project.src.dir}/WEB-INF/web.xml" destfile="${webinf}/web.xml" />
        <!-- Gitblit jar -->
        <mx:genjar destfile="${webinf}/lib/gitblit.jar" includeresources="false" excludeclasspathjars="true">
            <!-- Specify all web.xml servlets and filters -->
            <class name="com.gitblit.GitBlit" />
            <class name="com.gitblit.DownloadZipFilter" />
            <class name="com.gitblit.DownloadZipServlet" />
            <class name="com.gitblit.EnforceAuthenticationFilter" />
            <class name="com.gitblit.FederationServlet" />
            <class name="com.gitblit.GitFilter" />
            <class name="com.gitblit.GitServlet" />
            <class name="com.gitblit.PagesFilter" />
            <class name="com.gitblit.PagesServlet" />
            <class name="com.gitblit.RobotsTxtServlet" />
            <class name="com.gitblit.RpcFilter" />
            <class name="com.gitblit.RpcServlet" />
            <class name="com.gitblit.SyndicationFilter" />
            <class name="com.gitblit.SyndicationServlet" />
            <class name="com.gitblit.wicket.GitBlitWebApp" />
        </mx:genjar>
        <!-- Build the WAR file -->
        <mx:zip basedir="${war.dir}" destfile="${project.targetDirectory}/${distribution.warfile}" compress="true" >
            <!-- Resources in root -->
@@ -273,20 +293,11 @@
                <exclude name="*.mkd" />
            </fileset>
            <!-- WEB-INF directory -->
            <zipfileset fullpath="WEB-INF/reference.properties"
                file="${project.distrib.dir}/data/gitblit.properties" />
            <zipfileset prefix="WEB-INF" dir="${basedir}" >
                <include name="LICENSE" />
                <include name="NOTICE" />
            </zipfileset>
            <zipfileset prefix="WEB-INF" file="${project.compileOutputDirectory}/WEB-INF/weblogic.xml" />
            <!-- Classes and classpath resources -->
            <zipfileset prefix="WEB-INF/classes" dir="${project.compileOutputDirectory}">
                <include name="**/*.class" />
                <include name="**/*.properties" />
                <include name="**/*.mkd" />
                <exclude name="WEB-INF" />
            </zipfileset>
            <!-- include "war" tagged dependencies -->
            <dependencies prefix="WEB-INF/lib" tag="war" />
        </mx:zip>
@@ -303,7 +314,7 @@
    
        <!-- generate jar by traversing the class hierarchy of the specified
             classes, exclude any classes in classpath jars -->
        <mx:genjar tag="" excludeClasspathJars="true"
        <mx:genjar tag="" includeresources="false" excludeClasspathJars="true"
            destfile="${project.targetDirectory}/fedclient.jar">
            <mainclass name="com.gitblit.FederationClient" />
            <launcher paths="ext" />
@@ -363,7 +374,7 @@
        skip="server.*" />
        <!-- Gitblit classes -->
        <mx:genjar destfile="${webinf}/lib/gitblit.jar" excludeclasspathjars="true">
        <mx:genjar destfile="${webinf}/lib/gitblit.jar" includeresources="false" excludeclasspathjars="true">
            <!-- Specify all web.xml servlets and filters -->
            <class name="com.gitblit.GitBlit" />
            <class name="com.gitblit.DownloadZipFilter" />
@@ -395,9 +406,6 @@
                <exclude name="thumbs.db" />
                <exclude name="*.mkd" />
            </zipfileset>
            <!-- reference.properties -->
            <zipfileset fullpath="deployments/ROOT.war/WEB-INF/reference.properties"
                file="${project.distrib.dir}/data/gitblit.properties" />
            <!-- include "war" tagged dependencies -->
            <dependencies prefix="deployments/ROOT.war/WEB-INF/lib" tag="war" />
        </mx:zip>
@@ -415,7 +423,7 @@
        <!-- generate jar by traversing the class hierarchy of the specified
             classes, exclude any classes in classpath jars -->
        <mx:genjar tag="" excludeClasspathJars="true"
        <mx:genjar tag="" includeResources="false" excludeClasspathJars="true"
            destfile="${project.targetDirectory}/manager.jar">
            <resource file="${project.src.dir}/com/gitblit/client/splash.png" />
            <resource file="${project.resources.dir}/gitblt-favicon.png" />
@@ -553,7 +561,7 @@
        <delete dir="${javadoc.dir}" />
        <!-- Build API Library jar -->
        <mx:genjar tag="" excludeClasspathJars="true"
        <mx:genjar tag="" includeResources="false" excludeClasspathJars="true"
            destfile="${project.targetDirectory}/gbapi-${project.version}.jar">
            <class name="com.gitblit.Keys" />
            <class name="com.gitblit.client.GitblitClient" />
src/main/java/com/gitblit/GitBlit.java
@@ -2997,11 +2997,10 @@
     * Parse the properties file and aggregate all the comments by the setting
     * key. A setting model tracks the current value, the default value, the
     * description of the setting and and directives about the setting.
     * @param referencePropertiesInputStream
     * 
     * @return Map<String, SettingModel>
     */
    private ServerSettings loadSettingModels(InputStream referencePropertiesInputStream) {
    private ServerSettings loadSettingModels() {
        ServerSettings settingsModel = new ServerSettings();
        settingsModel.supportsCredentialChanges = userService.supportsCredentialChanges();
        settingsModel.supportsDisplayNameChanges = userService.supportsDisplayNameChanges();
@@ -3011,7 +3010,7 @@
            // Read bundled Gitblit properties to extract setting descriptions.
            // This copy is pristine and only used for populating the setting
            // models map.
            InputStream is = referencePropertiesInputStream;
            InputStream is = getClass().getResourceAsStream("/reference.properties");
            BufferedReader propertiesReader = new BufferedReader(new InputStreamReader(is));
            StringBuilder description = new StringBuilder();
            SettingModel setting = new SettingModel();
@@ -3239,10 +3238,6 @@
     */
    @Override
    public void contextInitialized(ServletContextEvent contextEvent) {
        contextInitialized(contextEvent, contextEvent.getServletContext().getResourceAsStream("/WEB-INF/reference.properties"));
    }
    public void contextInitialized(ServletContextEvent contextEvent, InputStream referencePropertiesInputStream) {
        servletContext = contextEvent.getServletContext();
        if (settings == null) {
            // Gitblit is running in a servlet container
@@ -3307,7 +3302,7 @@
            }
        }
        
        settingsModel = loadSettingModels(referencePropertiesInputStream);
        settingsModel = loadSettingModels();
        serverStatus.servletContainer = servletContext.getServerInfo();
    }
src/main/java/login.mkd
src/main/java/login_es.mkd
src/main/java/login_ko.mkd
src/main/java/login_nl.mkd
src/main/java/login_pl.mkd
src/main/java/login_pt_br.mkd
src/main/java/login_zh_CN.mkd
src/main/java/welcome.mkd
src/main/java/welcome_es.mkd
src/main/java/welcome_ko.mkd
src/main/java/welcome_nl.mkd
src/main/java/welcome_pl.mkd
src/main/java/welcome_pt_br.mkd
src/main/java/welcome_zh_CN.mkd