我有一个授权过滤器。在尝试检索路径参数时,我无法获取值。 有人可以告诉我,下面的代码有什么问题。
@AuthorizedAccess //named exception
@Provider
public class AuthorizedAccessFilter implements ContainerRequestFilter {
/** The Constant logger. */
private final static Logger logger = LoggerFactory.getLogger(AuthorizedAccessFilter.class);
public void filter(ContainerRequestContext requestContext) {
logger.info(AUTH_MESSAGE, requestContext.getUriInfo().getAbsolutePath());
MultivaluedMap<String, String> pathParameters = requestContext.getUriInfo().getPathParameters();
for (Entry<String, List<String>> e : pathParameters.entrySet()) {
logger.info( " key :value " +e.getKey(), e.getValue());
}
logger.info("pathparammap = {} ",pathParameters.size());
}
然后它返回: 它返回键名但不返回值。
AuthorizedAccessFilter - key value entity-id
AuthorizedAccessFilter - pathparammap = 1
答案 0 :(得分:1)