如何在Jersey Provider中获取ServeletConfig? [英] How to get ServeletConfig in Jersey Provider?

查看:111
本文介绍了如何在Jersey Provider中获取ServeletConfig?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个Jersey REST服务,我需要访问ServletConfig,以便可以从web.xml中提取一个参数.我可以使用@Context插入其中,但我认为这不会给我带来我需要的参数.只有ServletContext中的那些.

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. I can use @Context to wire one in but I don't think it will get me the params I need. Only the ones in the ServletContext.

有什么想法吗?我是新泽西州的新手,而此提供商不是Servelet.也许我应该首先尝试检索发菜卷?

Any ideas? I'm new to Jersey and this Provider isn't a Servelet. Perhaps I should start with trying to retrieve the servelet?

推荐答案

@Context:批注可用于注入以下类

@Context: annotation can be used to inject the following classes

  1. HttpServletRequest

  1. HttpServletRequest

HttpServletResponse

HttpServletResponse

ServletContext

ServletContext

ServletConfig

ServletConfig

在根资源,提供程序和应用程序类上.

onto a root resource, provider and Application classes.

Java文档Servlet容器

这篇关于如何在Jersey Provider中获取ServeletConfig?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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