Skip to content

Commit

Permalink
#225: session timeout now configurable
Browse files Browse the repository at this point in the history
- use sessionTimeoutInMinutes config token
  • Loading branch information
ypujante committed Aug 14, 2013
1 parent 6bed3f0 commit a706c6f
Show file tree
Hide file tree
Showing 4 changed files with 198 additions and 1 deletion.
179 changes: 179 additions & 0 deletions ...ded-wars/[email protected]@/WEB-INF/web.xml.gtmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
<web-app xmlns="http://java.sun.com/xml/ns/javaee" metadata-complete="true" version="2.5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<display-name>/console-production-dev</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>console-production-dev</param-value>
</context-param>
<context-param>
<param-name>sample</param-name>
<param-value>Sample Value</param-value>
</context-param>
<filter>
<filter-name>shiroFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
<init-param>
<param-name>targetFilterLifecycle</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter>
<filter-name>shiroSavedRequestFilter</filter-name>
<filter-class>org.apache.shiro.grails.SavedRequestFilter</filter-class>
</filter>
<filter>
<filter-name>sitemesh</filter-name>
<filter-class>org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter</filter-class>
</filter>
<filter>
<filter-name>DeclaredResourcesPluginFilter</filter-name>
<filter-class>org.grails.plugin.resource.ProcessingFilter</filter-class>
</filter>
<filter>
<filter-name>AdHocResourcesPluginFilter</filter-name>
<filter-class>org.grails.plugin.resource.ProcessingFilter</filter-class>
<init-param>
<param-name>adhoc</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter>
<filter-name>charEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
<init-param>
<param-name>targetBeanName</param-name>
<param-value>characterEncodingFilter</param-value>
</init-param>
<init-param>
<param-name>targetFilterLifecycle</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter>
<filter-name>urlMapping</filter-name>
<filter-class>org.codehaus.groovy.grails.web.mapping.filter.UrlMappingsFilter</filter-class>
</filter>
<filter>
<filter-name>hiddenHttpMethod</filter-name>
<filter-class>org.codehaus.groovy.grails.web.filters.HiddenHttpMethodFilter</filter-class>
</filter>
<filter>
<filter-name>grailsWebRequest</filter-name>
<filter-class>org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequestFilter</filter-class>
</filter>
<filter>
<filter-name>grailsCacheFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
<init-param>
<param-name>targetFilterLifecycle</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>charEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>DeclaredResourcesPluginFilter</filter-name>
<url-pattern>/static/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>AdHocResourcesPluginFilter</filter-name>
<url-pattern>/images/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>AdHocResourcesPluginFilter</filter-name>
<url-pattern>*.css</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>AdHocResourcesPluginFilter</filter-name>
<url-pattern>*.js</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>shiroFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>ERROR</dispatcher>
</filter-mapping>
<filter-mapping>
<filter-name>hiddenHttpMethod</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
<filter-mapping>
<filter-name>shiroSavedRequestFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>grailsWebRequest</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
<dispatcher>ERROR</dispatcher>
</filter-mapping>
<filter-mapping>
<filter-name>sitemesh</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>ERROR</dispatcher>
</filter-mapping>
<filter-mapping>
<filter-name>urlMapping</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
<filter-mapping>
<filter-name>grailsCacheFilter</filter-name>
<url-pattern>*.dispatch</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<listener>
<listener-class>org.codehaus.groovy.grails.plugins.log4j.web.util.Log4jConfigListener</listener-class>
</listener>
<listener>
<listener-class>org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>grails</servlet-name>
<servlet-class>org.codehaus.groovy.grails.web.servlet.GrailsDispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>gsp</servlet-name>
<servlet-class>org.codehaus.groovy.grails.web.pages.GroovyPagesServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>grails-errorhandler</servlet-name>
<servlet-class>org.codehaus.groovy.grails.web.servlet.ErrorHandlingServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>gsp</servlet-name>
<url-pattern>*.gsp</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>grails-errorhandler</servlet-name>
<url-pattern>/grails-errorhandler</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>grails</servlet-name>
<url-pattern>*.dispatch</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>${configTokens.sessionTimeoutInMinutes ?: '30'}</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.gsp</welcome-file>
</welcome-file-list>
<error-page>
<error-code>500</error-code>
<location>/grails-errorhandler</location>
</error-page>
</web-app>
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public abstract class BasePackagerTest extends GroovyTestCase
return closure
}

public static final int CONFIG_TEMPLATES_COUNT = 22
public static final int CONFIG_TEMPLATES_COUNT = 23

public static final String GLU_VERSION = 'g.v.0'
public static final String ZOOKEEPER_VERSION = 'z.v.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ public class TestConsoleServerPackager extends BasePackagerTest
"/${jettyDistribution}/contexts/glu-jetty-context.xml": DEFAULT_GLU_JETTY_CONTEXT,
"/${jettyDistribution}/lib": DIRECTORY,
"/${jettyDistribution}/lib/acme.jar": 'this is the jar',
"/glu": DIRECTORY,
"/glu/repository": DIRECTORY,
"/glu/repository/exploded-wars": DIRECTORY,
"/glu/repository/exploded-wars/org.linkedin.glu.console-webapp-${GLU_VERSION}": DIRECTORY,
"/glu/repository/exploded-wars/org.linkedin.glu.console-webapp-${GLU_VERSION}/WEB-INF": DIRECTORY,
"/glu/repository/exploded-wars/org.linkedin.glu.console-webapp-${GLU_VERSION}/WEB-INF/web.xml": { r ->
assertTrue(r.file.text.contains('<session-timeout>30</session-timeout>'))
},
]

checkPackageContent(expectedResources, artifact.location)
Expand Down Expand Up @@ -132,6 +140,7 @@ consoles << [
tuning: '<tuning config>',
commands: '<commands config>',
misc: '<misc config>',
sessionTimeoutInMinutes: 15
]
]
Expand Down Expand Up @@ -308,6 +317,9 @@ JVM_SIZE="-Xmx555m"
"/glu/repository/exploded-wars/${consoleWar}/WEB-INF/lib/db-driver.jar": "this is the driver",
"/glu/repository/exploded-wars/${consoleWar}/WEB-INF/lib/plugin1.jar": "this is the plugin1",
"/glu/repository/exploded-wars/${consoleWar}/WEB-INF/lib/plugin2.jar": "this is the plugin2",
"/glu/repository/exploded-wars/org.linkedin.glu.console-webapp-${GLU_VERSION}/WEB-INF/web.xml": { r ->
assertTrue(r.file.text.contains('<session-timeout>15</session-timeout>'))
},
]

checkPackageContent(expectedResources, artifact.location)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ public class TestGluPackager extends BasePackagerTest
"/${console}/${jettyDistribution}/contexts": DIRECTORY,
"/${console}/${jettyDistribution}/contexts/console-jetty-context.xml": FILE,
"/${console}/${jettyDistribution}/contexts/glu-jetty-context.xml": FILE,
"/${console}/glu": DIRECTORY,
"/${console}/glu/repository": DIRECTORY,
"/${console}/glu/repository/exploded-wars": DIRECTORY,
"/${console}/glu/repository/exploded-wars/org.linkedin.glu.console-webapp-${GLU_VERSION}": DIRECTORY,
"/${console}/glu/repository/exploded-wars/org.linkedin.glu.console-webapp-${GLU_VERSION}/WEB-INF": DIRECTORY,
"/${console}/glu/repository/exploded-wars/org.linkedin.glu.console-webapp-${GLU_VERSION}/WEB-INF/web.xml": FILE,
], bulkFailure),
'/zookeeper-clusters': DIRECTORY,
"/${zkc}": DIRECTORY,
Expand Down

0 comments on commit a706c6f

Please sign in to comment.