private Object invokeSubLocator(final Object resource, final UriRuleContext context) {
// Push the response filters
context.pushContainerResponseFilters(responseFilters);
ContainerRequest containerRequest = context.getContainerRequest();
// Process the request filter
if (!requestFilters.isEmpty()) {
for (ContainerRequestFilter f : requestFilters) {
containerRequest = f.filter(containerRequest);
context.setContainerRequest(containerRequest);
}
}
// Invoke the sub-locator method
dispatchingListener.onSubResourceLocator(Thread.currentThread().getId(), locator);
SecurityContext sc = containerRequest.getSecurityContext();
if (sc instanceof SubjectSecurityContext) {
return ((SubjectSecurityContext) sc).doAsSubject(new PrivilegedAction() {
@Override
public Object run() {
return dispatch(resource, context);