Hello Masber, In order to get accurate answers it would be helpful if you could provide details like:
- Platform details: OS, jdk/jre, apache-tomcat version... - "I went through documentation" which one? perhaps https://tomcat.apache.org/tomcat-9.0-doc/config/filter.html#CORS_Filter - "my web client still complains" I guess that you get some error response here; have you checked your logs? Hope it helps, Luis 2018-07-28 9:00 GMT+02:00 masber masber <mas...@hotmail.com>: > Dear Apache Tomcat community, > > > I am learning Tomcat and would like to create a crosfilter, I went through > the documentation and added the code suggested but my web client still > complains. > > > This is the content of my web.xml file: > > > <web-app> > > <display-name>Archetype Created Web Application</display-name> > > > <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>returnitRest</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> > > > <init-param> > > <param-name>javax.ws.rs.Application</param-name> > > <param-value>returnitRest.AppConfig</param-value> > > </init-param> > > > <load-on-startup>1</load-on-startup> > > </servlet> > > > <servlet-mapping> > > <servlet-name>jersey-servlet</servlet-name> > > <url-pattern>/rest/*</url-pattern> > > </servlet-mapping> > > > <filter> > > <filter-name>CorsFilter</filter-name> > > <filter-class>org.apache.catalina.filters.CorsFilter</filter-class> > > <init-param> > > <param-name>cors.allowed.origins</param-name> > > <param-value>*</param-value> > > </init-param> > > <init-param> > > <param-name>cors.allowed.methods</param-name> > > <param-value>GET,POST,HEAD,OPTIONS,PUT</param-value> > > </init-param> > > <init-param> > > <param-name>cors.allowed.headers</param-name> > > <param-value>Content-Type,X-Requested-With,accept,Origin, > Access-Control-Request-Method,Access-Control-Request-Headers</param-value> > > </init-param> > > <init-param> > > <param-name>cors.exposed.headers</param-name> > > <param-value>Access-Control-Allow-Origin,Access-Control- > Allow-Credentials</param-value> > > </init-param> > > <init-param> > > <param-name>cors.support.credentials</param-name> > > <param-value>true</param-value> > > </init-param> > > <init-param> > > <param-name>cors.preflight.maxage</param-name> > > <param-value>10</param-value> > > </init-param> > > </filter> > > <filter-mapping> > > <filter-name>CorsFilter</filter-name> > > <url-pattern>/*</url-pattern> > > </filter-mapping> > > </web-app> > > > I was wondering whether someone could help me to understand what I am > doing wrong? > > > thank you very much > > -- "Ever tried. Ever failed. No matter. Try Again. Fail again. Fail better." - Samuel Beckett