问题描述
我有一个摆动的桌面应用程序,我需要创建HttpServletRequest对象以通过Web服务将其传递给另一个应用程序,所以请建议我在简单的类中创建请求对象。
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.
推荐答案
Spring有很好的HttpServletRequest和HttpServletResponse实现,叫做MockHttpServletRequest / Response。 Javadoc链接此处一>。虽然用于测试,但它们适用于需要传递内部servlet对象的情况。
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.
这些类位于org.springframework.test jar中。
The classes are in the org.springframework.test jar.
这篇关于如何在桌面Java应用程序中创建HttpServletRequest对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!