- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我为 Jersey 创建了一个 LoggingFilter,并在 web.xml 中正确配置了它。一切正常。当我执行“GET”时,我得到 userPrincipal (request.getUserPrincipal()) 但对于 POST,它返回 null。我已经在 Websphere 上用 java 1.4 编写了几个 REST 服务,并且总是可以访问 userPrincipal,但是在 Tomcat/1.6 上我得到了上面的内容。我正在使用基本身份验证。 Jersey 是这样做的吗?还是 Tomcat?
<security-constraint>
<web-resource-collection>
<web-resource-name>Lookup Resources</web-resource-name>
<description>A set of secured resources.</description>
<url-pattern>/rest/lookup/*</url-pattern>
<http-method>GET</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>DataServ_Lookup</role-name>
<role-name>DataServ_Admin</role-name>
</auth-constraint>
<!-- Comment this out for Dev. It is a MUST for Prod...
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>-->
</security-constraint>
最佳答案
您为什么要创建自己的 LoggingFilter?你知道 Jersey 包括一个开箱即用的吗?您的过滤器是否以任何方式修改请求?尝试将 HttpServletRequest 注入(inject)您的资源并获取主要形式 - 查看它是否已设置。如果没有,请查看您的请求是否真的包含基本身份验证 header 。
关于java - Jersey Logging 过滤器为 POST 吃掉 UserPrincipal,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10250719/
长期以来,我一直在寻找解决我的问题的方法,这就是我求助于您的原因: 考虑这段代码: static char done = 0; static void sigHandler(void) { d
我现在的职业是信息架构师和 JavaScript 开发人员,但最近我又回到了后端编码领域。而且,在尝试集成 HTML 原型(prototype)并与我们基于 C# 的 CMS 一起工作时,我与我们的程
我为 Jersey 创建了一个 LoggingFilter,并在 web.xml 中正确配置了它。一切正常。当我执行“GET”时,我得到 userPrincipal (request.getUserP
我没问题 Xcode 8.3.2 和 SourceKitService 正在使用我所有的 CPU。我在stackoverflow上阅读了很多问题,但找不到真正的解决方案。 我试过的: 清理项目数据:c
我是一名优秀的程序员,十分优秀!