web.xml

tomcat8 - custom error page for 400

拜拜、爱过 提交于 2021-02-19 04:22:05
问题 In Tomcat (v8.5.24) an URL with a query parameter containing an unencode curly brace ("{") produces a 400 error. You can configure Tomcat to allow it with "relaxedQueryChars". But this is not what I want. I tried to write a custom error page and add it to web.xml <error-page> <error-code>400</error-code> <location>/error/error400</location> </error-page> But this does not work as Tomcat is really killing the request and does not process the error pages (org.apache.coyote.http11

How execute Listener class every time i receive requests on my servlet

泪湿孤枕 提交于 2021-02-16 13:47:13
问题 When receiving requests on my servlet, i would like execute one listener class which is related with, and which contains some instructions. So i implement on myListener the interface ServletContextListener, like this: public class MyContextListener implements ServletContextListener { @Override public void contextDestroyed(ServletContextEvent arg0) { // TODO Auto-generated method stub } @Override public void contextInitialized(ServletContextEvent arg0) { System.out.println("Context Created");

Set servlet as default home page in web.xml [duplicate]

痴心易碎 提交于 2021-02-07 18:20:05
问题 This question already has answers here : Change default homepage in root path to servlet with doGet (2 answers) Closed 5 years ago . I've a servlet registered in web.xml as below. <servlet> <servlet-name>Manager</servlet-name> <servlet-class>Manager</servlet-class> </servlet> <servlet-mapping> <servlet-name>Manager</servlet-name> <url-pattern>/RequestManager</url-pattern> </servlet-mapping> Basically I want to call this servlet as my default home page when I open http://localhost:8080/appname

Set servlet as default home page in web.xml [duplicate]

£可爱£侵袭症+ 提交于 2021-02-07 18:19:48
问题 This question already has answers here : Change default homepage in root path to servlet with doGet (2 answers) Closed 5 years ago . I've a servlet registered in web.xml as below. <servlet> <servlet-name>Manager</servlet-name> <servlet-class>Manager</servlet-class> </servlet> <servlet-mapping> <servlet-name>Manager</servlet-name> <url-pattern>/RequestManager</url-pattern> </servlet-mapping> Basically I want to call this servlet as my default home page when I open http://localhost:8080/appname

Web.xml Security Constraints not working

我的梦境 提交于 2021-01-29 10:37:47
问题 Trying to get the security aspect of my web app up and going. I've created a dynamic web application within eclipse and am trying to use a form based authentication setup. <?xml version="1.0" encoding="UTF-8"?> <web-app id="WebApp_ID" version="3.0" 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"> <display-name>Application</display-name>

How can I configure JPA for a postgres database schema?

只愿长相守 提交于 2021-01-29 06:34:18
问题 I have an existing postgres database with the database "testdb" and the database schema testdbschema". If I use the default persistence.xml configuration of RESOURCE_LOCAL the following property is working: <property name="javax.persistence.jdbc.url" value="jdbc:postgresql://server:port/testdb?currentSchema=testdbschema" /> I want to configure my database connection within my web.xml as a data-source. Everything is working well, except the configuration of the database schema. Here is my web

what happens when I configure a servlet before a filter in tomcat's web.xml?

有些话、适合烂在心里 提交于 2021-01-28 11:57:18
问题 In tomcat for a certain url, I want to skip all the filters and execute a servlet and I thought placing the servlet before the filter will to as I expected but still the filters behind the servlet mappings are executing. Am I doing anything wrong? For instance, this is my web.xml <servlet> <servlet-name>APIRedirection</servlet-name> <servlet-class>com.test.APIRedirection</servlet-class> </servlet> <servlet-mapping> <servlet-name>APIRedirection</servlet-name> <url-pattern>/abc/*</url-pattern>

Servlet 3.1 - Security Constraints - Without web.xml

喜你入骨 提交于 2021-01-27 06:28:14
问题 The Java Servlet 3.0 and 3.1 specifications allow developers to perform many of the common configuration based tasks in Java code rather than via the traditional mechanism of providing a web.xml file. I have all of this working for my application, but upon looking to tackle application security, I could not find any reference to how or if it is possible to also configuration application security constraints via code. Basically, I am looking for a programmatic way to do the following:

Servlet配置文件 —— web.XML配置

一世执手 提交于 2021-01-20 01:52:48
<?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://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd "> <!-- 配置Servlet的基本信息 --> <!-- 配置Servlet的名称(名称可以任意写,一般情况下和类的名称是相同的) --> <!-- 配置Servlet类的包名+类名的全路径 Class.forName("包名+类名"); --> <servlet> <servlet-name>ServletDemo1</servlet-name> <servlet-class>cn.itcast.servlet.ServletDemo1</servlet-class> <!-- 初始化参数 --> <init-param> <param-name>username</param-name> <param-value>root</param-value

loadOnStartup SEVERE: Servlet [dispatcher] in web application [/Producer] threw load() exception java.lang.NoSuchMethodError

元气小坏坏 提交于 2020-08-10 05:05:10
问题 I have a problem with setting up spring context using Eclipse + tomcat 8. I have checked several "Hello world" spring manuals and do not understand what is going wrong. <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema