在Tomcat 7中,日志消息“不受任何约束”是什么意思?

时间:2015-08-28 19:34:46

标签: java tomcat jersey-2.0

我在tomcat中运行了一个非常简单的Jersey 2.x rest端点。对于到终点的每个请求,我得到这个日志输出:

FINE: Security checking request POST /myurl/s
Aug 28, 2015 7:17:08 AM org.apache.catalina.authenticator.AuthenticatorBase invoke
FINE:  Not subject to any constraint
Aug 28, 2015 7:17:08 AM org.apache.catalina.core.StandardWrapper allocate
FINER:   Returning non-STM instance

这是代码:

@Path("myurl")
public class MyEndPoint extends BaseRawInfoEndPoint {
    @POST
    @Path("s")
    //@Produces(MediaType.APPLICATION_JSON)
    @Consumes(MediaType.APPLICATION_JSON)
    public void saveStuff(String rawJson) throws JsonProcessingException {
        //persist code
    }
}

1 个答案:

答案 0 :(得分:1)

您可以看到它已记录here。请求通过Tomcat的身份验证机制。如果没有设置约束,那么它将被记录,并且该方法将返回并继续。

安全性约束来自Servlet规范。您可以阅读更多相关信息here in the EE tutorial: 48.2.1 Specifying Security Constraints。约束是配置身份验证和访问控制机制,它们应该在web.xml文件中配置。

另见:

  • Realm Configuration HOW-TO。如果要测试安全性约束,则需要在Tomcat中配置域,因为您需要在web.xml中指定域
相关问题