Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

sessions always null when using httpunit

 
O. Ziggy
Ranch Hand
Posts: 430
Android Debian VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
O. Ziggy
Ranch Hand
Posts: 430
Android Debian VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply.

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.

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic