I have one portlet which has a commandLink. On the actionListner of commandLink I called the backingBean.
The backing bean has the following code.
ActionResponse actionResponse = (ActionResponse) LiferayFacesContext.getInstance().
getExternalContext().getResponse();
actionResponse.sendRedirect("http://localhost:8080/web/guest/pageName");
I have a redirect to the another portlet page. Both portlets are contained in a single war.
This redirection is not working, it gives:
classCastException. can't clast to ActionResponse
I have also tried for,
ActionResponse actionResponse= (ActionResponse) FacesContext.getCurrentInstance().
getExternalContext().getResponse();
actionResponse.sendRedirect("http://localhost:8080/web/guest/pageName");
It Throws ClassCastException. Can not cast to ActionResponse
Exception StackTrace :
java.lang.ClassCastException: com.liferay.portlet.ResourceResponseImpl cannot be cast to javax.portlet.ActionResponse at com.brightsky.action.IPCActionBackingBean.addIPCAction(IPCActionBackingBean.java:63) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:328) at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:341) at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58) at org.jboss.el.parser.AstValue.invoke(AstValue.java:96) at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276) at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:102) at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:144) at javax.faces.event.ActionEvent.processListener(ActionEvent.java:84) at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:773) at javax.faces.component.UICommand.broadcast(UICommand.java:296) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:781) at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1246) at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:77) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114) at org.portletfaces.bridge.BridgeImpl.doFacesRequest(BridgeImpl.java:513) at org.portletfaces.bridge.GenericFacesPortlet.serveResource(GenericFacesPortlet.java:131) at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:119) at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:71) at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:92) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
NOTE : I m using Liferay & Icefaces.
Thank you.