servlet-3.0

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

删除回忆录丶 提交于 2019-11-27 22:34:25
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 startAsync somehow cheaper? Tomasz Nurkiewicz In most situations when handling requests you are blocking or waiting on some external resource/condition. In this case you are occupying the thread (hence a lot of memory) without doing any work. With servlet 3.0 you can serve thousands of concurrent connections, much more than available threads. Think about

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

匆匆过客 提交于 2019-11-27 21:24:38
问题 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 configuration files, since I've found some posts indicating that the problem can be resolved by removing the debug XML tag (https://jira.springsource.org/browse/SEC-1885). I'm using 3.2.0.RELEASE of spring security, and 3.2.6.RELEASE of spring framework.

How to avoid request set ASYNC_SUPPORTED=true to enable async servlet 3.0 processing on Tomcat 7?

点点圈 提交于 2019-11-27 20:44:17
Following an issue reported on this question , a solution was found: req.setAttribute("org.apache.catalina.ASYNC_SUPPORTED", true); This seems a bit strange and is not really 'portable' code (it won't hurt, but...). It seems specific to Tomcat 7. I am using Tomcat 7.0.14 as delivered by NetBeans 7.0.1. I could not find documentation indicating it is necessary to enable async request processing in servlet 3.0 with a catalina attribute. I could not find documentation indicating something special was necessary at the Tomcat configuration level too. Is there a way to avoid having to set ASYNC

Jetty throws “Missing content for multipart request” on multipart form request

不打扰是莪最后的温柔 提交于 2019-11-27 19:05:04
问题 I'm running Jetty 9 (jetty-9.0.5.v20130815) server with servlet-api 3.0.1 (javax.servlet:javax.servlet-api:3.0.1), my servlet is configured to accept multipart requests. web.xml - <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:fmt="http://java.sun.com/jsp/jstl/fmt" xmlns:web="http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1" xmlns="http://xmlns.jcp.org/xml

How to let JSF pass through HTML attributes

有些话、适合烂在心里 提交于 2019-11-27 18:36:17
问题 I am using Primefaces 3 in JSF 2 to make a search box. I need to add a non-standard attribute (x-webkit-speech) to the control so you would have something like this... <p:autoComplete x-webkit-speech="x-webkit-speech" ... /> Since this attribute isn't part of the autoComplete control JSF gives me a 500 error. But when I remove it, the page renders fine. In general, how do you specify pass through attributes on a JSF tag so they are ignored? 回答1: JSF by design ignores all custom attributes

can't import javax.servlet.annotation.WebServlet;

放肆的年华 提交于 2019-11-27 18:21:38
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 = {"/MyServlet"}) the errors are: The import javax.servlet.annotation cannot be resolved WebServlet cannot be resolved to a type I tried to import the servlet-api.jar to Eclipse but still the same, also tried to build and clean the project. I don't use Tomcat on my Eclipse only have it on my Netbeans. How can I solve the problem? BalusC I tried to import the

SpringServletContainerInitializer cannot be cast to javax.servlet.ServletContainerInitializer

寵の児 提交于 2019-11-27 14:21:51
I am attempting to move a xml-based Spring MVC app to a Java Configuration based app. There appears to be a mismatch with the various java.servlet classes available in maven. For instance, some provide the addServlet() method and some do not. Here is my config class: public class MyWebAppInitializer implements WebApplicationInitializer { @Override public void onStartup(ServletContext container) throws ServletException { AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); rootContext.register(JpaSandboxConf.class); ServletRegistration.Dynamic

How to use Servlet 3 @WebServlet & async with Spring MVC 3?

梦想的初衷 提交于 2019-11-27 13:57:11
问题 I would like to integrate the servlet 3.0 async support with spring MVC. Something like: @RequestMapping("/chat") @WebServlet(name="myServlet", asyncSupported=true) public String getMessage(String userName) { ...... } is it possible? 回答1: Not so fast, it is not that easy to implement good long polling. The method you mentioned works well, but there is a serious issue of "thread starvation" Each Long polling will use up one thread, if you have 1000 concurrent user you would need 1000 thread to

Is it safe for a Java servlet to spawn threads in order to satisfy a request?

徘徊边缘 提交于 2019-11-27 07:11:15
问题 Is it safe for my Java (Tomcat 8) web server to spawn threads in response to a HTTP request? I'm seeing posts and forums where some people say it's absolutely fine, and others say not to do it. My use case would be something like this: protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ... ... final MyResult res = new MyResult(); Thread first = new Thread(new Runnable() { @Override public void run() { // put this into res } })

Cordova POST - Request Forbidden 403. Not reaching Dispatcher Servlet

馋奶兔 提交于 2019-11-27 06:25:52
问题 I am developing a Cordova application. When I submit an $.ajax POST request from the Cordova app running on my physical device (not emulator) I receive a status code 403 forbidden. I can make a GET request from the device no problem. I can also login using a POST (receiving a 302 Found Response). Requests from Chrome are handled perfectly. I am using Spring / Tomcat. I have added CORS filter to my tomcat web.xml, and have added allow-origins * to my config.xml in Cordova. Below is the log