开发者

WebLogic Web Services URL/protocol at run-time

开发者 https://www.devze.com 2023-01-08 04:13 出处:网络
I\'ve been looking t开发者_运维知识库hrough the WebLogic API and can\'t seem to find what I\'m looking for... Is there a way to determine at run-time the URL being used by an application to access a w

I've been looking t开发者_运维知识库hrough the WebLogic API and can't seem to find what I'm looking for... Is there a way to determine at run-time the URL being used by an application to access a web service? I have a requirement to log the URL/protocol that was used on every incoming request to the server.

Any insight is much appreciated. Thanks!

Kal


The below should work on Weblogic (servlet container).

You need to get the HttpServletRequest and you can access any of the methods of HttpServletRequest.

I've used a JAX-RS example via the @Context, but the principle should be the same for your web service call.

@GET
@Produces("text/plain")
public String showFullURL(@Context HttpServletRequest hsr) {
   return hsr.getRequestURL();
}
0

精彩评论

暂无评论...
验证码 换一张
取 消