servlet-3.0

What is difference between @RequestBody and @RequestParam?

非 Y 不嫁゛ 提交于 2019-11-26 18:24:11
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 body. For example: @RequestMapping(value = "/something", method = RequestMethod.PUT) public void handle(@RequestBody String body, Writer writer) throws IOException { writer.write(body); } You convert the request body to the method argument by using an HttpMessageConverter . HttpMessageConverter is responsible for converting from the HTTP request

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

六眼飞鱼酱① 提交于 2019-11-26 12:24:51
问题 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 [file:/usr/java/jdk1.6.0_22/jre/lib/ext/jcharset.jar] from classpath mtyson Jul 19, 2011 10:04:40 AM org.apache.catalina.startup.HostConfig deployDirectory mtyson SEVERE: Error deploying web application directory ROOT mtyson org.apache.tomcat.util.bcel

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

白昼怎懂夜的黑 提交于 2019-11-26 10:15:28
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 ... <servlet> <servlet-name>org.foo.rest.MyApplication</servlet-name> </servlet> <servlet-mapping> <servlet-name>org.foo.rest.MyApplication</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> ... Java @ApplicationPath("/") public class MyApplication extends Application { ... } Configuration B (not working, exception thrown) @ApplicationPath("/")

How to define <welcome-file-list> and <error-page> in servlet 3.0&#39;s web.xml-less?

流过昼夜 提交于 2019-11-26 07:43:11
问题 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. <welcome-file-list> <welcome-file>/index.jsp</welcome-file> </welcome-file-list> <error-page> <error-code>404</error-code> <location>/pageNotFound</location> </error-page> Any help is appreciated 回答1: In Servlets 3.0 you don't need a web.xml for many cases, however,

What is difference between @RequestBody and @RequestParam?

风格不统一 提交于 2019-11-26 05:17:29
问题 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 body. For example: @RequestMapping(value = \"/something\", method = RequestMethod.PUT) public void handle(@RequestBody String body, Writer writer) throws IOException { writer.write(body); } You convert the request body to the method argument by

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

混江龙づ霸主 提交于 2019-11-26 03:28:12
问题 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 ... <servlet> <servlet-name>org.foo.rest.MyApplication</servlet-name> </servlet> <servlet-mapping> <servlet-name>org.foo.rest.MyApplication</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> ... Java @ApplicationPath(\"/\") public class

@WebServlet annotation with Tomcat 7

佐手、 提交于 2019-11-26 00:47:32
问题 In my application, I had a servlet which was defined like this in the web.xml : <servlet> <display-name>Notification Servlet</display-name> <servlet-name>NotificationServlet</servlet-name> <servlet-class>com.XXX.servlet.NotificationServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>NotificationServlet</servlet-name> <url-pattern>/notification/*</url-pattern> </servlet-mapping> After moving to use Tomcat 7, I would like to use the

Recommended way to save uploaded files in a servlet application

主宰稳场 提交于 2019-11-25 21:37:31
问题 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 machine I want to know : What is the best place to save the file ? Should I save it in /WEB-INF/uploads (advised against here) or someplace under $CATALINA_BASE (see here) or ... ? The JavaEE 6 tutorial gets the path from the user (:wtf:). NB : The