简体   繁体   中英

Jersey ContainerRequestFilter Executing but Response is HTTP Status 401 - Unauthorized

The ContainerRequestFilter named AppAuthenticationFilter executes properly and yet the response is HTTP Status 401 - Unauthorized .

AppAuthenticationFilter is located in daksh.userevents.storage.apps.api .

Link for the project .

I solved it by registering the multiple API Resource Packages as well as the multiple ContainerRequestFilter implementation classes in web.xml .

Please Note: For resources: Use the packages in which the classes are contained. For providers: Use the class names. Keep the packages semi-colon/comma separated.

Example:

For Resource Packages:

<init-param>
    <param-name>jersey.config.server.provider.packages</param-name>
    <param-value>
        my.first.package;
        my.second.package;
        my.third.package
    </param-value>
</init-param>

For Providers:

<init-param>
    <param-name>jersey.config.server.provider.classnames</param-name>
    <param-value>
        my.nth.package.XYZFilter;
        my.mth.package.ABCFilter
    </param-value>
</init-param>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM