Geronimo
  1. Geronimo
  2. GERONIMO-5557

Add more context level configurations for Tomcat

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.0
    • Fix Version/s: 3.0.0
    • Component/s: None
    • Security Level: public (Regular issues)
    • Labels:
      None

      Description

      In the latest Tomcat build, more paramter could be configured on the context level
      A request thread in user-geronimo mail list : http://osdir.com/ml/user-geronimo-apache/2010-08/msg00003.html

      1. G5557.patch
        14 kB
        viola.lu
      2. G5557_Refactor.patch
        14 kB
        viola.lu

        Activity

        Hide
        viola.lu added a comment -

        sample usage:
        <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1"
        xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.2"
        xmlns:sec="http://geronimo.apache.org/xml/ns/security-2.0"
        xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2">

        <sys:environment>
        <sys:moduleId>
        <sys:groupId>org.test.apache</sys:groupId>
        <sys:artifactId>hello</sys:artifactId>
        <sys:version>2.1.1.2</sys:version>
        <sys:type>car</sys:type>
        </sys:moduleId>
        <sys:dependencies/>
        <sys:hidden-classes/>
        <sys:non-overridable-classes/>
        </sys:environment>

        <context-root>/hello</context-root>
        <!-<disable-cookies>true</disable-cookies>->
        <logEffectiveWebXml>true</logEffectiveWebXml>
        <useHttpOnly>true</useHttpOnly>
        <cacheMaxSize>2410</cacheMaxSize>
        <cacheObjectMaxSize>512</cacheObjectMaxSize>
        <cachingAllowed>true</cachingAllowed>
        <unloadDelay>2000</unloadDelay>
        <Parameter name="org.test" value="test" override="false"></Parameter>
        </web-app>
        Keep same with other existing tomcat context attributes setting.
        Parameter sample code in servlet:
        PrintWriter out = res.getWriter();
        out.print("<b>"getServletContext().getInitParameter("org.test")"</b><br>");

        Pls review it, thanks.

        Show
        viola.lu added a comment - sample usage: <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1" xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.2" xmlns:sec="http://geronimo.apache.org/xml/ns/security-2.0" xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2"> <sys:environment> <sys:moduleId> <sys:groupId>org.test.apache</sys:groupId> <sys:artifactId>hello</sys:artifactId> <sys:version>2.1.1.2</sys:version> <sys:type>car</sys:type> </sys:moduleId> <sys:dependencies/> <sys:hidden-classes/> <sys:non-overridable-classes/> </sys:environment> <context-root>/hello</context-root> <!- <disable-cookies>true</disable-cookies> -> <logEffectiveWebXml>true</logEffectiveWebXml> <useHttpOnly>true</useHttpOnly> <cacheMaxSize>2410</cacheMaxSize> <cacheObjectMaxSize>512</cacheObjectMaxSize> <cachingAllowed>true</cachingAllowed> <unloadDelay>2000</unloadDelay> <Parameter name="org.test" value="test" override="false"></Parameter> </web-app> Keep same with other existing tomcat context attributes setting. Parameter sample code in servlet: PrintWriter out = res.getWriter(); out.print("<b>" getServletContext().getInitParameter("org.test") "</b><br>"); Pls review it, thanks.
        Hide
        viola.lu added a comment -

        Based on Ivan's advice, more context level support makes TomcatWebAppContext constructor more complicated, so will try to follow HostGbean using reflection and IntrospectionUtils.setProperty , make code simpler.

        Show
        viola.lu added a comment - Based on Ivan's advice, more context level support makes TomcatWebAppContext constructor more complicated, so will try to follow HostGbean using reflection and IntrospectionUtils.setProperty , make code simpler.
        Hide
        viola.lu added a comment -

        Use IntrospectionUtils.setProperty to set context attributes.
        Now user can configure context attributes as below:
        <ContextAttributes logEffectiveWebXml="true" useHttpOnly="true" cacheMaxSize="2410" cacheObjectMaxSize="512" cachingAllowed="true" unloadDelay="2000"></ContextAttributes>
        All attributes can be setup but only some of them values change will be took into effect, others will logged into warning:
        2010-09-19 16:43:48,859 WARN [TomcatModuleBuilder] Only cacheMaxSize, cacheObjectMaxSize, cachingAllowed, cookies, crossContext, docBase, logEffectiveWebXml,unloadDelay,useHttpOnly,workDir context attributes can be set through geronimo-web.xml

        Set context servlet parameters as below:
        <Parameter name="org.test" value="test" override="false"></Parameter>
        they keep similar with tomcat context configuration way.

        Pls review it, thanks.

        Show
        viola.lu added a comment - Use IntrospectionUtils.setProperty to set context attributes. Now user can configure context attributes as below: <ContextAttributes logEffectiveWebXml="true" useHttpOnly="true" cacheMaxSize="2410" cacheObjectMaxSize="512" cachingAllowed="true" unloadDelay="2000"></ContextAttributes> All attributes can be setup but only some of them values change will be took into effect, others will logged into warning: 2010-09-19 16:43:48,859 WARN [TomcatModuleBuilder] Only cacheMaxSize, cacheObjectMaxSize, cachingAllowed, cookies, crossContext, docBase, logEffectiveWebXml,unloadDelay,useHttpOnly,workDir context attributes can be set through geronimo-web.xml Set context servlet parameters as below: <Parameter name="org.test" value="test" override="false"></Parameter> they keep similar with tomcat context configuration way. Pls review it, thanks.
        Hide
        Ivan added a comment -

        Commit the changes based on the patch from viola.lu to trunk at revision: 1001341.

        Show
        Ivan added a comment - Commit the changes based on the patch from viola.lu to trunk at revision: 1001341.

          People

          • Assignee:
            viola.lu
            Reporter:
            Ivan
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development