Since portalcontext doesn't work in jsr portlet, is there any way to get current site object or name in jsr 168/286 portlets
Since it seems that you're wanting to do multiple things with the Portal API in your JSR portlets, perhaps you can do something like this:
https://knowledge.opentext.com/knowledge/llisapi.dll?func=ll&objId=17539977&objAction=ArticleView
John
Well, I have tried the approach, it seems to be setting the Httpservletrequest attribute in ActionClass's execute method. But when I am calling the renderRequest.getAttribute method in jsr's doView method, it is coming as null. I checked this by printing the values to std out in execute method for each of my view request the execute method is printing. Is there anything that needs to be configure or checked?
you can get site name in JSR 168/286 portlets in two ways in Vignette Portal.
1. As a render request property. Vignette JSR portlet container sends the following properties on the request.
you can retrive the site name using the following code snippet in your render ot doView() method.
String siteDnsName = renderRequest..getProperty("com.vignette.portal.site.dns");
2. The RenderRequest object can be type casted to VgnRenderRequest which is Vignette JSR container implementation of RenderRequest interface. Similarly the ActionRequest can be typecasted to VgnActionRequest also and get the site name. This classes are in the Vignette\Portal\lib\shared\vgn-jsr-container-shared.jar.
import com.vignette.portal.portlet.jsrcontainer.VgnRenderRequest;
VgnRenderRequest vgnRenderRequest = (VgnRenderRequest)renderRequest; String siteDNSName = vgnRenderRequest.getSiteDNSName();
Both the above two ways are Vignette portal specific and it can vary with othe rportals and is not a portable solution. The JSR 168/286 specification does not specify anything about the portal environment like sites etc. It only specifies about user attributes only.