Research Log of Web Science Students

Computer Science is not simply programming

UrlRewriting Problem

leave a comment »

I need to add an extra custom parameter to my oauth callback url so that my controllers know which provider to use. etc

But this creates problems with

1. my controller because doing this…

String providerRequested = request.getParameter("provider");

to the url above returns:


when it should only return googledocs not the extra gibberish tailing it.

I wonder if I should use the addExtraParameter in the OAuthParameters class instead of specifying the callback url to be “”?

UPDATE 1: the abstract factory method is at fault. It’s not returning a concrete implementation first at

if ("googledocs".equals(providerRequested))

Obviously because googledocs is not equal to the url above. I thought it might work by doing this instead:

if ("googledocs".contains(providerRequested))

but apparently the input to method contains should be a type of charSequence.

UPDATE 2: Progress! I tried doing this but to no avail:

if (providerRequested.contains("googledocs"))

Except that I get an


Will work on using addExtraParameter to the oauthParameters.

UPDATE 3: I didn’t want to dive into figuring out addExtraParameter,
instead I tried to remove the “provider=googledocs” in the result.queryString() that the oauthParameters use.

RESULT: Didn’t work out.

UPDATE: Went back to my original problem by adding a “?” to the callback url which is

//old callback

//new callback

Result: Didn’t work out too, when I get the parameter provider it returns this:


UPDATE: I realized that the url above shouldn’t be ?? but be & instead.


What this means is that the queryString should be


Result: Ok for some reason the OAuthHelper does not parse the queryString despite my best efforts to give it the right queryString.


Written by Jose Asuncion

October 3, 2009 at 12:38 pm

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: