[英]How to get ServeletConfig in Jersey Provider?
So I have a Jersey REST service and I need to get access to a ServletConfig so that I can pull a param out of the web.xml.所以我有一个 Jersey REST 服务,我需要访问一个 ServletConfig 以便我可以从 web.xml 中提取一个参数。 I can use @Context to wire one in but I don't think it will get me the params I need.
我可以使用 @Context 来连接一个,但我认为它不会让我得到我需要的参数。 Only the ones in the ServletContext.
只有 ServletContext 中的那些。
Any ideas?有任何想法吗? I'm new to Jersey and this Provider isn't a Servelet.
我是泽西岛的新手,这个 Provider 不是 Servelet。 Perhaps I should start with trying to retrieve the servelet?
也许我应该从尝试检索小服务开始?
@Context: annotation can be used to inject the following classes @Context:注解可用于注入以下类
HttpServletRequest HttpServletRequest
HttpServletResponse HttpServletResponse
ServletContext服务端上下文
ServletConfig Servlet配置
WebConfig.网络配置。
onto a root resource, provider and Application classes.到根资源、提供程序和应用程序类。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.