hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thom Nichols <tmnich...@gmail.com>
Subject Re: AuthScheme impl for OAuth
Date Mon, 13 Sep 2010 13:03:23 GMT
A follow-up question --

I'm not sure how to reconstruct the full request URI given the
HttpURIRequest and HttpContext.  It appears the URI from the request itself
always contains the path portion of the original request URI.  I can get the
host & port from the ExecutionContext.HTTP_TARGET_HOST attribute in the
HttpContext.  But how do I determine the URI scheme?

I'm trying to integrate Signpost OAuth via an HttpRequestInterceptor in lieu
of the same information in an AuthScheme callback.  But given that both the
HttpRequest I'm given and the one that's contained in the HttpContext
ExecutionContext.HTTP_REQUEST attribute both appear to contain the mutable
HttpRequest copy rather than the original immutable one, I'm not sure how to
get or reliably reconstruct the original request URI.

Thanks.
-Tom


On Thu, Sep 9, 2010 at 5:25 PM, Oleg Kalnichevski <olegk@apache.org> wrote:

> On Thu, 2010-09-09 at 17:20 -0400, Thom Nichols wrote:
> > I understand how the HTTP request is represented on the wire, but
> > HttpRequest.getURI() will still hold the full URI (except I'm guessing in
> > the situation of redirects and auths where > 1 request is made.)  The
> > original request.getURI() returned the full URI:
> > http://twitter.com/statuses/update.xml
> >
> > Looking at the headers, I can get the Host, but not scheme:
> >    Accept : application/xml, text/xml, application/xhtml+xml
> >      Content-Length : 91
> >      Content-Type : application/x-www-form-urlencoded; charset=MacRoman
> >      *Host : twitter.com:80*
> >      Connection : Keep-Alive
> >      Cookie :....
> >      Cookie2 : ....
> >
> > So I can _mostly_ reconstruct the request URI.  But I don't think I can
> > reliably get the scheme.
> >
> >
>
>
> Tom,
>
> The fact that HttpContext is not passed to the AuthScheme is one of the
> biggest API blunders in 4.0. If you can upgrade to 4.1-alpha, make your
> custom auth scheme implement ContextAwareAuthScheme instead
>
>
> http://hc.apache.org/httpcomponents-client/httpclient/apidocs/org/apache/http/auth/ContextAwareAuthScheme.html
>
> Oleg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message