Questions tagged [servlet-3.0]

Java Servlets 3.0 is a new API that supports extensibility/pluggability, Ease of Development (EoD) using the newer language features, Async and Comet support, Security, and other features being as part of the revision for Java EE 6.

Version 3 of the servlet API adds the following to version 2.5

  • async response
  • multipart support
  • annotation configuration (no web.xml)
  • generics in the API
  • resources (including JSPs) in JARs under META-INF/resources

Links

941 questions
7
votes
2 answers

Tomcat 7.0.32 +Spring MVC Servlet 3 Async is not working

I wrote very simple controller which test Servlet 3 features: @Autowired ThreadPoolTaskExecutor taskExecutor; @RequestMapping(value="{name}", method = RequestMethod.GET) public @ResponseBody DeferredResult
danny.lesnik
  • 18,479
  • 29
  • 135
  • 200
7
votes
2 answers

Why create new thread with startAsync instead of doing work in servlet thread?

In servlet 3.0 one can use startAsync to put long work in another thread, so that you can free up servlet thread. Seems that I'm missing something, because I don't see, why not just to use servlet thread for working? Is the thread created by…
Aivar
  • 6,814
  • 5
  • 46
  • 78
6
votes
1 answer

Is using Servlet 3.0 async redundant when deployed to Tomcat with the NIO connector?

I saw this thread: Java - Async in Servlet 3.0 vs NIO in Servlet 3.1 but it seems to be concerning the Servlet 3.1 NIO (as opposed to the Tomcat NIO HTTP connector). It's my understanding that configuring Tomcat with the NIO HTTP connectors…
Joe
  • 4,585
  • 3
  • 37
  • 51
6
votes
1 answer

Redirect to protected resource or original/saved request after Servlet 3.0 HttpServletRequest#login() authentication?

As expected, the login page loads when a protected/secure resource is requested: FORM jdbc /login.xhtml
6
votes
2 answers

Logging from servlet context destroyed event

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…
Paul Turner
  • 38,949
  • 15
  • 102
  • 166
6
votes
1 answer

MultipartConfig with Servlet 3.0 on Spring MVC

How do I add in multipart configuration to a spring mvc app which uses controllers with methods annotated with RequestMapping? Background: I want to enable csrf protection and so have added the security:csrf tag in my spring config. I have a…
edwardmlyte
  • 15,937
  • 23
  • 58
  • 83
6
votes
2 answers

Spring Security 3.2: @Autowire doesn't work with java configuration and custom AuthenticationProvider in Spring MVC application?

This problem is relatively well discussed in several blog posts and SO questions. Nevertheless, I wasn't able to find one specifically addressing the problem with java configuration. I'm suspecting that I'm doing something wrong in my java…
6
votes
1 answer

Servlet 3.0 annotations in conjuction with Guice

I am attempting to update a legacy Guice application, and I was wondering if there is any sort of preferred way of doing things when taking Servlet 3.0 annotations into consideration. For example, my application has a filter, FooFilter, which is…
oberger
  • 1,217
  • 2
  • 16
  • 31
6
votes
4 answers

Deployment of a JAX-RS application using web.xml, Servlet 3.0 and Jersey

I'm trying to deploy my application, using web.xml, servlet 3.0, and jersey API. Unfortunately, it doesn't work. This is MyApplication.class : package com.example; public class MyApplication extends Application { public Set>…
Holyheart
  • 83
  • 1
  • 2
  • 11
6
votes
2 answers

How to use annotations instead of web.xml in the servlet to specify url

How to provide an annotation mapping for web.XML in annotation. I have done with web.XML. I want to try with Annotation mapping, like so:
Sheel
  • 847
  • 2
  • 8
  • 20
6
votes
2 answers

What is an 'error dispatch' in servlet processing?

The javadoc of the javax.servlet.AsyncContext interface says: In the event that an asynchronous operation has timed out, the container must run through these steps: Invoke, at their onTimeout method, all AsyncListener instances registered…
2020
  • 2,821
  • 2
  • 23
  • 40
6
votes
1 answer

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

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…
cc4re
  • 4,821
  • 3
  • 20
  • 27
6
votes
2 answers

Programmatic access to MultiPartConfig in Servlet 3.0

I use Servlet 3 @MultiPartConfig annotation to implement file upload in my application. I need set multipart-config location parameter at the runtime (not hardcode in annotaion parameter). Is there any API for programmatic access to multipart-config…
Vik Gamov
  • 5,446
  • 1
  • 26
  • 46
6
votes
1 answer

Loading resources using Jersey and @ApplicationPath annotation

I'm trying to deploy a basic jersey restful service to Tomcat7 without web.xml: @WebServlet(loadOnStartup=1) @ApplicationPath("resources") @Path("/mypath/{name}") public class MyResource extends Application { @Override public Set>…
wulfgarpro
  • 6,666
  • 12
  • 69
  • 110
6
votes
3 answers

Servlet forward response to caller/previous page

I'm trying to forward a servlet response to the same page from when it came from (a.k.a.: the previous page, or the "servlet" caller). I've seen many answers (like this and this) but still can't make it work. I usually do the following to redirect…
Christian Vielma
  • 15,263
  • 12
  • 53
  • 60