Basiscly i have a struts application whereby each action is authenticated. So if i make a request this is what happens
- Enter URL - Servlet validates that user is valid by checking the user's details currently on user's session or authenticate user from the database based on the user logged on the desktop(If session does not exist).
Now i would like to test my application using httpunit but i cant seem to be able to access the sessions.
I write this simple example
It works fine but the response i get is my "Access Denied" page. The findProductsStart Action does authenticate the user through the session. I did debug the above code and it showed that session is null. If i load the same action from the browser everything works fine.
Does anyone have any idea why this doesnt work?
Joined: Mar 22, 2005
If findProductsStart does the right thing on the server, yet still returns an Access Denied page, then you'd have to debug the server logic to see where the HttpUnit access differs from the browser access.
I found that the problem was that there was no session being created. The session was created when the user access the main page. Accessing the above page meant that there was no session so access was denied.