I propose to extend the Java oauth-core library to better support
accessing protected resources, as follows.  Please let me know if this
is a bad idea, or there's a better way.

In brief, I propose to add a method to OAuthClient:

/** Send a request and return the response. */
public OAuthResponseMessage access (OAuthMessage request,
ParameterStyle style) throws IOException;

Unlike the existing 'invoke' method, it won't try to decide whether
the response indicates success; it will merely return the response.  A
typical caller would evaluate the response, something like this:

OAuthClient client = ...;
OAuthAccessor accessor = ...;
OAuthMessage request = new ...;
request.addRequiredParameters (accessor);
OAuthResponseMessage response = client.access (request,
ParameterStyle.AUTHORIZATION_HEADER);
switch(response.getHttpResponse().getStatusCode()) {
  case 200: ...
  case 400: ...

I'm a little worried about feature creep: this is a step toward a
general purpose HTTP client library.  But it's a tolerably small step,
I hope.  I don't want to try to reproduce all the features of the
Apache HTTP client libraries.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"OAuth" group.
To post to this group, send email to oauth@googlegroups.com
To unsubscribe from this group, send email to oauth+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/oauth?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to