users@jersey.java.net

[Jersey] Re: MessageBodyWriter/Mimetype exception & a general question

From: Paul Sandoz <Paul.Sandoz_at_oracle.com>
Date: Thu, 30 Dec 2010 12:57:43 +0100

On Dec 17, 2010, at 8:34 PM, tmp wrote:

>
> thanks for your reply!
>
> but I have still some issues. here is the code:
> http://pastebin.com/XXayEPui
>
> 1) When the server creates a new request to the given url, I want to
> set all
> headers and queryparameters. Did I do this correctly?
>

No, WebResource is immutable when making requests.

Notice that:

1) WebResource.queryParams returns a new WebResource; and

2) a call to something like WebResource.header returns a builder
reference and you need to use that reference from then on to
      add headers.

      WebResource.Builder b = webResource.getRequestBuilder();

It is the WebResource.Builder instance that is mutable and contains
the state of the build request.

Paul.


> 2) When I want to receive data from the url "www.imdb.com", the
> response
> from imdb is "your browser or proxy server isn't identifying itself
> and is
> blocked because we don't trust it to behave. If your browser/proxy/
> agent
> does not send a HTTP User-Agent header, this server will reject the
> request."
> I already added a proxy-agent to the webresource header and I also
> tried to
> set the user-agent header, but it doesn't work. Do you have any ideas?
>
> Thanks again!
> --
> View this message in context: http://jersey.576304.n2.nabble.com/MessageBodyWriter-Mimetype-exception-a-general-question-tp5840878p5845713.html
> Sent from the Jersey mailing list archive at Nabble.com.