What is going wrong here is hat the lc_item component is rendering an plain webapp based url, not a PortletURL. The /cedar/setURL.do is invoked as is and thus not resulting in a portlet invokation... What you need to do is modifying the lc_item component to transform its url to a StrutsPortlet url using the StrutsPortletURL class. Normally within a Struts Portlet application, this is automatically handled by the extended struts tags (html:link, html:rewrite etc.). You can do that yourself by calling StrutsPortletURL.createActionURL(request, path) or .createRenderURL(request, path).
Jonathan Hawkins said: > I have a portlet deployed within jetspeed that uses struts-layout to > display a tree. The nodes of the tree can be either a folder or element, > each element is acting as an anchor. So, the user can setup a link to > http://www.google.co.uk and this is added as an element to the tree. When > they click on that element it will display googlein an IFrame portlet that > is deployed within the same webapp. > > The element is defined as > > lc_item = new MenuComponent(); > lc_item.setTitle(\"Google\"); > > lc_item.setLocation(\"/cedar/setURL.do?forward=cedarIFrame&initialPage=http://www.google.co.uk\"); > lc_item.setImage(\"is.gif\"); > lc_menu.addMenuComponent(lc_item); > > > This is how it is invoked. > > What I want to do is send a message to the IFrame to tell it what it\'s > source is, we also have another portlet which performs silent logins to > other products in our product suite, so InterPortlet Communication is a > major requirement. In Jetspeed1.6 this was easily achieved using forwards. > My job at the moment is to migrate our Jetspeed Portlets to JSR-168 > compliant portlets exposing me to all this good new stuff !!! > > Jonathan > > > ________________________________ > > From: Ate Douma [mailto:[EMAIL PROTECTED] > Sent: Wed 19/10/2005 19:28 > To: [email protected] > Subject: RE: Struts Bridge and Inter Portlet Communication > > > > How are you invoking this??? > It looks like you are accessing the webapp directly and not through the > portal. You\\\'re not running inside the portlet container and thus the > StrutsPortlet isn\\\'t invoked. > > Ate > > Jonathan Hawkins said: >> Thread [http-8088-Processor25] (Suspended (breakpoint at line 64 in >> SetURLAction)) >> SetURLAction.execute(ActionMapping, ActionForm, HttpServletRequest, >> HttpServletResponse) line: 64 >> >> PortletRequestProcessor(RequestProcessor).processActionPerform(HttpServletRequest, >> HttpServletResponse, Action, ActionForm, ActionMapping) line: 419 >> PortletRequestProcessor(RequestProcessor).process(HttpServletRequest, >> HttpServletResponse) line: 224 >> PortletRequestProcessor.process(HttpServletRequest, >> HttpServletResponse) >> line: 50 >> PortletServlet(ActionServlet).process(HttpServletRequest, >> HttpServletResponse) line: 1194 >> PortletServlet(ActionServlet).doGet(HttpServletRequest, >> HttpServletResponse) line: 414 >> PortletServlet(HttpServlet).service(HttpServletRequest, >> HttpServletResponse) line: 689 >> PortletServlet(HttpServlet).service(ServletRequest, ServletResponse) >> line: 802 >> ApplicationFilterChain.internalDoFilter(ServletRequest, >> ServletResponse) >> line: 252 >> ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: >> 173 >> StandardWrapperValve.invoke(Request, Response, ValveContext) line: 214 >> StandardValveContext.invokeNext(Request, Response) line: 104 >> StandardPipeline.invoke(Request, Response) line: 520 >> StandardContextValve.invokeInternal(Wrapper, Request, Response) line: >> 198 >> StandardContextValve.invoke(Request, Response, ValveContext) line: 152 >> StandardValveContext.invokeNext(Request, Response) line: 104 >> StandardPipeline.invoke(Request, Response) line: 520 >> StandardHostValve.invoke(Request, Response, ValveContext) line: 137 >> StandardValveContext.invokeNext(Request, Response) line: 104 >> ErrorReportValve.invoke(Request, Response, ValveContext) line: 118 >> StandardValveContext.invokeNext(Request, Response) line: 102 >> StandardPipeline.invoke(Request, Response) line: 520 >> StandardEngineValve.invoke(Request, Response, ValveContext) line: 109 >> StandardValveContext.invokeNext(Request, Response) line: 104 >> StandardPipeline.invoke(Request, Response) line: 520 >> StandardEngine(ContainerBase).invoke(Request, Response) line: 929 >> CoyoteAdapter.service(Request, Response) line: 160 >> Http11Processor.process(InputStream, OutputStream) line: 799 >> Http11Protocol$Http11ConnectionHandler.processConnection(TcpConnection, >> Object[]) line: 705 >> TcpWorkerThread.runIt(Object[]) line: 577 >> ThreadPool$ControlRunnable.run() line: 684 >> ThreadWithAttributes(Thread).run() line: 534 >> >> >> >> and this also >> >> >> >> >> >> this= SetURLAction (id=70) >> mapping= ActionMapping (id=73) >> form= null >> request= CoyoteRequestFacade (id=4188) >> request (RequestFacade)= CoyoteRequest (id=4190) >> attributes= HashMap (id=4192) >> entrySet= null >> keySet= null >> loadFactor= 0.75 >> modCount= 608 >> size= 3 >> table= HashMap$Entry[128] (id=4208) >> [0...99] >> [0]= null >> [1]= null >> [2]= null >> [3]= null >> [4]= null >> [5]= null >> [6]= null >> [7]= null >> [8]= null >> [9]= null >> [10]= null >> [11]= null >> [12]= null >> [13]= null >> [14]= null >> [15]= null >> [16]= null >> [17]= null >> [18]= null >> [19]= null >> [20]= null >> [21]= null >> [22]= null >> [23]= null >> [24]= null >> [25]= null >> [26]= null >> [27]= null >> [28]= null >> [29]= null >> [30]= HashMap$Entry (id=4219) >> [31]= null >> [32]= null >> [33]= null >> [34]= null >> [35]= null >> [36]= null >> [37]= null >> [38]= null >> [39]= null >> [40]= null >> [41]= null >> [42]= null >> [43]= null >> [44]= null >> [45]= null >> [46]= null >> [47]= null >> [48]= null >> [49]= null >> [50]= null >> [51]= null >> [52]= null >> [53]= null >> [54]= null >> [55]= null >> [56]= null >> [57]= null >> [58]= null >> [59]= null >> [60]= null >> [61]= null >> [62]= null >> [63]= null >> [64]= null >> [65]= null >> [66]= null >> [67]= null >> [68]= null >> [69]= null >> [70]= null >> [71]= null >> [72]= HashMap$Entry (id=4220) >> hash= 1428559048 >> key= \\\"org.apache.struts.action.mapping.instance\\\" >> next= null >> value= ActionMapping (id=73) >> [73]= null >> [74]= null >> [75]= null >> [76]= null >> [77]= null >> [78]= null >> [79]= null >> [80]= null >> [81]= null >> [82]= null >> [83]= null >> [84]= null >> [85]= null >> [86]= null >> [87]= null >> [88]= null >> [89]= null >> [90]= null >> [91]= null >> [92]= null >> [93]= null >> [94]= null >> [95]= null >> [96]= HashMap$Entry (id=4221) >> hash= 1107355616 >> key= \\\"org.apache.struts.action.MODULE\\\" >> next= null >> value= ModuleConfigImpl (id=2075) >> [97]= null >> [98]= null >> [99]= null >> [100...127] >> threshold= 96 >> values= null >> authType= null >> connector= CoyoteConnector (id=2043) >> context= StandardContext (id=2044) >> cookies= null >> cookiesParsed= false >> coyoteRequest= Request (id=4193) >> dispatcherType= Integer (id=2046) >> facade= CoyoteRequestFacade (id=4188) >> filterChain= ApplicationFilterChain (id=2156) >> formats= SimpleDateFormat[3] (id=4194) >> inputBuffer= InputBuffer (id=4195) >> inputStream= CoyoteInputStream (id=4196) >> localAddr= null >> locales= ArrayList (id=4197) >> localesParsed= false >> localName= null >> localPort= -1 >> log= null >> mappingData= MappingData (id=4198) >> notes= HashMap (id=4199) >> parameterMap= ParameterMap (id=4200) >> parser= StringParser (id=4201) >> postData= null >> reader= CoyoteReader (id=4202) >> readOnlyAttributes= HashMap (id=4203) >> remoteAddr= null >> remoteHost= null >> remotePort= -1 >> requestDispatcherPath= MessageBytes (id=4204) >> requestedSessionCookie= true >> requestedSessionId= \\\"B63999FD6331EBA568F30C0FFB4B5CF0\\\" >> requestedSessionURL= false >> requestParametersParsed= false >> response= CoyoteResponse (id=4206) >> secure= false >> session= StandardSession (id=4207) >> sessionParsed= false >> socket= null >> subject= null >> URIConverter= null >> userPrincipal= null >> usingInputStream= false >> usingReader= false >> valveContext= StandardValveContext (id=2158) >> wrapper= StandardWrapper (id=2062) >> request (CoyoteRequestFacade)= CoyoteRequest (id=4190) >> response= CoyoteResponseFacade (id=4189) >> >> >> Thanks >> >> Jonathan >> >> >> ________________________________ >> >> From: Jonathan Hawkins [mailto:[EMAIL PROTECTED] >> Sent: Wed 19/10/2005 19:13 >> To: [email protected] >> Cc: [EMAIL PROTECTED] >> Subject: RE: Struts Bridge and Inter Portlet Communication >> >> >> >> >> >> ________________________________ >> >> From: Ate Douma [mailto:[EMAIL PROTECTED] >> Sent: Wed 19/10/2005 18:57 >> To: [email protected] >> Subject: RE: Struts Bridge and Inter Portlet Communication >> >> >> >> Jonathan Hawkins said: >>> Ate, >>> >>> I\\\\\\\'ve built the latest portals-bridges-struts-1.2.7-0.4-SNAPSHOT.jar >>> and >>> deployed it in my webapp. >>> >>> I\\\\\\\'m using Eclipse to step through the code. This is my Execute >>> method >>> :- >>> >>> public ActionForward execute(ActionMapping mapping, ActionForm form, >>> HttpServletRequest request, HttpServletResponse response) { >>> logger = Logger.getLogger(\\\\\\\"Cedar-Portlets\\\\\\\"); >>> logger.debug(\\\\\\\"SetURLAction::execute - starting\\\\\\\"); >>> try { >>> >>> >>> ActionRequest actionRequest = (ActionRequest) request >>> .getAttribute(ContainerConstants.PORTLET_REQUEST); >>> String id = this.getInstanceID(actionRequest); >>> String msg_session_id = MessageHelper.getSessionID(actionRequest); >>> MessageHelper.loadPrefs(actionRequest, id, msg_session_id); >>> MessageHelper msgh = new MessageHelper(actionRequest >>> .getPortletSession(true), id, msg_session_id); >>> msgh.send(\\\\\\\"a_val\\\\\\\", >>> \\\\\\\"this is a message from SetURLAction in portlet webapp \\\\\\\" >>> + actionRequest.getContextPath()); >>> } catch (RuntimeException e) { >>> // TODO Auto-generated catch block >>> e.printStackTrace(); >>> return mapping.findForward(\\\\\\\"failure\\\\\\\"); >>> } >>> return mapping.findForward(\\\\\\\"success\\\\\\\"); >>> } >>> >>> actionRequest is always coming back as null, if I take a look at the >>> attributes that are set within the HttpServletRequest, the only ones I >>> can >>> see being set are :- >>> >>> org.apache.struts.action.MESSAGE >>> >>> org.apache.struts.action.mapping.instance >>> >>> org.apache.struts.action.MODULE >>> >>> no sign of javax.portlet.request. >>> >>> This is driving me round the bend !!!!! >>> >> That is very strange. >> Could you provide the full stacktrace of the call to your execute >> method? >> >> Note: on line 354 of the StrutsPortlet.java the javax.portlet.request >> attribute is/should be set. >> >> Ate >>> >>> >>> Any further assistance would be greatly appreciated, examples or >>> otherwise. >>> >>> >>> >>> Jonathan >>> >>> >>> >>> >>> >>> ________________________________ >>> >>> From: [EMAIL PROTECTED] >>> [mailto:[EMAIL PROTECTED] >>> Sent: Wed 19/10/2005 13:34 >>> To: [email protected] >>> Cc: [EMAIL PROTECTED]; [email protected] >>> Subject: Re: Struts Bridge and Inter Portlet Communication >>> >>> >>> >>> Thanks Ate, >>> >>> I was getting null pointer exceptions. I\\\\\\\'ll subscribe to the other >>> list >>> as >>> well andbuild the struts bridge and see what I can get hold of this >>> time. >>> >>> I\\\\\\\'ve created my own constants file with an entry for >>> javax.portlet.request. >>> >>> All assistance is very much appreciated. >>> >>> Jonathan >>> >>> >>>> Jonathan, >>>> First of all, I cc\\\\\\\'d this to the bridges-user mailing list so we >>>> can >>>> continue the discussion there. >>>> (if you haven\\\\\\\'t subscribed yet: >>>> http://portals.apache.org/bridges/mail-lists.html) >>>> >>>> It is not clear to me *what* is not working with the example you >>>> provided. Do you get an exception/stacktrace or is the >>>> ContainerConstants.PORTLET_REQUEST not set? >>>> >>>> In the latter case, it might be a case of which version of the >>>> struts-bridge you are using. Since august 8, the struts-bridge trunk >>>> now *does* provide the \\\\\\\"javax.portlet.request\\\\\\\" attribute, even >>>> when >>>> accessed from an ActionRequest. See: >>>> http://issues.apache.org/jira/browse/PB-2. >>>> To be able to use it, you need to checkout and build the bridges >>>> yourself. >>>> >>>> If you get an exception, could you please provide that? >>>> >>>> Note: Using ContainerConstants.PORTLET_REQUEST (instead of >>>> \\\\\\\"javax.portlet.request\\\\\\\") binds you to the jetspeed-commons jar. >>>> If >>>> you >>>> really want to be JSR-168 compliant, you should *not* use >>>> jetspeed-commons. >>>> >>>> Regards, >>>> >>>> Ate >>>> >>>> >>>> [EMAIL PROTECTED] wrote: >>>>> I am trying integrate a Struts Portlet using Struts Bridge and an >>>>> InterPortlet Communication library, >>>>> http://www.doc.ic.ac.uk/~mo197/portlets/portlet_messaging/crosscontext.php >>>>> , which works well with ordinary portlets. >>>>> >>>>> The library requires that I retrieve the PortletRequest / >>>>> ActionRequest / RenderRequest. However within my Struts Portlet I >>>>> only >>>>> action and form classes and with execute I only have >>>>> httpServletRequest available. Given that my action classes are >>>>> running >>>>> within s struts portlet how can I retrieve the PortletRequest that I >>>>> need. >>>>> >>>>> The following code shows a simple portlet that works fine. >>>>> >>>>> public class Portlet1 extends GenericPortlet{ >>>>> >>>>> >>>>> protected void doEdit(RenderRequest request, RenderResponse >>>>> response) >>>>> throws PortletException, IOException { >>>>> String id = this.getInstanceID(request); >>>>> String msg_session_id = MessageHelper.getSessionID(request); >>>>> MessageHelper.loadPrefs(request, id, msg_session_id); >>>>> MessageUtils.prepareMappingForm(request, id, >>>>> msg_session_id); >>>>> >>>>> >>> getPortletContext().getRequestDispatcher(\\\\\\\"/WEB-INF/pages/edit_mappings.jsp\\\\\\\").include(request,response);>> >>> } >>>>> >>>>> >>>>> protected void doView(RenderRequest request, RenderResponse >>>>> response) >>>>> throws PortletException, IOException { >>>>> String id = this.getInstanceID(request); >>>>> String msg_session_id = MessageHelper.getSessionID(request); >>>>> MessageHelper.loadPrefs(request, id, msg_session_id); >>>>> >>>>> response.setContentType(\\\\\\\"text/html\\\\\\\"); >>>>> PrintWriter out = response.getWriter(); >>>>> >>>>> PortletURL aURL = response.createActionURL(); >>>>> aURL.setParameter(\\\\\\\"ACTION\\\\\\\", \\\\\\\"sendmsg\\\\\\\"); >>>>> >>>>> out.println(\\\\\\\"<b>Message Session ID:</b> >>>>> \\\\\\\"+msg_session_id+\\\\\\\"<br/>\\\\\\\"); >>>>> out.println(\\\\\\\"<b>Portlet App:</b> >>>>> \\\\\\\"+request.getContextPath()+\\\\\\\"<br/>\\\\\\\"); >>>>> >>>>> out.println(\\\\\\\"<b>Portlet1</b>:<br/>\\\\\\\"); >>>>> out.println(\\\\\\\"<a >>>>> href=\\\\\\\\\\\\\\\"\\\\\\\"+aURL+\\\\\\\"\\\\\\\\\\\\\\\">send >>>>> message</a><br/><br/>\\\\\\\"); >>>>> >>>>> MessageHelper msgh = new >>>>> MessageHelper(request.getPortletSession(true), >>>>> id, msg_session_id); >>>>> String msg = (String)msgh.get(\\\\\\\"a_val\\\\\\\"); >>>>> out.println(\\\\\\\"my a_val msg: \\\\\\\"+msg); >>>>> >>>>> } >>>>> >>>>> public void processAction(ActionRequest request, ActionResponse >>>>> response) >>>>> throws PortletException, IOException { >>>>> String id = this.getInstanceID(request); >>>>> String msg_session_id = MessageHelper.getSessionID(request); >>>>> MessageHelper.loadPrefs(request, id, msg_session_id); >>>>> >>>>> >>>>> if (request.getPortletMode().equals(PortletMode.EDIT)) { >>>>> MessageUtils.processMappingForm(request, >>>>> response, id, >>>>> msg_session_id); >>>>> } >>>>> >>>>> if >>>>> (\\\\\\\"sendmsg\\\\\\\".equals(request.getParameter(\\\\\\\"ACTION\\\\\\\"))){ >>>>> System.out.println(\\\\\\\"try sending message from >>>>> Portlet 1 in webapp >>>>> \\\\\\\"+request.getContextPath()); >>>>> MessageHelper msgh = new >>>>> MessageHelper(request.getPortletSession(true), >>>>> id, msg_session_id); >>>>> msgh.send(\\\\\\\"a_val\\\\\\\", \\\\\\\"this is a message >>>>> from >>>>> Portlet1 in portlet >>>>> webapp >>>>> \\\\\\\"+request.getContextPath()); >>>>> } >>>>> } >>>>> >>>>> public String getInstanceID(PortletRequest request){ >>>>> return > \\\\\\\"Portlet1.\\\\\\\"+MessageHelper.getPortletID(request); >>>>> } >>>>> >>>>> >>>>> } >>>>> >>>>> >>>>> Hopefully from that you can see what I am trying to retrieve from >>>>> within my action class. The following is my current execute method >>>>> >>>>> logger = Logger.getLogger(\\\\\\\"Cedar-Portlets\\\\\\\"); >>>>> >>>>> logger.debug(\\\\\\\"SetURLAction::execute - starting\\\\\\\"); >>>>> >>>>> try { >>>>> >>>>> >>>>> ActionRequest actionRequest = (ActionRequest) >>>>> request >>>>> >>>>> .getAttribute(ContainerConstants.PORTLET_REQUEST); >>>>> String id = this.getInstanceID(actionRequest); >>>>> String msg_session_id >>> >>>>> MessageHelper.getSessionID(actionRequest); >>>>> MessageHelper.loadPrefs(actionRequest, id, >>>>> msg_session_id); >>>>> MessageHelper msgh = new >>>>> MessageHelper(actionRequest >>>>> .getPortletSession(true), id, >>>>> msg_session_id); >>>>> msgh.send(\\\\\\\"a_val\\\\\\\", >>>>> \\\\\\\"this is a message from >>>>> SetURLAction in portlet webapp \\\\\\\" >>>>> + >>>>> actionRequest.getContextPath()); >>>>> >>>>> } catch (RuntimeException e) { >>>>> // TODO Auto-generated catch block >>>>> e.printStackTrace(); >>>>> return mapping.findForward(\\\\\\\"failure\\\\\\\"); >>>>> } >>>>> return mapping.findForward(\\\\\\\"success\\\\\\\"); >>>>> >>>>> >>>>> >>>>> >>>>> Which doesn\\\\\\\'t work, any ideas would be greatly appreciated. >>>>> >>>>> Jon Hawkins >>>>> >>>>> >>>>> >>>>> --------------------------------------------------------------------- >>>>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>>>> For additional commands, e-mail: >>>>> [EMAIL PROTECTED] >>>>> >>>>> >>>>> >>>>> >>>>> >>>> >>>> >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >>> >>> >>> >>> This email and any files transmitted with it are confidential >>> and intended solely for the use of the individual or entity to >>> whom they are addressed. Any unauthorised distribution or >>> copying is strictly prohibited. Whilst CedarOpenAccounts >>> takes steps to prevent the transmission of viruses via e-mail, >>> we cannot guarantee that any email or attachment is free from >>> computer viruses and you are strongly advised to undertake your >>> own anti-virus precautions. CedarOpenAccounts grants no >>> warranties regarding performance, use or quality of any e-mail >>> or attachment and undertakes no liability for loss or damage, >>> howsoever caused. >>> >>> CedarOpenAccounts is a trading name of Cedar Software Ltd and >>> OpenAccounts Ltd. >>> >>> For more information on CedarOpenAccounts and our products, >>> please visit our web site at http://www.cedaropenaccounts.com >>> >>> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >> >> >> This email and any files transmitted with it are confidential >> and intended solely for the use of the individual or entity to >> whom they are addressed. Any unauthorised distribution or >> copying is strictly prohibited. Whilst CedarOpenAccounts >> takes steps to prevent the transmission of viruses via e-mail, >> we cannot guarantee that any email or attachment is free from >> computer viruses and you are strongly advised to undertake your >> own anti-virus precautions. CedarOpenAccounts grants no >> warranties regarding performance, use or quality of any e-mail >> or attachment and undertakes no liability for loss or damage, >> howsoever caused. >> >> CedarOpenAccounts is a trading name of Cedar Software Ltd and >> OpenAccounts Ltd. >> >> For more information on CedarOpenAccounts and our products, >> please visit our web site at http://www.cedaropenaccounts.com >> >> >> >> >> >> This email and any files transmitted with it are confidential >> and intended solely for the use of the individual or entity to >> whom they are addressed. Any unauthorised distribution or >> copying is strictly prohibited. Whilst CedarOpenAccounts >> takes steps to prevent the transmission of viruses via e-mail, >> we cannot guarantee that any email or attachment is free from >> computer viruses and you are strongly advised to undertake your >> own anti-virus precautions. CedarOpenAccounts grants no >> warranties regarding performance, use or quality of any e-mail >> or attachment and undertakes no liability for loss or damage, >> howsoever caused. >> >> CedarOpenAccounts is a trading name of Cedar Software Ltd and >> OpenAccounts Ltd. >> >> For more information on CedarOpenAccounts and our products, >> please visit our web site at http://www.cedaropenaccounts.com >> >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > This email and any files transmitted with it are confidential > and intended solely for the use of the individual or entity to > whom they are addressed. Any unauthorised distribution or > copying is strictly prohibited. Whilst CedarOpenAccounts > takes steps to prevent the transmission of viruses via e-mail, > we cannot guarantee that any email or attachment is free from > computer viruses and you are strongly advised to undertake your > own anti-virus precautions. CedarOpenAccounts grants no > warranties regarding performance, use or quality of any e-mail > or attachment and undertakes no liability for loss or damage, > howsoever caused. > > CedarOpenAccounts is a trading name of Cedar Software Ltd and > OpenAccounts Ltd. > > For more information on CedarOpenAccounts and our products, > please visit our web site at http://www.cedaropenaccounts.com > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
