WebSphere Portal Server - jsr 168 struts portletURI problem on WP 5.1

This is Interesting: Free IT Magazines  
Home > Archive > WebSphere Portal Server > September 2005 > jsr 168 struts portletURI problem on WP 5.1





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author jsr 168 struts portletURI problem on WP 5.1

2005-09-05, 6:06 pm

Hello,

I am new to Struts Framework. I am developing a Struts based JSR 168 portlet on WepSphere Portal 5.1 platform. I needed some help with an error I am getting in generating Portlet URI's within the struts Action class. I am using this method to generate str
uts action url mentioned in the Forwards and Redirect option of this page in WP 5.1 info center. http://publib.boulder.ibm.com/infoc...pstrsource.html

PortletApiUtils portletUtils = PortletApiUtils.getUtilsInstance();
Object portletURI = null;
if (portletUtils != null)
{
// when run in a portlet use this execution path.
Object pResponse = portletUtils.getPortletResponse( (HttpServletRequest) request );
try {
portletURI = portletUtils.createPortletURIWithStrutsURL(request, url);
// don't need to call response.encodeURL, the portletURI.toString takes care of that.
}
channel.setLocation(portletURI.toString());
Here channel is a component within my portlet which has link to a struts action...

I am getting the following error when i try to run the jsr 168 portlet within RAD WP 5.1 test environment..

[9/5/05 14:54:00:902 CDT] 32720e51 SystemErr R java.lang.ClassCastException: com.ibm.wps.struts.pluto.base.WpsStrutsActionRequestWrapper
[9/5/05 14:54:00:902 CDT] 32720e51 SystemErr R at com.ibm.wps.standard.struts.portlet.PortletApiUtilsImpl.createPortletURI(PortletApiUtilsImpl.java:193)
[9/5/05 14:54:00:902 CDT] 32720e51 SystemErr R at com.ibm.wps.standard.struts.portlet.PortletApiUtilsImpl.createPortletURI(PortletApiUtilsImpl.java:139)
[9/5/05 14:54:00:902 CDT] 32720e51 SystemErr R at com.ibm.wps.standard.struts.portlet.PortletApiUtilsImpl. createPortletURIWithStrutsURL(PortletApi
UtilsImpl.java:243)
[9/5/05 14:54:00:902 CDT] 32720e51 SystemErr R at com.ibm.portal.struts.common.PortletApiUtils. createPortletURIWithStrutsURL(PortletApi
Utils.java:260)
[9/5/05 14:54:00:902 CDT] 32720e51 SystemErr R at com.fmo.targetcontent.web.action.ViewCMAAction.createCMAFormTree(ViewCMAAction.java:191)
[9/5/05 14:54:00:902 CDT] 32720e51 SystemErr R at com.fmo.targetcontent.web.action.ViewCMAAction.execute(ViewCMAAction.java:149)
[9/5/05 14:54:00:902 CDT] 32720e51 SystemErr R at com.ibm.portal.struts.portlet.WpRequestProcessor.processActionPerform(WpRequestProcessor.java:359)
[9/5/05 14:54:00:902 CDT] 32720e51 SystemErr R at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
[9/5/05 14:54:00:902 CDT] 32720e51 SystemErr R at com.ibm.portal.struts.portlet.StrutsPortlet.processActionPerformed(StrutsPortlet.java:1655)
[9/5/05 14:54:00:902 CDT] 32720e51 SystemErr R at com.ibm.portal.struts.portlet.StrutsPortlet.processAction(StrutsPortlet.java:1387)
[9/5/05 14:54:00:902 CDT] 32720e51 SystemErr R at com.ibm.wps.pe.pc.std.cmpf.impl.PortletFilterChainImpl.processAction(PortletFilterChainImpl.java:104)
[9/5/05 14:54:00:902 CDT] 32720e51 SystemErr R at com.ibm.wps.propertybroker.standard.filter.PropertyBrokerActionFilter. processAction(PropertyBrokerActionFilter
.java:260)
[9/5/05 14:54:00:902 CDT] 32720e51 SystemErr R at com.ibm.wps.pe.pc.std.cmpf.impl.PortletFilterChainImpl.processAction(PortletFilterChainImpl.java:95).....

I am getting this classCastException at this line

portletURI = portletUtils.createPortletURIWithStrutsURL(request, url);

I have taken the code to creating Portlet URI straight from the infocenter.. May be I am missing something about using JSR 168 with struts api. I would appreciate any help or tips with this problem...
Regards

2005-09-15, 6:06 pm

Maybe you are using the incorrect request Processor. I remember that I had to change it myself:

com.ibm.portal.struts.portlet.WpRequestProcessor

This goes in the struts-config.xml file under "controller"

Give it a try. Not sure if that is it or not, though. Good luck!

2005-09-15, 6:06 pm

> Maybe you are using the incorrect request Processor.
> I remember that I had to change it myself:
>
> com.ibm.portal.struts.portlet.WpRequestProcessor
>
> This goes in the struts-config.xml file under
> "controller"
>
> Give it a try. Not sure if that is it or not,
> though. Good luck!


Thanks for the reply. I am using the correct request Processor. After many hours of searching on the net, I came to know that my Struts Action class has to implement IStrutsPrepareRender interface. The sample code which comes with IBM Struts Portlet Frame
work (SPFStandardTransformation.war) contains an example of Struts Action which uses PortletApiUtils class to create a struts action URI using the same code in WP 5.1 infocenter. I think the infocenter should mention about implementing the interface (IStr
utsPrepareRender ) in the Struts Action Class. This would have save me lot of pain !!. Anyways Thanks for the reply.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com