Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JBoss User Help »

[jboss-user] [JBoss Portal] - Authenticate and redirect/forward to
 another page in the por

scott.stark@jboss.org

2007-05-04


Hello
I have a request from a user of my portal to automatically log in the user into the portal and then take them to a particular page say p1.jsp .

The user will pass a param in the request "next_url=UserManager/UserListPortletWindow?action=2&operation=view_reg_code"

Since I use a DatabaseLoginModule I am able to to the authenticate the user by having his link point to

/portal/j_security_check?&j_username=xyz&j_password=y&next_url=above string

This works fine, the user is logged in, but the user is brought to the home page or default page specified in the web.xml.

How do I redirect or forward the request to the next_url after successfully authenticating him.

I tried to put in the following code in the commit() method of the DatabaseLoginModule in a failed attempt to forward the request


| public boolean commit() throws LoginException {
|           boolean result = super.commit();
|
|    try{  
|      HttpServletRequest request = (HttpServletRequest) PolicyContext.getContext(REQUEST_CONTEXT);
|      
|      RequestDispatcher rd = request.getRequestDispatcher("/users");
|      HttpServletResponse response = (HttpServletResponse) PolicyContext.getContext("javax.servlet.http.HttpServletResponse");
|      rd.forward(request, response);
|    } catch (Exception e) {
|      log.error("Caught Exception while putting MyRackspaceUser in session!", e);
|    }    
|     return result;
| }
|

this fails because there is no such context as "javax.servlet.http.HttpServletResponse"

There does not seem to be a way to redirect the request.

Is there any way to redirect/forward the user to a specific page in the portal right after login.

Any help is highly appreciated.
Thank you so much.

Vijay

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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4043298
_______________________________________________
jboss-user mailing list
jboss-user@(protected)
https://lists.jboss.org/mailman/listinfo/jboss-user
©2008 junlu.com - Jax Systems, LLC, U.S.A.