atom feed10 messages in org.apache.struts.userServer Port Problem HELP
FromSent OnAttachments
Steven D. WilkinsonJan 29, 2001 7:21 am 
Michael MokJan 29, 2001 7:57 am 
Chris SmithJan 29, 2001 8:26 am 
Frederic BAGESJan 29, 2001 8:59 am 
Steven D. WilkinsonJan 29, 2001 9:37 am 
Frederic BAGESJan 29, 2001 9:48 am 
Steven D. WilkinsonJan 29, 2001 10:14 am 
Justin KennedyJan 29, 2001 10:18 am 
Frederic BAGESJan 29, 2001 10:18 am 
Craig R. McClanahanJan 31, 2001 2:08 pm 
Subject:Server Port Problem HELP
From:Michael Mok (mok@hotmail.com)
Date:Jan 29, 2001 7:57:51 am
List:org.apache.struts.user

Hi

Sorry to post such a long email. I am absolutely stump with a session problem that have been bugging my STRUTS based application.

I have encountered some session persistence problem with my application trying to track if the user has logged on. I am not sure if it is due to the fact that the website uses Tomcat 3.1 or STRUTS.

My application presents a logon page which when the user logons on successfully, a session is created and a "user" object stored in the session

eg LogonAction.class HttpSession session = request.getSession(); session.setAttribute(Constants.USER_KEY, user);

Next the application will forward the user to the main page. User can then click on an action such "view data from a table" which will forward to an action class to display the rows.

All my action class check if the "user" object exists within the session otherwise they will be directed to the logon page.

eg ShowColumnAction.class

org.teatimej.initialise.User user = (org.teatimej.initialise.User) session.getAttribute(Constants.USER_KEY); if (user == null) { if (servlet.getDebug() >= 1) servlet.log(" User is not logged on in session " + session.getId()); return (servlet.findForward("logon")); }

The odd thing here is that user will always be directed back to the logon page upon clicking on the first action URL on the main page. However after they logon the second time, all action URL works fine.

The website support personnel said that it could be due to the fact that my URL have a server port attached even though the server port is port 80.

I noticed that my logon form does not have a base html tag (if that may be the problem) and the form URL (does not contain port 80) is

http://www.webappcabaret.com/teatimej/logon_wac.jsp

The form action (after logon_wac.jsp is displayed on the browser) is

<form name="logonForm" method="POST" action="logonwac.do">

The URL found on the main page have the following URL

<a href="http://webappcabaret.com:80/teatimej/edittable.do?action=new">

The subsequent logon form action (logon_wac.jsp) is

<form name="logonForm" method="POST" action="logonwac.do;jsessionid=To1015mC34669985688752114At">

What have I done to STRUTS such that the logon page above includes a jsessionid as compared to the first logon exact form (but with no jsessionid) ?

I have been advised by the website support personnel to remove the port number from the URL.

I check the STRUTS link tag and found that the server port is always append to the server name. Here is the code where STRUTS builds up the URL..

RequestUtils.class

public static String absoluteURL(HttpServletRequest request, String path) {

try { URL url = new URL(request.getScheme(), request.getServerName(), request.getServerPort(), request.getContextPath() + path); return (url.toString()); } catch (MalformedURLException e) { return (null); }

}

I cannot see any option to instruct STRUTS not to include the serverport when building the URL. However the server port may be a red herring.

Have I got off the rails?

TIA