Re: Retrieving HTTP Servlet Info

David Dyer <[email protected]> Thu, 03 May 2012 08:14:52 -0400
Newsgroups gmane.comp.jakarta.jetspeed.user
Message-ID <[email protected]>
If your portlet can access the PortletRequest, like you can if you're 
using JSF, you can get to the HttpServletRequest through the request 
context.

FacesContext fc =  FacesContext.getCurrentInstance(); // if you're using JSF
ExternalContext ec =  fc.getExternalContext(); // if you're using JSF

PortletRequest pr = (PortletRequest) ec.getRequest();
RequestContext context = 
(RequestContext)pr.getAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE); 

HttpServletRequest hsr = portletRequestContext.getRequest();

I've used this in the past where I needed to store values in the 
Servlet's session to make them accessible to other portlets, for example 
maintaining a shopping cart state between an unautheticated guest user 
and their login.

David Dyer
Senior Integration Specialist
Artifact Software Inc
email: [email protected]
skype: ddyer1
phone: 866-970-2435, ext 103.


On 27/04/2012 2:42 AM, Ron McNulty wrote:
> Hi All
>
> I have a legacy application that runs on IBM Websphere Portal that I need to now run on Jetspeed. It uses the Apache Portlet Bridge, plus an IBM specific class to get the ServletContext, HTTPRequest and HTTPResponse from the portlet related structures. I need to replace this class with a Jetspeed version.
>
> Yes, I know JSR286 prohibits this, but I need to do the minimum work to get this running (We develop on Jetspeed and deploy to IBM for production).
>
> I seem to remember that the HTTP parameters may be available from a properties structure, but can't find the reference.
>
> Can anyone help me out?
>
> Regards
>
> Ron
>
> Wellington, NZ
>
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2012.0.1913 / Virus Database: 2411/4965 - Release Date: 04/28/12
>