[Building Sakai] Portal url's from inside "direct" servlet

Maurer, Christopher Wayne chmaurer at iupui.edu
Tue Jul 19 09:14:09 PDT 2011


I saw some code in the class I was already in (SiteEntityProvider.java) that was probably also put in place to work around the issue:

String portalBase = (String) ThreadLocalManager.get("sakai:request.portal.path");
if (portalBase == null || "".equals(portalBase) || "/sakai-entitybroker-direct".equals(portalBase)) {
     // this has to be here because the tc will expect it when the portal urls are generated and fail if it is missing -AZ
     ThreadLocalManager.set("sakai:request.portal.path", "/portal");
}

Trying to remember back, but I think the stuff that looks in threadlocal was put in place in case you wanted to run multiple portals.  So, for example, if your configured default was /portal, but you also wanted to have people run through /osp-portal or /xsl-portal, it would still know how folks entered and continue to allow them to run in that portal rather than bumping them back out to the configured one.  That make sense?  I'm not sure if anyone does that anymore.  We did it for a while here at IU several years ago.

Chris

From: Steve Swinsburg <steve.swinsburg at gmail.com<mailto:steve.swinsburg at gmail.com>>
Date: Tue, 19 Jul 2011 10:19:47 +1000
To: Chris Maurer <chmaurer at iupui.edu<mailto:chmaurer at iupui.edu>>
Cc: Developers Sakai-Dev <sakai-dev at collab.sakaiproject.org<mailto:sakai-dev at collab.sakaiproject.org>>
Subject: Re: [Building Sakai] Portal url's from inside "direct" servlet

Hi Chris,

This is reported as https://jira.sakaiproject.org/browse/KNL-758 where getPortalUrl gets its value from ThreadLocal preferentially. This is set by the RequestFilter where it sets the current 'portal' path as whatever context you are in, which is incorrect outside of the actual portal. I fixed this so it always gets the value from portalPath in sakai.properties. Simple change to the kernel if you want to pull it back.

cheers,
Steve




On 19/07/2011, at 6:23 AM, Maurer, Christopher Wayne wrote:

I'm working on a provider that will give me consumable HTML from a REST url.  In that html, I have links back to sites.  My problem is that calling a site.getUrl() from inside my provider is returning urls like this:
http://localhost:8080/sakai-entitybroker-direct/site/9ef15098-8975-4301-8b2a-6e97f17ada15

BasicConfigurationService.getPortalUrl() is coming back with "sakai-entitybroker-direct" as my current portal path.  I suppose that it's kind of right, but is there a way to get the normal portal path without building it by hand?  It's obviously trivial to build it by hand, but I hate building things by hand when there are methods to get at them.

Chris
_______________________________________________
sakai-dev mailing list
sakai-dev at collab.sakaiproject.org<mailto: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<mailto: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/20110719/8cf93375/attachment.html 


More information about the sakai-dev mailing list