On 6/23/11 2:35 AM, Jitesh wrote:
>
> Pavel,
>
> Thanks for replying. Due to lack of time,I had to change server side
> implementation to get it directly from HttpServletRequest keeping
> everything same at client side.Although I will try what you have
> mentioned in your email later.
>
> Now I am facing another issue.
>
> The ClientResponse that I get on client side is "POST
> http://localhost:8080/altcso/service/request returned a response
> status of 200" -- which means processing went fine.
>
> But I need a specific output from service(in this case a number).
>
> After getting all request parameters,service does some processing and
> generates a number.I need to get this across to client. How can I do this?
>
you can put it into the response entity and check for it on client side:
ClientResponse cr = ...
cr.getEntity(String.class);
... // parse returned string and get your integer
or you can "ask" for Integer.class directly, but you'll need to
implement MessageBodyReader [1]
[1]
http://jsr311.java.net/nonav/javadoc/javax/ws/rs/ext/MessageBodyReader.html
>
> I am writing both client side and server side code for this -- in case
> you have a confusion.
>
> Thanks
>
> -Jitesh
>
> *From:*Pavel Bucek-2 [via Jersey] [mailto:[hidden email]
> </user/SendEmail.jtp?type=node&node=6506723&i=0>]
> *Sent:* Wednesday, June 22, 2011 5:28 PM
> *To:* Jitesh Sinha -X (jisinha - Siliconweb Inc. at Cisco)
> *Subject:* Re: How to post a file and other form fields by Jersey client
>
> Hello,
>
> are you sure it is on the wire? Can you add LoggingFilter on client side
> or somehow check incoming request (wireshark)?
>
> Client c = Client.create();
> c.add(new LoggingFilter());
> ...
>
> Pavel
>
> On 6/22/11 9:35 PM, Jitesh wrote:
>
>
> > Ok guyz I changed FormDataMultiPart to something like this
> >
> > @FormDataParam("sourceLanguage") String sourceLanguage,
> > @FormDataParam("uploadFile") InputStream file in method arguments and
> > sourceLanguage started coming up fine.
> > The InputStream is not null anymore but its size is zero.When I try
> to read
> > it,I do not get anything.Any ideas what is happening?
> >
> > --
> > View this message in context:
> http://jersey.576304.n2.nabble.com/How-to-post-a-file-and-other-form-fields-by-Jersey-client-tp6502947p6505772.html
> > Sent from the Jersey mailing list archive at Nabble.com.
> >
>
>
>
> ------------------------------------------------------------------------
>
> *If you reply to this email, your message will be added to the
> discussion below:*
>
> http://jersey.576304.n2.nabble.com/How-to-post-a-file-and-other-form-fields-by-Jersey-client-tp6502947p6506705.html
>
>
> To unsubscribe from How to post a file and other form fields by Jersey
> client, click here.
>
>
> ------------------------------------------------------------------------
> View this message in context: RE: How to post a file and other form
> fields by Jersey client
> <http://jersey.576304.n2.nabble.com/How-to-post-a-file-and-other-form-fields-by-Jersey-client-tp6502947p6506723.html>
> Sent from the Jersey mailing list archive
> <http://jersey.576304.n2.nabble.com/> at Nabble.com.