servlet-3.0

Logging from servlet context destroyed event

给你一囗甜甜゛ 提交于 2019-12-20 03:28:45
问题 Within my Servlet-based application, I would like to log events for startup and shutdown. I've tried to implement the ServletContextListener interface to do this: public class DiagnosticListener implements ServletContextListener { private static final Logger LOG = LogManager.getLogger(DiagnosticListener.class); @Override public void contextInitialized( final ServletContextEvent sce ) { LOG.info("Context initialized."); } @Override public void contextDestroyed( final ServletContextEvent sce )

How to disable Servlet 3.0 scanning and auto loading of components

北城余情 提交于 2019-12-20 02:55:01
问题 We have an application which keeps loading instances of ServletContainerInitializer from our 3rd party libs. One instance is JerseyServletContainerInitializer and the other is SpringServletContainerInitializer. These classes from Jersey and Spring seem to "take over" our servlet context messing with our mappings and filters and such. We really need to explicitly configure our servlet container's web.xml and this auto scanning is driving us insane. By simply pulling in a dependency in our pom

Tomcat 7 Async Processing failing - only one request processed simultanously

╄→гoц情女王★ 提交于 2019-12-19 08:12:40
问题 I was trying to implement COMET chat using Async Processing defined in Servlet API 3. It was not working - chat got blocked, so I have created debug servlet to test async part only. This is my doGet method: @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { log.debug("doGet called"); int timeout = 30 + RandomUtils.nextInt(60); String message = RandomStringUtils.randomAlphanumeric(50 + RandomUtils.nextInt(250));

Tomcat 7 Async Processing failing - only one request processed simultanously

不问归期 提交于 2019-12-19 08:12:11
问题 I was trying to implement COMET chat using Async Processing defined in Servlet API 3. It was not working - chat got blocked, so I have created debug servlet to test async part only. This is my doGet method: @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { log.debug("doGet called"); int timeout = 30 + RandomUtils.nextInt(60); String message = RandomStringUtils.randomAlphanumeric(50 + RandomUtils.nextInt(250));

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

How to integrate JAX-RS with CDI in a Servlet 3.0 container

六月ゝ 毕业季﹏ 提交于 2019-12-18 04:08:29
问题 I have a web application running on a Servlet 3.0 container (Jetty 9.0.4) using JSF 2.2 (Mojorra 2.1.3) & CDI 1.1 (Weld 2.0.3). No full-fledged application server is used. In this application I also have a JAX-RS 2.0 (Jersey 2.2) resource class serving REST requests. I have integrated JAXB binding and also JSON marshalling (Jackson 2.2). I use Maven 3.0.5 for the build management. These are the relevant parts of my project setup: Maven pom.xml: ... <dependencies> <!-- Servlet 3.0 API -->

What's the purpose of AsyncContext.start(…) in Servlet 3.0?

浪尽此生 提交于 2019-12-17 21:51:34
问题 Servlet API says about "AsyncContext.start": void start(java.lang.Runnable run) Causes the container to dispatch a thread, possibly from a managed thread pool, to run the specified Runnable. The container may propagate appropriate contextual information to the Runnable. From this description it's not clear how does it relate to task of optimizing thread usage when job requires waiting. In "Servlet & JSP", Budi Kurniawan gives example of Servlet 3.0 async features, where he uses AsyncContext

eclipse vs tomcat deployment - exported war (partially) fails while the project runs in eclipse

冷暖自知 提交于 2019-12-17 21:08:19
问题 I have a webapp in eclipse juno - when I hit Run on server runs fine - either inside eclipse's browser (I am on windows) or in FF. Right click > export war > dump this into $CATALINA_HOME/webapps > all is working fine (got unpacked alright) EXCEPT my custom tags - I had a WEB-INF\functions.tld file which is apparently not read. The only difference between the auto-generated eclipse server.xml (in Servers project) and the default Tomcat server.xml was the line : <Context docBase="ted2012" path

eclipse vs tomcat deployment - exported war (partially) fails while the project runs in eclipse

守給你的承諾、 提交于 2019-12-17 20:57:08
问题 I have a webapp in eclipse juno - when I hit Run on server runs fine - either inside eclipse's browser (I am on windows) or in FF. Right click > export war > dump this into $CATALINA_HOME/webapps > all is working fine (got unpacked alright) EXCEPT my custom tags - I had a WEB-INF\functions.tld file which is apparently not read. The only difference between the auto-generated eclipse server.xml (in Servers project) and the default Tomcat server.xml was the line : <Context docBase="ted2012" path

Unable to deploy SlingServlet in CQ

蓝咒 提交于 2019-12-17 20:54:07
问题 I'm trying to create a servlet in CQ to access some back-end services. Then from my page will make an AJAX call to get the response from servlet. @Component(immediate = true, metatype = false, label = "feedServlet") @Service(Servlet.class) @Properties(value = { @org.apache.felix.scr.annotations.Property(name = "sling.servlet.methods", value = "POST"), @org.apache.felix.scr.annotations.Property(name = "sling.servlet.resourceTypes", value ="/bin/feedServlet/"), @org.apache.felix.scr.annotations