users@jersey.java.net

Re: [Jersey] Unable to put/post payloads?

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 09 Jun 2010 07:11:19 +0200

On Jun 7, 2010, at 9:03 PM, danomano wrote:

>
> Hi folks, I'm assuming I must have some kind of config issue..but
> not sure..
>
> First off: I was getting this exception whenever I attempt a put/post:
>
> PART 1:
> Jun 7, 2010 9:36:16 AM
> com.sun.jersey.core.impl.provider.xml.SAXParserContextProvider
> getInstance
> WARNING: JAXP feature XMLConstants.FEATURE_SECURE_PROCESSING cannot
> be set
> on a SAXParserFactory. External general entity processing is
> disbaled but
> other potential securty related features will not be enabled.
> org.xml.sax.SAXNotRecognizedException: Feature
> 'http://javax.xml.XMLConstants/feature/secure-processing' is not
> recognized.
>
> To solve this I used jerserServlet initParam:
> <param-name>com.sun.jersey.config.feature.DisableXmlSecurity</param-
> name>
> <param-value>true</param-value>
>

You are using a rather old version of Xerces that was released in 2004.


>
> PART 2: now I no longer get the exception above, however..
> My jersery put/post methods never get invoked the method is defined
> to take
> a FOOBAR (which is jaxb object).
> I can issue http Gets to retrieve a FOOBAR (i.e. it knows how to
> serialize
> it into XML so it must see the jaxb binding correctly)
> I have my content-type set to application/xml
>
> my put method is implemented like this:
>
> @PUT
> @Path("/{id}")
> public void create(FOOBAR foobar, @PathParam("id") String id){
> System.out.println("hello");
> }
> the above never gets invoked, and a 400 http status is returned.
>
> if I redefine the above to:
> @PUT
> @Path("/{id}")
> public void create(@PathParam("id") String id){
> System.out.println("hello");
> }
>
> it will get invoked.
>
> any thoughts on what I may have wrong?
>

Can you share the code for FOOBAR?

I am wondering if the client is sending a different XML root element
to that declared by FOOBAR. Can you check by enabling logging:

https://jersey.dev.java.net/nonav/apidocs/latest/jersey/com/sun/jersey/api/container/filter/LoggingFilter.html

When you wrap in JAXBElement<FOOBAR> then JAXB will treat FOOBAR as
the XML type and the XML root element can be anything.

Paul.

> thanx
> Dan
>
> ps. I have the following libs: (which I think are relavent)
> jaxb-api-2.1
> jaxb-impl-2.1
> jersey-server-1.1.5.1
> xercesImpl-2.6.2
> stax-api-1.0.2
> --
> View this message in context: http://jersey.576304.n2.nabble.com/Unable-to-put-post-payloads-tp5150592p5150592.html
> Sent from the Jersey mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>