Hello Adam,

I notice that the ChallengeResponse object is instantiated with a login
equals to "Authorization:", which is not permitted since a login cannot
contain the ":" character (see http://tools.ietf.org/html/rfc2617#section-2
).

ChallengeResponse cr = new ChallengeResponse(ChallengeScheme.HTTP_BASIC,
"<login>", "<password>");

pubResource.setChallengeResponse(cr);


Best regards,

Thierry Boileau



> I'm trying to set an authorisation value in the HTTP header for my requests
> to a web service.
>
>
> From reading most of Google and a large number of messages in the mailing
> list and spending a few days looking, this is as far as I can get.
>
>
>
> ClientResource pubResource = new ClientResource("https://api.y.com/member
> ");
>
> ChallengeResponse cr = new ChallengeResponse(ChallengeScheme.HTTP_BASIC,
> "Authorization:", "gsspv");
>
> pubResource.setChallengeResponse(cr);
>
> try {
>
>         pubResource.get().write(System.out);
>
> } catch (ResourceException e) {
>
>      // TODO Auto-generated catch block
>
>      e.printStackTrace();
>
> } catch (IOException e) {
>
>      // TODO Auto-generated catch block
>
>      e.printStackTrace();
>
> }
>
>
>
> My credentials are correct, however I'm getting unauthorised access 401
> back from the server (The Server is not running Restlet, not sure if this is
> the problem).
>
>
> Can someone please point out what I'm missing?
>
>
> Thanks for any help, massively massively appreciated.
>
>
> Adam
>
>
> P.S. This is a continuation from a msg posted on Sep 28, 2009 12:49:01am
> with title "How to set Http header 
> authorization<http://markmail.org/message/boi2ae3iptpb4mvj>",
> Jerome kindly posted a link which lead me to the above code sample.
>

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2730104

Reply via email to