}
public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) throws IOException, ServletException {
try {
if (dispatch == Handler.REQUEST) {
ConnectorInstanceContext oldContext = trackedConnectionAssociator.enter(new SharedConnectorInstanceContext(unshareableResources, applicationManagedSecurityResources, false));
try {
next.handle(target, request, response, dispatch);
} finally {
trackedConnectionAssociator.exit(oldContext);
}
} else {
SharedConnectorInstanceContext context = new SharedConnectorInstanceContext(unshareableResources, applicationManagedSecurityResources, true);
SharedConnectorInstanceContext oldContext = (SharedConnectorInstanceContext) trackedConnectionAssociator.enter(context);
context.share(oldContext);
try {
next.handle(target, request, response, dispatch);
} finally {
context.hide();