java - Enabling Cross Domain in Jersey - Facing runtime exception -



java - Enabling Cross Domain in Jersey - Facing runtime exception -

i next article create our bailiwick of jersey cors complaint. far have implemented containerresponsefilter add together access-control-allow-origin headers response. snippet:

responsebuilder resp = response.fromresponse(contresp.getresponse()); resp.header("access-control-allow-origin", "*") .header("access-control-allow-methods", "get, post, options"); string reqhead = req.getheadervalue("access-control-request-headers"); if(null != reqhead && !reqhead.equals("")){ resp.header("access-control-allow-headers", reqhead); } contresp.setresponse(resp.build());

and web.xml contents:

<servlet-name>jersey-serlvet</servlet-name> <servlet-class> com.sun.jersey.spi.container.servlet.servletcontainer </servlet-class> <init-param> <param-name>com.sun.jersey.spi.container.containerresponsefilters</param-name> <param-value>com.test.responsecorsfilter</param-value> </init-param>

when run error:

com.sun.jersey.spi.inject.errors$errormessagesexception com.sun.jersey.spi.inject.errors.processerrormessages(errors.java:170) com.sun.jersey.spi.inject.errors.postprocess(errors.java:136)

but if run same application these config:

<init-param> <param-name>com.sun.jersey.config.property.packages</param-name> <param-value>com.test.client</param-value> </init-param>

i not getting error. error occuring if seek utilize containerresponsefilter. can help me in resolving issue?

java rest jersey

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -