servlet-3.0

Jetty addFilter with Spring Security and no web.xml

坚强是说给别人听的谎言 提交于 2019-12-03 03:39:39
Normally I would have added org.springframework.web.filter.DelegatingFilterProxy with a snippet like this to web.xml: <filter> <filter-name>springSecurityFilterChain</filter-name> <filter-class> org.springframework.web.filter.DelegatingFilterProxy </filter-class> </filter> <filter-mapping> <filter-name>springSecurityFilterChain</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> But with Servlet 3.0 Container and Jetty, I've removed web.xml. I'm trying to add DelegatingFilterProxy to Jetty's launch with: context.addFilter(DelegatingFilterProxy.class, "/*", EnumSet.allOf

servlet 3.0 @WebServlet use..what will be in web.xml?

空扰寡人 提交于 2019-12-03 02:33:35
I want to know the directory structure for using servlet 3.0 with Tomcat 7. I have used annotation @WebServlet without initialization parameters. I want to know what is to be written in web.xml file then?? Is and is still to be written...?? The file is stored in the classes folder of the tomcat. This is all you need in web.xml : <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> 3.0-compatible servlet container (like

Spring Security without web.xml

爱⌒轻易说出口 提交于 2019-12-03 02:02:00
问题 What is the recommended way to add Spring Security to a web application that is using Spring's new WebApplicationInitializer interface instead of the web.xml file? I'm looking for the equivalent of: <filter> <filter-name>springSecurityFilterChain</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> </filter> UPDATE The provided answers are reasonable but they both assume that I've got a servletContext instance. I've looked through the hierarchy of

Spring: Why “root” application context and “servlet” application context are created by different parties?

≡放荡痞女 提交于 2019-12-02 22:19:53
As I understand, a Spring based web application is initialized as below: Step 1 : Servlet container (e.g. Tomcat) locates the implementation of ServletContainerInitializer , which is SpringServletContainerInitializer . Step 2 : SpringServletContainerInitializer creates DispatcherServlet and ContextLoaderListener Step 3 : DispatcherServlet creates servlet application context . And ContextLoaderListener creates root application context . Step 1 is defined by Servlet 3.0 spec. Step 2, 3 are totally defined by Spring. I can see the rational of putting web beans in servlet context and non-web beans

Spring Security without web.xml

时光毁灭记忆、已成空白 提交于 2019-12-02 15:38:44
What is the recommended way to add Spring Security to a web application that is using Spring's new WebApplicationInitializer interface instead of the web.xml file? I'm looking for the equivalent of: <filter> <filter-name>springSecurityFilterChain</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> </filter> UPDATE The provided answers are reasonable but they both assume that I've got a servletContext instance. I've looked through the hierarchy of WebApplicationInitializer s and I don't see any access to the servlet context unless I choose to override

I want to insert data into a specific column if the column is null then insert else insert data into secnd column

∥☆過路亽.° 提交于 2019-12-02 15:21:43
问题 Here I am getting values from the jsp page String ACRoom = request.getParameter("ACRoom"); String NACRoom = request.getParameter("NOACRoom"); String Bed = request.getParameter("ACBed"); String NACBed = request.getParameter("NOACBed"); This is my table ROOM_NO AVAIL_BED1 AVAIL_BED2 I want to insert data into available bed column in selected room no. If one bed is full then insert data into second bed column else first . If new room no is selected then insert new record else insert data into

file corrupted when I post it to the servlet using GZIPOutputStream

只谈情不闲聊 提交于 2019-12-02 13:12:02
问题 I tried to modify @BalusC excellent tutorial here to send gziped compressed files. This is a working java class : import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import java.util

create servlet url-pattern with “/”

为君一笑 提交于 2019-12-02 06:12:48
问题 I've created servlet named MainContent. and I have such mapping <servlet> <display-name>MainContent</display-name> <servlet-name>MainContent</servlet-name> <servlet-class>ge.test.servlet.MainContent</servlet-class> </servlet> <servlet-mapping> <servlet-name>MainContent</servlet-name> <url-pattern>/main</url-pattern> </servlet-mapping> so, when I go to the link: //localhost:8080/MyAppl/main I enter into the servlets doGet() method. Then I create RequestDispatcher forward to the index.jsp.

file corrupted when I post it to the servlet using GZIPOutputStream

自作多情 提交于 2019-12-02 05:50:32
I tried to modify @BalusC excellent tutorial here to send gziped compressed files. This is a working java class : import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import java.util.zip.GZIPOutputStream; public final class NetworkService { // *** EDIT THOSE AS APROPRIATE private static

How to add Struts2 to a web application without web.xml?

有些话、适合烂在心里 提交于 2019-12-02 05:33:00
问题 Can someone help me with a minimal project setup with Spring Boot and Struts2? I have already create a Spring Boot application with a H2-database. I also added a h2Configuration class, so that I'm able to access the database with localhost:8080/console . But how can I add Struts2 to my Application without web.xml ? 回答1: Without web.xml you can only write a Struts2 filter using servlet 3.0 or higher @WebFilter("/*") public class Struts2Filter extends Struts2PrepareAndExecuteFilter { } The