[jboss-user] [JBoss Portal] - Re: Redirect after logout

maiky do-not-reply at jboss.com
Wed Jul 4 07:35:34 EDT 2007


I try to rewrite the header.jsp with the example of the doc but have erros.

<%@ page import="org.jboss.portal.identity.User" %>
  | <%@ page import="org.jboss.portal.api.PortalURL" %>
  | 
  | <%
  |    User user = (User) request.getAttribute("org.jboss.portal.header.USER");
  |    PortalURL signOutURL = (PortalURL)request.getAttribute("org.jboss.portal.header.SIGN_OUT_URL");
  |    PortalURL loginURL = (PortalURL)request.getAttribute("org.jboss.portal.header.LOGIN_URL");
  |    
  | 
  |    if (user == null)
  |    {
  | %>
  |    <a href="<%= loginURL %>">Login</a>
  | <%
  |    }
  |    else
  |    {
  | %>
  | Logged in as: <%= user.getUserName() %>
  | <br/>
  | <a href="<%= signOutURL %>">Logout</a>
  | <%
  |    }
  | %>

Errors : 
15:25:37,046 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
  | java.lang.ClassCastException: java.lang.String
  | 	at org.apache.jsp.WEB_002dINF.jsp.header.header_jsp._jspService(header_jsp.java:49)
  | 	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
  | 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
  | 	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
  | 	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
  | 	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
  | 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
  | ++ MORE...
15:25:37,046 ERROR [STDERR] org.apache.jasper.JasperException: Exception in JSP: /WEB-INF/jsp/header/header.jsp:6
  | 
  | 3: 
  | 4: <%
  | 5:    User user = (User) request.getAttribute("org.jboss.portal.header.USER");
  | 6:    PortalURL signOutURL = (PortalURL)request.getAttribute("org.jboss.portal.header.SIGN_OUT_URL");
  | 7:    PortalURL loginURL = (PortalURL)request.getAttribute("org.jboss.portal.header.LOGIN_URL");
  | 8:    
  | 9: 
  | 
  | 
  | Stacktrace:
  | 15:25:37,046 ERROR [STDERR] 	at org.apache.jasper.servlet.JspServletWrapper.handleJspException
  | ++ MORE ...

If I understand the request.getAttribute("org.jboss.portal.header.SIGN_OUT_URL") is a String, not a PortalURL.

So I can't use the portalURL methods. I just can get the SIGN_OUT_URL in a String.

anonymous wrote : May be 2.6 has a smarter solution for integrating this using the pageInterceptor? 

Sorry I don't understand what I must do, can you explain plz ? :(


Any Solutions to redirect?

Thanks.

PS: Sorry for my bad English

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4060379#4060379

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4060379



More information about the jboss-user mailing list