...
try {
final JSPhandler acHandler = handler;
final HttpServletRequest acRequest = request;
final HttpServletResponse acResponse = response;
final String acContextPath = contextPath;
AccessController.doPrivileged(
new PrivilegedExceptionAction() {
public Object run() throws Exception {
myService(acRequest, acResponse, acContextPath,
acHandler);
return null;
}
});
}
catch(PrivilegedActionException pae) {
Exception e = pae.getException();
// Exception handling
...
}