web.xml

Spring injection in Filter implementation mapped in web.xml

一曲冷凌霜 提交于 2020-07-16 09:21:21
问题 web.xml: <filter> <filter-name>myFilter</filter-name> <filter-class>com.mypackage.MyFilter</filter-class> </filter> <filter-mapping> <filter-name>myFilter</filter-name> <url-pattern>/myFilterPattern/*</url-pattern> </filter-mapping> MyFilter: public class MyFilter implements Filter { @Autowired InjectedBean someInjectedBean; However, when intercepting /myFilterPattern/* requests, someInjectedBean in MyFilter.doFilter(...) is still null, meaning it has not been injected. The same bean (

adding httponly and secure flag for set cookie in java web application

时光怂恿深爱的人放手 提交于 2020-06-28 14:40:27
问题 I want to add the httponly and secure flags for Cookies. To implement it, I am using Filters which are configured in web.xml . The code for adding flags is as below: package com.crisil.dbconn; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.Cookie; import javax.servlet.http

adding httponly and secure flag for set cookie in java web application

百般思念 提交于 2020-06-28 14:33:16
问题 I want to add the httponly and secure flags for Cookies. To implement it, I am using Filters which are configured in web.xml . The code for adding flags is as below: package com.crisil.dbconn; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.Cookie; import javax.servlet.http

web.xml的各个版本的约束模版

血红的双手。 提交于 2020-04-28 12:17:04
web.xml各个版本模板 J2EE1.3 Servlet2.3 JSP1.2 <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> </web-app> J2EE1.4 Servlet2.4 JSP2.0 <?xml version="1.0" encoding="UTF-8"?> <web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> </web-app> J2EE5 Servlet2.5 JSP2.1 <?xml version="1.0" encoding="UTF-8"?

web项目中web.xml的作用

六眼飞鱼酱① 提交于 2020-04-07 10:36:27
每个javaEE工程中都有web.xml文件,那么它的作用是什么呢?它是每个web.xml工程都必须的吗? 一个web中可以没有web.xml文件,也就是说,web.xml文件并不是web工程必须的。 web.xml文件是用来初始化配置信息:比如Welcome页面、servlet、servlet-mapping、filter、listener、启动加载级别等。 当web工程没用到这些时,你可以不用web.xml文件来配置你的Application。 每个xml文件都有定义它书写规则的Schema文件,也就是说javaEE的定义web.xml所对应的xml Schema文件中定义了多少种标签元素,web.xml中就可以出现它所定义的标签元素,也就具备哪些特定的功能。web.xml的模式文件是由Sun 公司定义的,每个web.xml文件的根元素为<web-app>中,必须标明这个web.xml使用的是哪个模式文件。如: <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http:/

Enabling/disabling a web.xml filter using a Spring profile

落爺英雄遲暮 提交于 2020-04-05 05:13:23
问题 I have a Spring application that can use two different persistence API: Spring Data JPA Spring Data Neo4j When using Spring Data JPA, I need to declare the "OpenEntityManagerInViewFilter" in "web.xml" to do lazy loading: <filter> <filter-name>OpenEntityManagerInViewFilter</filter-name> <filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class> </filter> <filter-mapping> <filter-name>OpenEntityManagerInViewFilter</filter-name> <url-pattern>/*</url-pattern> <

Handling multiple basepath in swagger

蓝咒 提交于 2020-02-21 10:16:06
问题 I am using swagger-ui to provide nice documentation for REST APIs to our clients. Internally we have two different environments jenkin builds the project to. E.g. swagger.json is accessible on both environment as: http://www.myhost.com/xyz/rest/swagger.json https://www.myhost2.com/rest/swagger.json Documentation is available as: http://www.myhost.com/xyz/dist/index.html https://www.myhost2.com/dist/index.html swagger api basepath in web.xml is: <init-param> <param-name>swagger.api.basepath<

Handling multiple basepath in swagger

半腔热情 提交于 2020-02-21 10:16:06
问题 I am using swagger-ui to provide nice documentation for REST APIs to our clients. Internally we have two different environments jenkin builds the project to. E.g. swagger.json is accessible on both environment as: http://www.myhost.com/xyz/rest/swagger.json https://www.myhost2.com/rest/swagger.json Documentation is available as: http://www.myhost.com/xyz/dist/index.html https://www.myhost2.com/dist/index.html swagger api basepath in web.xml is: <init-param> <param-name>swagger.api.basepath<

XML must be well-formed issued for web.xml file of a JSP/Servlet project

扶醉桌前 提交于 2020-02-07 03:58:46
问题 Getting the error below from Eclipse. What does it mean "must be well-formed" ? Is there a mistake in the xml? The markup in the document following the root element must be well-formed web.xml <?xml version="1.0" encoding="UTF-8"?> <display-name>...</display-name> <servlet> <servlet-name>action</servlet-name> <servlet-class>...</servlet-class> <init-param> <param-name>config</param-name> <param-value>/WEB-INF/struts-config.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> <

“No operations defined in spec” Error while using RestEasy FrameWork with Swagger

流过昼夜 提交于 2020-02-01 08:54:12
问题 I have implemented REST apis using RESTEASY framework I am trying to implement swagger api documentation through web.xml i am able to get index.html but error is thrown that can't read from file. am I making mistake in making URL? my web.xml is as follows: <servlet> <servlet-name>swagger-servlet</servlet-name> <servlet-class>com.wordnik.swagger.jersey.config.JerseyJaxrsConfig</servlet-class> <init-param> <param-name>api.version</param-name> <param-value>1.1.0</param-value> </init-param> <init