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

934 questions
124
votes
2 answers

Recommended way to save uploaded files in a servlet application

I read here that one should not save the file in the server anyway as it is not portable, transactional and requires external parameters. However, given that I need a tmp solution for tomcat (7) and that I have (relative) control over the server…
Mr_and_Mrs_D
  • 27,070
  • 30
  • 156
  • 325
86
votes
6 answers

What is difference between @RequestBody and @RequestParam?

I have gone through the Spring documentation to know about @RequestBody, and they have given the following explanation: The @RequestBody method parameter annotation indicates that a method parameter should be bound to the value of the HTTP request…
80
votes
6 answers

How to set up JAX-RS Application using annotations only (no web.xml)?

Is it possible to set up a JAX-RS application using annotations only? (using Servlet 3.0 and JAX-RS Jersey 1.1.0) I tried and had no luck. Using some web.xml seems required. Configuration A (working, but has web.xml configuration) web.xml ... …
Eran Medan
  • 41,875
  • 56
  • 175
  • 268
62
votes
3 answers

@WebServlet annotation with Tomcat 7

In my application, I had a servlet which was defined like this in the web.xml: Notification Servlet NotificationServlet
Dvora
  • 1,019
  • 1
  • 16
  • 24
50
votes
6 answers

Servlet-3 Async Context, how to do asynchronous writes?

Problem Description Servlet-3.0 API allows to detach a request/response context and answer to it later. However if I try to write a big amount of data, something like: AsyncContext ac = getWaitingContext() ; ServletOutputStream out =…
Artyom
  • 30,091
  • 20
  • 121
  • 208
42
votes
2 answers

What to do with annotations after setting metadata-complete="true" (which resolved slow Tomcat 7 start-up)?

Seems like the slow Tomcat 7 startup problem can be resolved with "metadata-complete" set to "true" in the web.xml, like so:
Danijel
  • 6,584
  • 16
  • 58
  • 109
36
votes
1 answer

Servlet 3.0: where is @WebServletContextListener?

I am trying to follow a Servlet 3.0 tutorial which refers to @WebServletContextListener. However, I cannot find such an annotation in my javaee-web-api-6.0.jar dependency (I am using maven). So, where is @WebServletContextListener?
Jérôme Verstrynge
  • 51,859
  • 84
  • 263
  • 429
34
votes
12 answers

Can't import javax.servlet.annotation.WebServlet

I have started to write app that can run on Google App Engine. But when I wanted to use my code from Netbeans to Eclipse I had an errors on: import javax.servlet.annotation.WebServlet; and @WebServlet(name = "MyServlet", urlPatterns =…
Vitaly Menchikovsky
  • 4,692
  • 15
  • 48
  • 87
33
votes
11 answers

Tomcat 7 - Servlet 3.0: Invalid byte tag in constant pool

tomcat 7.0.16 Java 1.6.0_22 CentOS 5.6 I just switched the web.xml to servlet 3.0 (from a app running 2.4 previously) and now I'm seeing the following error (turned on fine logging for org.apache.tomcat.util): mtyson FINE: Scanning JAR…
mtyson
  • 7,100
  • 13
  • 56
  • 97
30
votes
1 answer

Java - Async in Servlet 3.0 vs NIO in Servlet 3.1

Until now, as it applies to serving http requests, I thought the terms - asynchronous and non-blocking i/o meant the same thing. But apparently, they have been implemented separately in servlet 3.0 and 3.1 respectively. I am struggling to understand…
code4kix
  • 3,133
  • 4
  • 24
  • 39
29
votes
4 answers

How to define and in servlet 3.0's web.xml-less?

I have existing web-app which I want to convert into web.xml-less of servlet's 3.0. I've managed to make it working, however there are 2 tags in web.xml which I still don't know the equivalent code in web.xml-less environment.
Wins
  • 3,083
  • 3
  • 29
  • 61
28
votes
6 answers

Servlet 3 spec and ThreadLocal

As far as I know, Servlet 3 spec introduces asynchronous processing feature. Among other things, this will mean that the same thread can and will be reused for processing another, concurrent, HTTP request(s). This isn't revolutionary, at least for…
mindas
  • 25,644
  • 13
  • 93
  • 149
28
votes
1 answer

Tomcat connector architecture, thread pools and async servlets

I would like to understand Tomcat's thread model for BIO and NIO connectors. I am referencing the official Tomcat 7 documentaion for connectors which can be found here. Based on it, this is what I have in doubt: acceptorThread(s) : This is a…
mahasamatman
  • 591
  • 6
  • 10
24
votes
2 answers

How to download servlet 3 dependency that works with tomcat 7

i was using servlet 2.5 as follows: javax.servlet servlet-api 2.5 provided and i want to use servlet 3 since i…
Mahmoud Saleh
  • 31,861
  • 113
  • 313
  • 484
24
votes
1 answer

Java web app - What determines my Servlet API version? Does it get specified in web.xml?

I'm using Eclipse EE Juno and my current web application is using Dynamic web modules 2.4. I'm trying to bump the version up to 3.0 but for some reason I'm unable to. when I try to change the version in project facets I get Cannot change version of…
stackoverflow
  • 15,804
  • 43
  • 121
  • 181
1
2 3
62 63