private void doHandleAs ( Subject subject , final HttpExchange pHttpExchange ) { try { Subject . doAs ( subject , new PrivilegedExceptionAction < Void > ( ) { public Void run ( ) throws IOException { doHandle ( pHttpExchange ) ; return null ; } } ) ; } catch ( PrivilegedActionException e ) { throw new SecurityException ( "Security exception: " + e . getCause ( ) , e . getCause ( ) ) ; } }
run as priviledged action