cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gabo Manuel <kman...@solegysystems.com>
Subject Re: [JAX-RS][PathParam] object field injection
Date Wed, 05 Nov 2008 08:24:29 GMT
Hi Sergey,

 > You don't need to put @PathParam-annotate inidividual fileds in a 
bean like SearchFilter, just having proprty setters
 > will do.

As soon as I remove the empty @PathParam, I get the premature end of 
file exception:

Caused by: org.xml.sax.SAXParseException: Premature end of file.
        at 
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
        at 
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174)
        at 
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388)
        at 
com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1411)
        at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1037)

 > I think @DefaultValue can now be applied to any JAXRS-annotated 
method parameter, be it @PathParam or @QueryParam or
 > @HeaderParam, can please give it a try ? I need to verify but I 
reckon putting @DefaultValue either on the the method
 > itself (applies to all parameters) or on the class resource (applies 
to all resource methods) should work too - but I
 > don't rememeber at the moment

Where/how should I put the @DefaultValue for @PathParam? Note that the 
method parameter is a java object. I annotated my method as 
@Path("/search/{whereCondition}/{sortString}/{startingRow}/{lastRow}") 
which forces me to access the page as is.

 > Yes, same should be possible for QueryParams, this CXF extension is 
supported for PathParam and QueryParam but can
 > easily be extended to support HeaderParams, etc

Could I have some sample on injecting via QueryParams? I have tried 
adding @QueryParam to all the setters of SearchFilter object while 
having the method annotated as follows:

@GET
@Path("/search")
@ProduceMime("application/xml")
public Accounts getList(
        @QueryParam("")
        SearchFilter sf
        ) {

Again, my thanks.

Gabo

Mime
View raw message