[Building Sakai] How to Send an Http Parameter to a tool

Steve Swinsburg steve.swinsburg at gmail.com
Mon Mar 1 14:37:28 PST 2010


Hi,

You will need to URL encode the parameters you want to send and then add them to a special parameter called toolstate-xxx where xxx is the placementId of that tool in the site. This might be difficult from the external app so you might need a few web services to get you the info you need (the placementId, see below.)

The URL will look like:

https://sakai.somewhere.edu.au/portal/site/~263c90ed-185e-4b44-0053-0bccd31b319e/page/866771ca-c808-4d4a-8ae4-a9ca3159b7fe?toolstate-8f598ad8-bba3-47f9-ba5f-53c33a03084a=%3Fwicket%3AbookmarkablePage%3D%3Aorg.sakaiproject.profile2.tool.pages.ViewProfile%26id%3D4e614997-da48-4476-00e8-d322247d94e2


That will allow you to pass any URL params you want in that one URL param. I believe the rest are ignored by the RequestFilter so your tool will not receive them.

If you decode the above URL, you get:

https://sakai.somewhere.edu.au/portal/site/~263c90ed-185e-4b44-0053-0bccd31b319e/page/866771ca-c808-4d4a-8ae4-a9ca3159b7fe?toolstate-8f598ad8-bba3-47f9-ba5f-53c33a03084a=?wicket:bookmarkablePage=:org.sakaiproject.profile2.tool.pages.ViewProfile&id=4e614997-da48-4476-00e8-d322247d94e2

The URL is pretty long so I created a few simple Entity Providers that do the resolution of a shorter URL into this URL:
https://sakai.somewhere.edu.au/direct/my/profile/userId

which does the same thing as above.

This might come in handy when you are testing the url encoding/decoding:
http://meyerweb.com/eric/tools/dencoder/

If you are passing sensitive info, make sure there is some authorisation checking.

Now, to get the placement Id of the first occurrent of a tool in a site:
-------------------------
ToolConfiguration toolConfig = getFirstInstanceOfTool(siteId, "some.tool.id");
if(toolConfig == null) {
	//tool not in the site, do something
}

//then, get the tool info:
String pageId = toolConfig.getPageId();
String placementId = toolConfig.getId();
-------------------------

You could wrap that in a web service easily enough.


cheers,
Steve




On 02/03/2010, at 6:50 AM, Artur k Vieira wrote:

> 
> Hello Everyone. I'm using an exterior java app that get some information
> about a user, and try to pass it to my sakai app. My app generates the
> following url with the assistence of Sakai Web Services:
> http://192.168.98.74/portal/site/siteid/page/pageid/?sakai.session=sakaiusersessionid.
> This is the correct url that  can send a user logged in directely to my
> tool's inicial page. I'm trying to pass a parameter via get trough this url
> but I had no success, and neither via URLconnection i can pass that
> parameter. I would like to know if there is some way that i can pass a
> parameter to my tool via get, if not, via post, and if thats also not
> possible, what other solution is possible?
> 
> Thanks in advance
> -- 
> View this message in context: http://old.nabble.com/How-to-Send-an-Http-Parameter-to-a-tool-tp27748224p27748224.html
> Sent from the Sakai - Development mailing list archive at Nabble.com.
> 
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
> 
> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of "unsubscribe"

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20100302/14d989a4/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3689 bytes
Desc: not available
Url : http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20100302/14d989a4/attachment.bin 


More information about the sakai-dev mailing list