servlet-listeners

servlet session , after logout , when back button of browser is pressed , again the secure page is shown [duplicate]

ぃ、小莉子 提交于 2019-12-18 11:18:09
问题 This question already has answers here : Prevent user from seeing previously visited secured page after logout (5 answers) Closed 2 years ago . I have a servlet and a HTML page. How can I prevent the user from hitting the back button of the browser after logout? I have read the same question in stackoverflow , but the answers are using browser history disable with java script or using page--no cache in http headers. How can we implement it using servlets that prevent the go back action, the

trace logout time using HttpSessionBindingListeners

守給你的承諾、 提交于 2019-12-13 04:42:58
问题 How can i trace log out time using httpsessionbindinglistner ? I have given sample code and giving below but it is not working. RESOURCE IS HERE package com.tunatore.listeners; import javax.servlet.http.HttpSessionBindingEvent; import javax.servlet.http.HttpSessionBindingListener; /** * * @author tunatore */ public class ObjectWillBeInSession implements HttpSessionBindingListener{ private String property1 = null; private String property2 =null; @Override public void valueBound

How to query the servlet container to obtain effective URL from a ServletContextListener?

a 夏天 提交于 2019-12-13 02:25:53
问题 In extension to this question is there a way to obtain the effective URL of a specific page in the same container from the scope of a ServletContextListener ? A bit of background why I need this : Within a fairly complex system I have setup a simple servlet to display the current information in JSON so I can display it easily on demand. Now I want to go one step further and keep a historical record of this to see the evolution in time of these measurement points. I have setup a simple

How to register listener in Spring without deployment descriptor

夙愿已清 提交于 2019-12-12 10:55:59
问题 I'm slowly stepping in Java world through Spring Framework (4.1.0) and need your help with Listeners. I have created application without deployment descriptor, all Spring related configuration is managed in @Configuration annotated classes. Everything is working but I can't find a way to register listeners. Question : How I can register listeners in Spring (4.1.0) based on Java @Configuration annotated classed ? 回答1: You do that with the help of the WebApplicationInitializer class.

ServletContextListener scheduler carry out a task - then stalls on EJB method call to persist into a database in JBOSS 7.1

*爱你&永不变心* 提交于 2019-12-11 18:53:39
问题 I have a ServletContextListener that runs a tasks every 20 seconds - That task is to listen on a folder and check for new files and if found import the new file into a database. This is set up using the answer given from this question: Spawning threads in a JSF managed bean for scheduled tasks using a timer Java Code for ServletContextListener @WebListener public class Listener implements ServletContextListener { private ScheduledExecutorService scheduler; @Override public void

Debug ServletContextListener.contextDestroyed() by setting the breaking point in eclipse

家住魔仙堡 提交于 2019-12-09 06:13:47
问题 I implement a custom ServletContextListener and place the breakpoints on both the contextInitialized() and contextDestroyed() . When starting the web application using WTP , contextInitialized() can be stopped by the debugger. But when I shut down the web application , the breakpoints in the contextDestroyed() do not work and the web application just shutdown . Is it possible and how to use debugger to debug contextDestroyed() in eclipse ? I want to check if the resource used can be released

JSF: How to redirect a user to a another page according to the value of a specific FacesContext session attribute

◇◆丶佛笑我妖孽 提交于 2019-12-04 19:43:55
In my JSF application, I need to redirect the user from Page A to page B if a session attribute such as userRole has a value of "contributor", and to a page C, for example, if it is "author". I'm told that I have to implement a page listener, or a session listener perhaps. Although I understand writing a listener class is quite straightforward and standard, I don't know how to set it up on the JSF page itself (to listen to the session). Anybody? BalusC A session listener ( HttpSessionListener ) is unsuitable since it doesn't have a reference to the current HTTP request/response, which are

web.xml order or filter and listener

℡╲_俬逩灬. 提交于 2019-12-04 07:57:08
For a Java EE web application, I have a listener that implements ServletRequestListener, and a Filter. Is there a way to specify at web.xml that the filter should be called before the listener? I've already tried declaring the filter and its mapping before the listener, but the listener is still executed before. Any idea? <filter> <filter-name>myfilter</filter-name> <filter-class>com.example.MyFilter</filter-class> </filter> <filter-mapping> <filter-name>myfilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <listener> <listener-class>com.example.MyServletRequestListener <

Debug ServletContextListener.contextDestroyed() by setting the breaking point in eclipse

巧了我就是萌 提交于 2019-12-03 08:33:35
I implement a custom ServletContextListener and place the breakpoints on both the contextInitialized() and contextDestroyed() . When starting the web application using WTP , contextInitialized() can be stopped by the debugger. But when I shut down the web application , the breakpoints in the contextDestroyed() do not work and the web application just shutdown . Is it possible and how to use debugger to debug contextDestroyed() in eclipse ? I want to check if the resource used can be released properly during the shut-down of the web application. The contextDestroyed() will only be called when

Publishing JAX-WS Webservice with Guice in a Servlet Application

大兔子大兔子 提交于 2019-12-02 04:12:21
问题 We are currently porting an existing JBoss EJB application to a pure servlet solution which is supposed to run in a Jetty (we're currently using version 6, but the version is mostly irrelevant) and which uses Guice for dependency injection and AOP. Despite the huge complexity we've been quite succesfully so far. The persistence layer and most of our services are up and running, including JAX-RS REST services. However, when we started porting our existing JAX-WS SOAP services we ran into