users@jersey.java.net

Re: [Jersey] 303: Browser redirection problem: solved

From: Monika Solanki <ms491_at_leicester.ac.uk>
Date: Wed, 02 Jun 2010 13:54:48 +0100

Everything was fine, except that I was using a relative URI
(www.yahoo.com ) instead of (http:\\www.yahoo.com) .

Monika


Monika Solanki wrote:
> Here is the server log snippet in response to the redirect to www.yahoo.com:
>
> 02-Jun-2010 10:49:21 org.apache.catalina.core.ApplicationContext log
> INFO: org.apache.webapp.balancer.BalancerFilter: init(): ruleChain:
> [org.apache.webapp.balancer.RuleChain:
> [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string:
> News / Redirect URL: http://www.cnn.com],
> [org.apache.webapp.balancer.rules.RequestParameterRule: Target param
> name: paramName / Target param value: paramValue / Redirect URL:
> http://www.yahoo.com],
> [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL:
> http://jakarta.apache.org]]
>
> The method for the service is below:
>
> @GET
> @Produces(MediaType.TEXT_HTML)
> public Response displayOtherURI() {
>
> URI seeOther=null;
> try {
> seeOther= new URI("www.yahoo.com");
>
> } catch (URISyntaxException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> return Response.seeOther(seeOther).build();
> }
>
> On 02/06/10 10:52, Monika Solanki wrote:
>
>> My REST service is supposed to redirect to another URI but I seem to have a problem with this.
>>
>> URI seeOtherUri = ...
>> return Response.satus(303).location(seeOtherUri).build():
>>
>> When I check the response status at the client end, it turns out to be a
>> 404. Apparently the client (browser) is attaching the seeOtherURI to the base URI
>> of the service. How do I fix this at the client end?
>>
>> Monika
>>
>>
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>>
>>
>
>

-- 
Dr Monika Solanki
F27 Department of Computer Science
University of Leicester
Leicester LE1 7RH
United Kingdom
WebID: http://www.cs.le.ac.uk/people/ms491/foaf.rdf#monika
Google Coordinates: 52.653791,-1.158414
Tel: +44 116 252 3828
Web: http://www.cs.le.ac.uk/people/ms491/