0

Problem with session timeout.

asked 2011-03-28 09:01:25 +0800

zkdev333 gravatar image zkdev333
57 1

updated 2011-03-28 09:02:19 +0800

Hi, all. I have a problem with redirecting when my session is time out. When I using only spring framework in my project all worked fine. I.e. when session was timeout, client was redirected to login form. But after using zk framework, when session is time out, I see this message
"The server is temporarily out of service.
Would you like to try again?

(syntax error)"

and nothing happens. I look this page http://books.zkoss.org/wiki/ZK_Configuration_Reference/zk.xml/The_session-config_Element#The_timeout-message_Element , but nothing helps me. How can I fix this problem?

delete flag offensive retag edit

7 Replies

Sort by » oldest newest

answered 2011-03-31 12:29:47 +0800

twiegand gravatar image twiegand
1807 3

zkdev333,

You might have a look here for some information on how to change the message or redirect to a different page.

Regards,

Todd

link publish delete flag offensive edit

answered 2011-07-25 07:25:18 +0800

pschenke gravatar image pschenke
12

i am also running into this problem. firefox gives the error-message from the OP, chrome says "(Unexpected Token <)". it's showing up in a javascript-alert-window (or something similar), not as a zk-dialog.

i've worked with the zk-timeout before and never had any problems. however, recently this message appears.
it is triggered by both, httpsession-timeout as well as zk-timeout.
if i click the "reload"-button in that alert-window, the regular zk-timeout-dialog appears.
unfortunately, i've had no luck so far in supressing the message or finding its cause.

link publish delete flag offensive edit

answered 2011-07-25 13:10:45 +0800

iantsai gravatar image iantsai
2755 1

Hi, pschenke

Is that possible the timeout js in zk.xml has some typo or tags without end?
Maybe we can take a look at the timeout config of your zk.xml.

link publish delete flag offensive edit

answered 2011-07-26 04:55:42 +0800

pschenke gravatar image pschenke
12

zk.xml:

<?xml version="1.0" encoding="utf-8" ?>
<zk>
	<listener>
		<description>ThreadLocal Synchronization Listener</description>
		<listener-class>org.zkoss.zkplus.util.ThreadLocalListener
		</listener-class>
	</listener>
	<preference>
		<name>ThreadLocal</name>
		<value>
			org.springframework.security.context.ThreadLocalSecurityContextHolderStrategy=contextHolder
		</value>
	</preference>
	<!-- <language-config> <addon-uri>/WEB-INF/zk-analytics-addon.xml</addon-uri> 
		</language-config> -->
	<session-config>
		<device-type>ajax</device-type>
    	<automatic-timeout/>
		<timer-keep-alive>true</timer-keep-alive>
		<timeout-message>My custom timeout-message. Cönäining Ümläüts.</timeout-message>
	</session-config>
	<library-property>
		<name>org.zkoss.zul.Button.mold</name>
		<value>trendy</value>
	</library-property>
	<library-property>
		<name>org.zkoss.zul.progressbox.position</name>
		<value>center,center</value>
	</library-property>
</zk>

and for the sake of completeness: web.xml

<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
	
	<session-config>
      <session-timeout>1</session-timeout> 
    </session-config>
    
	<!-- Spring Security -->
	<filter>
		<filter-name>springSecurityFilterChain</filter-name>
		<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
	</filter>

	<filter-mapping>
		<filter-name>springSecurityFilterChain</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>

	<listener>
		<listener-class>
			org.springframework.security.web.session.HttpSessionEventPublisher</listener-class>
	</listener>

	<!-- MDC Username-logging -->
	<filter>
		<filter-name>mdcUsernameFilter</filter-name>
		<filter-class>tv.px.common.PrincipalMdcFilter</filter-class>
	</filter>
	
	<filter-mapping>
		<filter-name>mdcUsernameFilter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>

	<!-- Spring -->
	<listener>
		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>

	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>/WEB-INF/webapp-context.xml</param-value>
	</context-param>

	<!-- Hibernate -->
	<filter>
		<filter-name>hibernateFilter</filter-name>
		<filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class>
	</filter>
	<filter-mapping>
		<filter-name>hibernateFilter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>

	<!-- ZK -->

	<listener>
		<description>
			Used to cleanup when a session is destroyed
		</description>
		<display-name>ZK Session Cleaner</display-name>
		<listener-class>org.zkoss.zk.ui.http.HttpSessionListener</listener-class>
	</listener>

	<servlet>
		<description>ZK loader for evaluating ZK pages</description>
		<servlet-name>zkLoader</servlet-name>
		<servlet-class>org.zkoss.zk.ui.http.DHtmlLayoutServlet</servlet-class>
		<!-- Must. Specifies URI of the update engine (DHtmlUpdateServlet). -->
		<init-param>
			<param-name>update-uri</param-name>
			<param-value>/zkau</param-value>
		</init-param>
		<load-on-startup>1</load-on-startup><!-- MUST -->
	</servlet>
	<servlet-mapping>
		<servlet-name>zkLoader</servlet-name>
		<url-pattern>*.zul</url-pattern>
	</servlet-mapping>
	<servlet-mapping>
		<servlet-name>zkLoader</servlet-name>
		<url-pattern>*.zhtml</url-pattern>
	</servlet-mapping>
	<servlet>
		<description>The asynchronous update engine for ZK</description>
		<servlet-name>auEngine</servlet-name>
		<servlet-class>org.zkoss.zk.au.http.DHtmlUpdateServlet</servlet-class>
	</servlet>
	<servlet-mapping>
		<servlet-name>auEngine</servlet-name>
		<url-pattern>/zkau/*</url-pattern>
	</servlet-mapping>

	<servlet>
		<servlet-name>remoting</servlet-name>
		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>

	<servlet-mapping>
		<servlet-name>remoting</servlet-name>
		<url-pattern>/remoting/*</url-pattern>
	</servlet-mapping>


	<!-- //// -->
	<!-- MIME mapping -->
	<mime-mapping>
		<extension>gif</extension>
		<mime-type>image/gif</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>html</extension>
		<mime-type>text/html</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>htm</extension>
		<mime-type>text/html</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>jad</extension>
		<mime-type>text/vnd.sun.j2me.app-descriptor</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>jpeg</extension>
		<mime-type>image/jpeg</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>jpg</extension>
		<mime-type>image/jpeg</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>js</extension>
		<mime-type>application/x-javascript</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>png</extension>
		<mime-type>image/png</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>txt</extension>
		<mime-type>text/plain</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>xml</extension>
		<mime-type>text/xml</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>zhtml</extension>
		<mime-type>text/html</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>zul</extension>
		<mime-type>text/html</mime-type>
	</mime-mapping>
	<welcome-file-list>
		<welcome-file>index.zul</welcome-file>
	</welcome-file-list>
</web-app>

link publish delete flag offensive edit

answered 2011-07-26 15:13:57 +0800

iantsai gravatar image iantsai
2755 1

This one(zk.xml) works fine to me, maybe you have to provide an example to reproduce it.

link publish delete flag offensive edit

answered 2011-07-27 03:06:24 +0800

pschenke gravatar image pschenke
12

i played around with the settings some more yesterday and finally found that this configuration works fine in jetty but produces the mentioned error when run in tomcat.
if i remove the automatic-timeout statement, i get the error in jetty, too.

i also found out that using the keep-alive-timer keeps the http-session-timeout from kicking in, so this can be used as a dirty workaround.

i may provide example-code later today, but i keep getting this error for all pages without timers.

link publish delete flag offensive edit

answered 2011-07-27 11:35:37 +0800

iantsai gravatar image iantsai
2755 1

By the way, can you make sure the encoding of your file?
There are some non-ASCII character out there in your messages, so if the file encoding is not UTF-8, then things could happened.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2011-03-28 09:01:25 +0800

Seen: 1,375 times

Last updated: Jul 27 '11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More