Hi,
yes, this is in fact a problem with message signing and the way Java
URLConnection works. I didn't yet find a decent solution to this, and
I should have probably mentioned in the wiki that using URLConnection
for anything other than GET does not work with Signpost.
Here's why:
When sending data using HttpURLConnection, the payload never becomes
part of the request until you actually send it over the wire using the
writer. That's because URLConnection is entirely modeled around data
streams. This is a problem, because for Signpost, there is no way to
actually look at the message payload and consider potential parameters
in there for inclusion into the signature, for the simple reason that
when you sign the message, there simply isn't yet a payload to
inspect.
I'm not sure whether there is a good solution for this, I couldn't yet
think of any so far. However, when doing advanced things like POSTing
data to a web service using signed requests, you really, REALLY want
to consider using a more elaborate HTTP messaging library anyway (I
would recommend using Apache HttpComponents). Signpost supports Apache
HttpComponents and Jetty HTTP for these occasions.
I mean, you can see how messy the code for sending a POST or PUT using
HttpURLConnection is, so you're better off using something decent
instead anyway.
But, I admit that this is very confusing (especially since it simply
yields a 401), so maybe I'll open a ticket for this, to either find a
good solution/workaround or simply update the docs that signing
URLConnection type requests carrying payload is simply not supported.
On Aug 3, 2:12 am, monkeyvu <
phamanhvu101...@gmail.com> wrote:
> Hi all,
>
> I'm using Signpost for Friendfeed Oauth. It looks like they dont
> support the PIN code so I just ignore it. Then I tried to send a
> request tohttp://
friendfeed-api.com/v2/feed/vuphamand all are good
> as below:
>
> Fetching request token from Friendfeed...
> Request token: 700274c45fd644e787c1495c12376c40
> Token secret: 8d7ae8ed510b48d88eed14879e3526bc
> Now visit:
https://friendfeed.com/account/oauth/authorize?oauth_token=700274c45f...