servlet-3.0

Primefaces FileUpload not working in Spring Boot

怎甘沉沦 提交于 2019-11-30 17:28:15
问题 I'm running my JSF project launching it with Spring Boot and taking advantage of the whole Spring environment. The configuration is: Mojarra 2.2.8 + Primefaces 5.1 + Spring Boot 1.1.9. That's how my POM.xml file looks like: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0<

Java Servlet 3.0 server push: Sending data multiple times using same AsyncContext

拜拜、爱过 提交于 2019-11-30 10:34:21
Lead by several examples and questions answered here ( mainly http://www.javaworld.com/javaworld/jw-02-2009/jw-02-servlet3.html?page=3 ), I want to have server sending the response multiple times to a client without completing the request. When request times out, I create another one and so on. I want to avoid long polling, since I have to recreate request every time I get the response. (and that quite isn't what async capabilities of servlet 3.0 are aiming at). I have this on server side: @WebServlet(urlPatterns = {"/home"}, name = "async", asyncSupported = true) public class CometServlet

Using Spring MVC 3.1+ WebApplicationInitializer to programmatically configure session-config and error-page

痴心易碎 提交于 2019-11-30 04:47:13
WebApplicationInitializer provides a way to programmatically represent a good portion of a standard web.xml file - the servlets, filters, listeners. However I have not been able to figure out a good way to represent these elements(session-timeout, error-page) using WebApplicationInitializer, is it necessary to still maintain a web.xml for these elements? <session-config> <session-timeout>30</session-timeout> </session-config> <error-page> <exception-type>java.lang.Exception</exception-type> <location>/uncaughtException</location> </error-page> <error-page> <error-code>404</error-code>

How to change the character encoding for Servlet 3.0 Spring MVC multipart upload forms?

妖精的绣舞 提交于 2019-11-30 03:25:26
问题 I have a pretty simple JSP/Servlet 3.0/Spring MVC 3.1 application. On one of my pages, I have multiple forms. One of these forms allows the user to upload a file and it is thus configured with enctype="multipart/form-data" . I configured the multipart upload in the web.xml file with the multipart-config element that is available since Servlet 3.0, combined with <bean id="multipartResolver" class="org.springframework.web.multipart.support.StandardServletMultipartResolver"/> in my spring

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

邮差的信 提交于 2019-11-30 02:29:15
This question already has an answer here: Prevent user from seeing previously visited secured page after logout 5 answers 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 http-header no cache is useless as Firefox says the page is expired when it is refreshed two times again the secure page is

Retrieve images from a folder outside web root folder using servlet

走远了吗. 提交于 2019-11-29 08:42:11
I'm trying to create a small servlet that uploads images and is able to retrieve them in a different page as a slideshow. I'm able to save them outside the WebApp folder, but while retrieving them I need them to be a part of a JSP which will have other content, apart from the images. Currently, I'm using BufferedImage and ImageIO classes to stream the images one at a time. BufferedImage image = ImageIO.read(new File("D:\\"+file.getName())); ImageIO.write(image, "jpg", response.getOutputStream()); The file is checked to be a JPEG file type earlier in the code. You need to understand how HTTP

MultipartConfig with Servlet 3.0 on Spring MVC

纵然是瞬间 提交于 2019-11-29 07:40:50
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 controller class with a method annotated with RequestMapping used for uploading files. I also followed the caveat instructions around multipart whereby I added the multipart filter above the security filter. When I tried to upload a file after adding the csrf tag I got an exception around a missing getParts() method. A quick google highlighted this was due

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

旧时模样 提交于 2019-11-29 04:02:05
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 --> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.1.0<

Using Spring MVC 3.1+ WebApplicationInitializer to programmatically configure session-config and error-page

天涯浪子 提交于 2019-11-29 02:13:18
问题 WebApplicationInitializer provides a way to programmatically represent a good portion of a standard web.xml file - the servlets, filters, listeners. However I have not been able to figure out a good way to represent these elements(session-timeout, error-page) using WebApplicationInitializer, is it necessary to still maintain a web.xml for these elements? <session-config> <session-timeout>30</session-timeout> </session-config> <error-page> <exception-type>java.lang.Exception</exception-type>

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

ε祈祈猫儿з 提交于 2019-11-29 00:13:10
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. Below the main files used in the spring security/mvc configuration and the custom