如何在桌面Java应用程序中创建HttpServletRequest对象 [英] How To Create The HttpServletRequest Object In Desktop Java Application

查看:1255
本文介绍了如何在桌面Java应用程序中创建HttpServletRequest对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个摆动的桌面应用程序,我需要创建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对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆