Hi
On 21/11/11 17:27, Manisha Mahawar wrote:
Hi All,
I just started using CXF and had couple of doubts. I have a service which
takes 5 parameters.
public Response getSchedule(
@QueryParam("index") int index,
@QueryParam("resultsize") int resultSize,
@QueryParam("startdatetime") long startTime,
@QueryParam("enddatetime") long endTime,
@QueryParam("duration") int duration) {...}
1) All the parameters are not required but few of them are. Is there a way
I can specify required or optional parameter using annotation in CXF?
That mostly affects the client side, but the only way for a client to
know that it is a required parameter is to provide a custom WADL doc,
though some additional annotation may be of help, may be it should be
added in jaxrs 2.0 actually
2) I am getting "XML Parsing Error: no element found
Location:
http://localhost:8080/xboxEpgService/v1/listings/channels.xml?index=0&resultSize=200&duration=120&
*startdatetime=*
Line Number 1, Column 1:" error when I am trying to execute the above URL.
it's only happens when I pass last parameter as blank.
I noticed below warning in the logs.
Nov 21, 2011 10:00:54 AM org.apache.cxf.jaxrs.impl.
WebApplicationExceptionMapper toResponse
WARNING: WebApplicationException has been caught : For input string: """
I tried specifying @Default annotation but still not luck.
Does anybody know what can I use to handle these kind scenarios, where
nothing is being passed after parameter?
In this case it is an empty value which is being passed but a type
'long' is specified. Long is better because it will be set to null if no
query parameter is provided or to 0 if it's an empty parameter (ex,
?startdatetime);
with long it should be just 0 I guess in all the cases, looks like a bug
to me
Sergey
Any help would be appreciating.
Manisha
--
Sergey Beryozkin
http://sberyozkin.blogspot.com
Talend Community Coders
http://coders.talend.com/