Mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Satish Sekharan <sat...@mun.ca>
Subject JPetstore and uPortal 2.5...
Date Mon, 07 Nov 2005 02:55:02 GMT
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

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.

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.

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,

-- 
Satish Sekharan . . .
 Programmer Intern // ccwebworks // Computing & Communications
 Memorial University of Newfoundland // St. John's, NL, Canada 


---------------------------------------------------------------------
To unsubscribe, e-mail: bridges-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: bridges-dev-help@portals.apache.org


Mime
View raw message