@ Override protected void doDelete ( final HttpServletRequest req , final HttpServletResponse res ) throws ServletException , IOException { LOG . debug ( "Entering" ) ; final AtomHandler handler = createAtomRequestHandler ( req , res ) ; final String userName = handler . getAuthenticatedUsername ( ) ; if ( userName != null ) { final AtomRequest areq = new AtomRequestImpl ( req ) ; try { if ( handler . isEntryURI ( areq ) ) { handler . deleteEntry ( areq ) ; res . setStatus ( HttpServletResponse . SC_OK ) ; } else { res . setStatus ( HttpServletResponse . SC_NOT_FOUND ) ; } } catch ( final AtomException ae ) { res . sendError ( ae . getStatus ( ) , ae . getMessage ( ) ) ; LOG . debug ( "An error occured while processing DELETE" , ae ) ; } catch ( final Exception e ) { res . sendError ( HttpServletResponse . SC_INTERNAL_SERVER_ERROR , e . getMessage ( ) ) ; LOG . debug ( "An error occured while processing DELETE" , e ) ; } } else { res . setHeader ( "WWW-Authenticate" , "BASIC realm=\"AtomPub\"" ) ; // Wanted to use sendError() here but Tomcat sends 403 forbidden // when I do that, so sticking with setStatus() for time being. res . setStatus ( HttpServletResponse . SC_UNAUTHORIZED ) ; } LOG . debug ( "Exiting" ) ; }
Handle Atom DELETE by calling appropriate handler .