Satish Sekharan wrote:
Hi Ate,

As you know, I was trying to get the JPetstore demo to work properly in uPortal 2.5. I have made progress and I have got the JPetstore application working fully. But I feel that you might have a better way to get this working than my solution.

Let me explain, the Struts Bridge uses render parameter _spage to communicate request parameters to Struts.

_spage=/shop/viewCategory.shtml?categoryId=CATS

The embedded portlet url with the _spage request looks like this:
http://locahost:8080/uPortal/tag.37e430d1204c663f.render.userLayoutRootNode.target.101.uP?uP_portlet_action=true&_spage=%2Fshop%2FviewCategory.shtml%3FcategoryId%3DCATS&_sorig=%2Fshop%2Findex.shtml#101

If I understand this correctly, The StrutsPortlet invokes the StrutsServet using a RequestDispatcher object obtained using this path=/shop/viewCategory.shtml?categoryId=CATS
Correct


The ServletContext, HttpServletRequest and HttpServletResponse objects are retrieved from ServletContextProvider implemented for uPortal. Then the RequestDispatcher.include() method is called with this HttpServletRequest and HttpServletResponse objects as arguments.
So far so good.

Now JPetstore app doesn't work and the categoryId parameter present in the query string is not merged with the request parameters when I use this implementation of the getHttpServletRequest method in ServletContextProvider implemented for uPortal.
That's no good.
Is that the only problem: not merging the query string request parameter?
Note: this is a Servlet API 2.3 requirement for a "real" ServletContext.
Maybe you should dive into the ServletContext implementation.

Also, try to find out/debug *why* this isn't working. As I don't use uPortal
I really can't help you out with that.
On Jetspeed or for example Gridsphere, Liferay (three different portal 
containers)
this hasn't been a problem.

Although you got it working by unwrapping all down to the 
ApplicationHttpRequest,
it really shouldn't be nessecary like that. But then, maybe with the uPortal
container implementation there isn't another way...

Sorry I can't give a better answer right now.
If you do findout a better solution though, I'm sure plenty of other uPortal 
users
will be interested.

Regards, Ate


public HttpServletRequest getHttpServletRequest(GenericPortlet portlet, PortletRequest request) { return (HttpServletRequest) ((HttpServletRequestWrapper) request).getRequest();
}

This is the copy of the request object as seen while debugging in eclipse when it reaches the getHttpServletRequest method:

PortletRequest request= ActionRequestImpl  (id=2278)
   boolean bodyAccessed= false
   boolean included= false
   PortletPreferences portletPreferences= null
   PortletSession portletSession= null
   PortletWindow portletWindow= PortletWindowImpl  (id=803)
DynamicInformationProvider provider= DynamicInformationProviderImpl (id=809)
   ServletRequest request= PortletParameterRequestWrapper  (id=2280)
       Map<K,V> portletParams= Collections$UnmodifiableMap<K,V>  (id=2281)
       ServletRequest request= ServletRequestImpl  (id=2282)
           Hashtable<K,V> parameters= Hashtable<K,V>  (id=2324)
           IPerson person= PersonImpl  (id=824)
           ServletRequest request= RequestParamWrapper  (id=2292)
               Map<K,V> parameters= Hashtable<K,V>  (id=2326)
               ServletRequest request= ApplicationHttpRequest  (id=2294)
                   Context context= StandardContext  (id=2247)
                   String contextPath= "/uPortal"
                   boolean crossContext= true
                   Object dispatcherType= Integer  (id=2295)
                   Map<K,V> parameters= null
                   boolean parsedParams= false
                   String pathInfo= null
                   String queryParamString= null
String queryString= "uP_portlet_action=true&_spage=%2Fshop%2FviewCategory.shtml%3FcategoryId%3DFISH"
                   ServletRequest request= RequestFacade  (id=2260)
                   Object requestDispatcherPath= "/JPetstorePortlet"
String requestURI= "/uPortal/tag.37e430d1204c663f.render.userLayoutRootNode.target.101.uP" String servletPath= "/tag.37e430d1204c663f.render.userLayoutRootNode.target.101.uP"
                   Session session= null
                   Object[] specialAttributes= Object[10]  (id=2298)
               boolean request_verified= true
SecurityRoleRefSet securityRoleRefs= SecurityRoleRefSetImpl (id=830)


But when I replace the above getHttpServletRequest  method with this:

public HttpServletRequest getHttpServletRequest(GenericPortlet portlet, PortletRequest request)
{
return (HttpServletRequest) ((HttpServletRequestWrapper) ((HttpServletRequestWrapper) ((HttpServletRequestWrapper)((HttpServletRequestWrapper)request).getRequest()).getRequest()).getRequest()).getRequest();
}

The JPetstore application works fine. So to get this to work, I had to dig down into the request object hierarchy and pass the tomcat ApplicationHttpRequest object instead of the PortletParameterRequestWrapper object.

These three request wrappers that act on the tomcat ApplicationHttpRequest inside uPortal:

org.jasig.portal.container.servlet.PortletParameterRequestWrapper
org.jasig.portal.container.servlet.ServletRequestImpl
org.jasig.portal.RequestParamWrapper

Is there a better way of getting this to work ?

Thanks,




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to