【发布时间】:2014-10-17 10:54:56
【问题描述】:
我有一个带有 6 个 Web 服务的 Java servlet 应用程序,我必须确定其中一个 Web 请求是调用 Web 服务的 Live 还是 Test 实例。我相信我可以从 URL 中确定这一点,即
https://localhost:8443/projectname/etc
或
https://localhost:8443/projectnameTEST/etc
我正在尝试使用 HttpServletRequest 来获取它,并且我知道我必须从名为“getDocument”的 Web 服务内部调用类似下面的过程但是如何在 getDocument 中初始化 HttpServletRequest?那就是如何在getDocument web服务中创建参数“request”,并将其初始化为请求信息?
public void doGet(HttpServletRequest request,
HttpServletResponse response) throws Exception {
...
StringBuffer url = request.getRequestURL();
...
}
【问题讨论】:
标签: java web-services servlets