Jersey error on #DELETE: "Unsupported HTTP method: DELETE" - java

I do RESTful application in Jersey (deployed on WildFly 8.1.0.Final) but I have a problem with testing methods #DELETE. All other (GET, POST, PUT) work as expected. However, when calling #DELETE I receive the following error message
Cross-Origin Resource Sharing (CORS) Filter: Unsupported HTTP method: DELETE
I test RESTful interface via a plugin in Google Chrome: Advanced REST Client. How can I fix it?
Resource class: I deleted other methods for better clarity.
#Path(value = "destination")
#Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
#Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public class DestinationResource {
public DestinationResource() {}
#DELETE
#Path(value = "/{id}")
public Response deleteDestination(#PathParam("id") Long id) {
//Doing something
return Response.status(Response.Status.OK).build();
}
}
EDIT: I added CORS.filter but still nopt working. Here is my web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- This web.xml file is not required when using Servlet 3.0 container,
see implementation details http://jersey.java.net/nonav/documentation/latest/jax-rs.html#d4e194 -->
<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-name>Jersey Web Application</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey Web Application</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>resteasy.scan</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>resteasy.scan.providers</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>resteasy.scan.resources</param-name>
<param-value>false</param-value>
</context-param>
<filter>
<!-- The CORS filter with parameters -->
<filter-name>CORS</filter-name>
<filter-class>com.thetransactioncompany.cors.CORSFilter</filter-class>
<!-- Note: All parameters are options, if omitted the CORS
Filter will fall back to the respective default values.
-->
<init-param>
<param-name>cors.allowGenericHttpRequests</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>cors.allowOrigin</param-name>
<param-value>*</param-value>
</init-param>
<init-param>
<param-name>cors.allowSubdomains</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>cors.supportedMethods</param-name>
<param-value>GET, HEAD, POST, PUT, OPTIONS</param-value>
</init-param>
<init-param>
<param-name>cors.supportedHeaders</param-name>
<param-value>*</param-value>
</init-param>
<init-param>
<param-name>cors.exposedHeaders</param-name>
<param-value>X-Count-records</param-value>
</init-param>
<init-param>
<param-name>cors.supportsCredentials</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>cors.maxAge</param-name>
<param-value>3600</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CORS</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<init-param>
<param-name>cors.supportedMethods</param-name>
<param-value>GET, HEAD, POST, PUT, OPTIONS</param-value>
</init-param>
Do you see DELETE listed there? I don't.

Related

Angular 4 war file not running on JBOSS

I am new in angular and build a project with angular 4 as front end and JAVA Rest API as backend. I created a war file to deploy it on JBOSS but when I am trying to run the angular 4 war file on JBOSS but it gives me 404. It seems like some base-href issue in index.html. I tried with below base-href but nothing works:
<base href="/">
<base href="./">
<base href="/PROJECT_NAME/">
Please help me out in this.
Below is WEB.Xml for the same :
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>LeadAdminBackEnd</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Jersey RESTful Application</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>com.newgen.aproj2</param-value>
</init-param>
<init-param>
<param-name>jersey.config.server.provider.classnames</param-name>
<param-value>org.glassfish.jersey.media.multipart.MultiPartFeature</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>Jersey RESTful Application</servlet-name>
<url-pattern>/restAPI/*</url-pattern>
</servlet-mapping>
<filter>
<!-- The CORS filter with parameters -->
<filter-name>CORS</filter-name>
<filter-class>com.thetransactioncompany.cors.CORSFilter</filter-class>
<!-- Note: All parameters are options, if omitted the CORS
Filter will fall back to the respective default values.
-->
<init-param>
<param-name>cors.allowGenericHttpRequests</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>cors.allowOrigin</param-name>
<param-value>*</param-value>
</init-param>
<init-param>
<param-name>cors.allowSubdomains</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>cors.supportedMethods</param-name>
<param-value>GET, HEAD, POST, OPTIONS</param-value>
</init-param>
<init-param>
<param-name>cors.supportedHeaders</param-name>
<param-value>*</param-value>
</init-param>
<init-param>
<param-name>cors.exposedHeaders</param-name>
<param-value>X-Test-1, X-Test-2,X-Requested-With</param-value>
</init-param>
<init-param>
<param-name>cors.supportsCredentials</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>cors.maxAge</param-name>
<param-value>3600</param-value>
</init-param>
</filter>
<filter-mapping>
<!-- CORS Filter mapping -->
<filter-name>CORS</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>

Migrating to Jersey 2.x getting 404 errors while calling my api's

I am migrating from com.sun.jersey 1.x to org.glassfish.jersey 2.x,
my web.xml looks like:
<?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">
<!-- Bean Configuration -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:application-context.xml</param-value>
</context-param>
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>webservices</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
<servlet>
<servlet-name>jersey-servlet</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>com.jersey.series.spring.security.service</param-value>
</init-param>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>com.xyz.webservices</param-value>
</init-param>
<!-- Enable / Disable Jersey Tracing and Logging. -->
<init-param>
<param-name>jersey.config.server.tracing</param-name>
<param-value>${jersey.enable.trace}</param-value>
</init-param>
<init-param>
<param-name>jersey.disable.wadl</param-name>
<param-value>${jersey.disable.wadl}</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>jersey-servlet</servlet-name>
<url-pattern>/api/*</url-pattern>
</servlet-mapping>
<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>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
So the resources defined under com.xyz.webservices.resources, whenever are called like '/app/api/data' says 404 page not found. Am i doing something wrong here?
I got the code working by modifying my web.xml as:
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>com.jersey.series.spring.security.service,com.xyz.webservices</param-value>
</init-param>
<!-- Enable / Disable Jersey Tracing -->
<init-param>
<param-name>jersey.config.server.tracing</param-name>
<param-value>${jersey.enable.trace}</param-value>
</init-param>
<init-param>
<param-name>jersey.disable.wadl</param-name>
<param-value>${jersey.disable.wadl}</param-value>
</init-param>
<!-- Enabling Jackson Feature and Logging -->
<init-param>
<param-name>jersey.config.server.provider.classnames</param-name>
<param-value>org.glassfish.jersey.jackson.JacksonFeature,org.glassfish.jersey.filter.LoggingFilter,org.glassfish.jersey.server.filter.EncodingFilter,org.glassfish.jersey.message.DeflateEncoder,org.glassfish.jersey.message.GZipEncoder</param-value>
</init-param>

Jersey + GZIP encoding

First of all, I've seem a couple of examples that ilustrate how to use GZIP compression with Jersey.
Although, I saw none that attends the system requirement that I'm developing because I´m using Jersey 1.6 and the Jersey changes drastically from 1.9 to 2.0. Allied of that, all complete examples that I saw are in Jersey 2.0.
Searching for a complete example under 1.9 or less, I found that configuration that was to be places at web.xml file.
<init-param>
<param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>
<param-value>com.sun.jersey.api.container.filter.GZIPContentEncodingFilter</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.spi.container.ContainerResponseFilters</param-name>
<param-value>com.sun.jersey.api.container.filter.GZIPContentEncodingFilter</param-value>
</init-param>
I think that I have to do something more to allow the GZIP compression.
Note: I have also a welcome file configured.
EDIT: this is my complete web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<display-name>app</display-name>
<servlet>
<servlet-name>app-servlet</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>com.app.controllers</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>
<param-value>com.sun.jersey.api.container.filter.GZIPContentEncodingFilter</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.spi.container.ContainerResponseFilters</param-name>
<param-value>com.sun.jersey.api.container.filter.GZIPContentEncodingFilter</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>app-servlet</servlet-name>
<url-pattern>/service/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>hotel-application.html</welcome-file>
</welcome-file-list>
<!-- BEGIN Spring Security Config -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/login/*</url-pattern>
</servlet-mapping>
<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>
<!-- END Spring Security Config -->
How do you test your servlet? You have to have Accept-Encoding:gzip in the header. If you test your web services in a browser, the chances are the browser unzips everything and shows it to you. Try this: curl -H Accept-Encoding:gzip -i -u user:pass http://your/web/service

How to have a servlet for a specific resource but use wicket for the rest of the web application

I'm trying to add Atmosphere support to a Wicket-1.5.X web application. (Currently upgrading to 6 isn't an option.)
I currently have the wicket filter configured to run on top of the Atmospheres MeteorServlet. I've created an sharedResource for Atmosphere to be used in my application.
I'm noticing that however with that configuration even pages(like my static login page) that don't use the shared resource still seem activate it.
I think the solution is to move the wicket filter from On top of the MeteorServlet to next to it. so that /App/MyResource will fire meteor but everything else with just get wicket.
How can I do that?
In Case it Matters:
Tomcat 6.0.29
Firefox 16.0.x
IE 9
UPDATE:
Here is what My web.xml currently looks like:
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app 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"
version="2.4">
<display-name>CSC</display-name>
<!--
added for Spring Wicket Hibernate compatibility
From: http://wicketinaction.com/2009/06/wicketspringhibernate-configuration/
-->
<context-param>
<!-- tells Spring to look in the Class Path for applicationContext.xml -->
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<listener>
<!-- Starts Spring -->
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<!-- prevent hibernate LazyLoadingException -->
<filter>
<filter-name>openSessionInView</filter-name>
<filter-class>
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
</filter-class>
<init-param>
<param-name>SessionFactoryBeanName</param-name>
<param-value>sessionFactory</param-value>
</init-param>
<init-param>
<param-name>applicationFactoryClassName</param-name>
<param-value>org.apache.wicket.SpringWebApplicationFactory</param-value>
</init-param>
<init-param>
<param-name>applicationBean</param-name>
<param-value>wicketApplication</param-value>
</init-param>
<init-param>
<param-name>applicationClassName</param-name>
<param-value>
us.ak.state.revenue.cssd.Personnel.QuickStartApplication
</param-value>
</init-param>
<init-param>
<param-name>configuration</param-name>
<param-value>deployment</param-value>
</init-param>
<init-param>
<param-name>contextpath</param-name>
<param-value>CSC</param-value>
</init-param>
<init-param>
<param-name>fileEncoding</param-name>
<param-value>ISO-8859-1</param-value>
</init-param>
</filter>
<!--Atmosphere support, to remove the Ajax Updating Bug CSC-2 -->
<servlet>
<description>MeteorServlet</description>
<servlet-name>CSC</servlet-name>
<servlet-class>org.atmosphere.cpr.MeteorServlet</servlet-class>
<init-param>
<param-name>org.atmosphere.filter</param-name>
<param-value>org.apache.wicket.protocol.http.WicketFilter</param-value>
</init-param>
<!-- directory settings -->
<init-param>
<param-name>org.atmosphere.cpr.AtmosphereHandler.contextRoot</param-name>
<param-value>CSC</param-value>
</init-param>
<!-- Abilities -->
<init-param>
<param-name>org.atmosphere.useWebSocket</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>org.atmosphere.useNative</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>org.atmosphere.cpr.sessionSupport</param-name>
<param-value>true</param-value>
</init-param>
<!-- let Atmosphere handle keep alive,
make sure broadcast happens AFTER AJAX stuff -->
<init-param>
<param-name>
org.atmosphere.cpr.AtmosphereInterceptor
</param-name>
<param-value>
org.atmosphere.interceptor.AtmosphereResourceLifecycleInterceptor,
org.atmosphere.interceptor.BroadcastOnPostAtmosphereInterceptor
</param-value>
</init-param>
<!-- shouldn't this be defaultContentType? sets Content-Type header default -->
<init-param>
<param-name>org.atmosphere.cpr.defaultContextType</param-name>
<param-value>text/plain</param-value>
</init-param>
<init-param>
<param-name>filterMappingUrlPattern</param-name>
<param-value>/*</param-value>
</init-param>
<!-- minimize memory share broadcaster -->
<init-param>
<param-name>org.atmosphere.cpr.broadcaster.shareableThreadPool</param-name>
<param-value>true</param-value>
</init-param>
<!-- error recovery -->
<init-param>
<param-name>
org.atmosphere.cpr.recoverFromDestroyedBroadcaster
</param-name>
<param-value>true</param-value>
</init-param>
<!-- wicket filter settings -->
<init-param>
<param-name>applicationFactoryClassName</param-name>
<param-value>org.apache.wicket.spring.SpringWebApplicationFactory</param-value>
</init-param>
<init-param>
<param-name>applicationBean</param-name>
<param-value>wicketApplication</param-value>
</init-param>
<init-param>
<param-name>applicationClassName</param-name>
<param-value>us.ak.state.revenue.cssd.QuickStartApplication</param-value>
</init-param>
<init-param>
<param-name>configuration</param-name>
<param-value>deployment</param-value>
</init-param>
<init-param>
<param-name>contextpath</param-name>
<param-value>CSC</param-value>
</init-param>
<init-param>
<param-name>fileEncoding</param-name>
<param-value>ISO-8859-1</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CSC</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<filter-mapping>
<filter-name>openSessionInView</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<mime-mapping>
<extension>ico</extension>
<mime-type>image/x-icon</mime-type>
</mime-mapping>
</web-app>
P.S.: Maybe a fellow wicket Dev knows, does 1.5 still work as a filter or a servlet?
Dunno about this specific case, but typically it's just a matter of adding a definition and mapping to web.xml before the framework (i.e. Wicket) mapping:
<servlet>
<servlet-name>myservlet</servlet-name>
<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>myservlet</servlet-name>
<url-pattern>/mystuff</url-pattern>
</servlet-mapping>

Stripes Exception Handler error

I have an index.jsp file in "/" with content as follows:
<%#include file="/WEB-INF/jsp/common/taglibs.jsp" %>
<c:choose>
<c:when test='<%=session.getAttribute("consumer") != null%>'>
<jsp:forward page="/Ledger.action"/>
</c:when>
<c:otherwise>
<jsp:forward page="/Login.action"/>
</c:otherwise>
</c:choose>
In my web.xml file I have placed an entry like this:
<error-page>
<error-code>404</error-code>
<location>/index.jsp</location>
</error-page>
I have written a custom exception handler as follows:
public class MyExceptionHandler extends DefaultExceptionHandler {
public Resolution catchActionBeanNotFound(
ActionBeanNotFoundException exc,
HttpServletRequest request,
HttpServletResponse response
) {
return new ErrorResolution(HttpServletResponse.SC_NOT_FOUND);
}
}
When the users are not signed in, means 'session.getAttribute("consumer") == null' if we use an invalid url, it will be redirected to the 'Login.action' page, but after signing in, on using invalid urls I am getting a HTTP Status 404 error from tomcat instead of redirecting to 'Ledger.action'
In eclipse console, I am getting an error as follows:
SEVERE: Exception Processing ErrorPage[errorCode=404,
location=/index.jsp] org.apache.jasper.JasperException: A request made
it through to some part of Stripes without being wrapped in a
StripesRequestWrapper. The StripesFilter is responsible for wrapping
the request, so it is likely that either the StripesFilter is not
deployed, or that its mappings do not include the DispatcherServlet
and *.jsp. Stripes does not require that the Stripes wrapper is the
only request wrapper, or the outermost; only that it is present.
Following is my web.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" 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">
<context-param>
<param-name>
javax.servlet.jsp.jstl.fmt.localizationContext
</param-name>
<param-value>
StripesResources
</param-value>
</context-param>
<filter>
<filter-name>StripesFilter</filter-name>
<filter-class>
net.sourceforge.stripes.controller.StripesFilter
</filter-class>
<init-param>
<param-name>ActionResolver.Packages</param-name>
<param-value>org.firm.www.action</param-value>
</init-param>
<init-param>
<param-name>Extension.Packages</param-name>
<param-value>org.firm.www.ext</param-value>
</init-param>
</filter>
<servlet>
<servlet-name>DispatcherServlet</servlet-name>
<servlet-class>
net.sourceforge.stripes.controller.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>Kaptcha</servlet-name>
<servlet-class>com.google.code.kaptcha.servlet.KaptchaServlet</servlet-class>
<init-param>
<param-name>kaptcha.image.width</param-name>
<param-value>160</param-value>
</init-param>
<init-param>
<param-name>kaptcha.image.height</param-name>
<param-value>75</param-value>
</init-param>
<init-param>
<param-name>kaptcha.textproducer.font.names</param-name>
<param-value>Tahoma,Arial</param-value>
</init-param>
<init-param>
<param-name>kaptcha.textproducer.font.color</param-name>
<param-value>255,153,0</param-value>
</init-param>
<init-param>
<param-name>kaptcha.noise.impl</param-name>
<param-value>org.kwa.www.extras.NoNoise</param-value>
</init-param>
<init-param>
<param-name>kaptcha.border</param-name>
<param-value>no</param-value>
</init-param>
<init-param>
<param-name>kaptcha.background.clear.from</param-name>
<param-value>51,51,51</param-value>
</init-param>
<init-param>
<param-name>kaptcha.background.clear.to</param-name>
<param-value>51,51,51</param-value>
</init-param>
</servlet>
<filter-mapping>
<filter-name>StripesFilter</filter-name>
<servlet-name>DispatcherServlet</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
<servlet-mapping>
<servlet-name>DispatcherServlet</servlet-name>
<url-pattern>*.action</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Kaptcha</servlet-name>
<url-pattern>/kaptcha.jpg</url-pattern>
</servlet-mapping>
<display-name>OnlinePayment</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<error-page>
<error-code>404</error-code>
<location>/index.jsp</location>
</error-page>
</web-app>
I had to add the following in filter-mapping section of web.xml:
<dispatcher>ERROR</dispatcher>
Then the whole entry will look like:
<filter-mapping>
<filter-name>StripesFilter</filter-name>
<servlet-name>DispatcherServlet</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>ERROR</dispatcher>
</filter-mapping>
I have found the answer on this link

Categories