3

I have a desktop application made in swing, and I need to create HttpServletRequest Object to pass it to another application through Web-Service, so please suggest me something good to create request object in simple class.

1
  • Even if you can do this I don't believe it would be good practice. If you already have a web service set up could you use that API to communicate with? Commented Jan 11, 2011 at 12:50

1 Answer 1

5

Spring has nice implementations of HttpServletRequest and HttpServletResponse called MockHttpServletRequest/Response. Javadoc link here. Although intended for testing, they work very well for cases where you need to pass internal servlet objects around.

The classes are in the org.springframework.test jar.

Sign up to request clarification or add additional context in comments.

1 Comment

BTW, I agree with Josh about dubious practices. OTOH, you don't always have control over the APIs you need to use.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.