0 Replies Latest reply on Jul 4, 2006 12:20 PM by Vincenzo Segreto

    Redirect the flow from servlet to portlet

    Vincenzo Segreto Newbie

      Hi all,
      I'm using JBoss AS 4.0.4GA + JBoss Portal 2.4 Beta1.
      I've to redirect from a servlet to a portlet, but I don't know how. I always get a 500 error:

      2006-07-04 18:08:50,171 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/myportal]] Marking servlet centralController as unavailable
      2006-07-04 18:08:50,171 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/myportal].[centralController]] Allocate exception for servlet centralController
      java.lang.ClassCastException: mywork.controllers.CentralController
       at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1055)
       at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:757)
       at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:641)
       at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)
       at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)
       at mywork.utility.uploadfile.UploadFile.service(UploadFile.java:130)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)


      My flow is PORTLET --> JSP --> SERVLET --> PORTLET

      I've tried mapping portlet class into web.xml file without succes.

      here's the code within the servlet (note that sc is the ServletContext):

      request.setAttribute("azione",String.valueOf(Costanti.UPLOAD_FILE));
      rd = sc.getRequestDispatcher("/controller/CentralController");
      rd.include(request,response);


      here's relative web.xml part:

      <servlet>
       <servlet-name>centralController</servlet-name>
       <servlet-class>mywork.controllers.CentralController</servlet-class>
      </servlet>
      
      <servlet-mapping>
       <servlet-name>centralController</servlet-name>
       <url-pattern>/controller/CentralController</url-pattern>
       </servlet-mapping>