This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Testing and the fly likes HtmlUnit problem: Change the Request Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Engineering » Testing
Bookmark "HtmlUnit problem: Change the Request" Watch "HtmlUnit problem: Change the Request" New topic

HtmlUnit problem: Change the Request

sam backet

Joined: Sep 02, 2011
Posts: 22


I have a problem. I'm using a webApplication, which I run via a Jetty-Server
Now I want to send Requests, to test the responses.

But, I don't undersatnd it to change the session. A class of my application calls an attribut from the request. How is it possible to change the atrribut in my request.

Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

request.getSession().setAttribute("newValue", newValue);

[] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
sam backet

Joined: Sep 02, 2011
Posts: 22

It doesn' work, because I'm using the WebRequest from HMTL-Unit. and there is no "request.getSession"?

And if I use the WebRequest from class "HttpServletRequest" I don't know how to initialize the client. and send the message.

Do you know, how I can solve it?

I agree. Here's the link:
subject: HtmlUnit problem: Change the Request
It's not a secret anymore!