List of usage examples for javax.servlet ServletResponse reset
public void reset();
From source file:com.hp.autonomy.frontend.find.idol.view.IdolViewController.java
@ExceptionHandler(ReferenceFieldBlankException.class) @ResponseStatus(HttpStatus.BAD_REQUEST)/*from ww w. j a v a2s. c o m*/ public ModelAndView handleReferenceFieldBlankException(final HttpServletRequest request, final ServletResponse response) { response.reset(); log.info(Markers.AUDIT, "TRIED TO VIEW A DOCUMENT USING A BLANK REFERENCE FIELD"); return controllerUtils.buildErrorModelAndView(new ErrorModelAndViewInfo.Builder().setRequest(request) .setMainMessageCode("error.referenceFieldBlankMain") .setSubMessageCode("error.referenceFieldBlankSub").setStatusCode(HttpStatus.BAD_REQUEST.value()) .setContactSupport(true).build()); }
From source file:com.hp.autonomy.frontend.find.hod.view.HodViewController.java
@ExceptionHandler @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) public ModelAndView handleGeneralException(final Exception e, final HttpServletRequest request, final ServletResponse response) { response.reset(); return controllerUtils.buildErrorModelAndView(new ErrorModelAndViewInfo.Builder().setRequest(request) .setMainMessageCode(HOD_ERROR_MESSAGE_CODE_INTERNAL_MAIN) .setSubMessageCode(HOD_ERROR_MESSAGE_CODE_INTERNAL_SUB) .setStatusCode(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).setContactSupport(true).setException(e) .build());/*from w ww . ja v a 2s .c om*/ }
From source file:com.hp.autonomy.frontend.find.idol.view.IdolViewController.java
@ExceptionHandler @ResponseStatus(HttpStatus.NOT_FOUND)/*from www.j av a 2s . c om*/ public ModelAndView handleViewDocumentNotFoundException(final ViewDocumentNotFoundException e, final HttpServletRequest request, final ServletResponse response) { response.reset(); final String reference = e.getReference(); log.info(Markers.AUDIT, "TRIED TO VIEW NON EXISTENT DOCUMENT WITH REFERENCE {}", reference); return controllerUtils.buildErrorModelAndView(new ErrorModelAndViewInfo.Builder().setRequest(request) .setMainMessageCode("error.documentNotFound").setSubMessageCode("error.referenceDoesNotExist") .setSubMessageArguments(new Object[] { reference }).setStatusCode(HttpStatus.NOT_FOUND.value()) .setContactSupport(true).setException(e).build()); }
From source file:com.hp.autonomy.frontend.find.idol.view.IdolViewController.java
@ExceptionHandler @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) public ModelAndView handleViewServerErrorException(final ViewServerErrorException e, final HttpServletRequest request, final ServletResponse response) { response.reset(); final String reference = e.getReference(); log.info(Markers.AUDIT, "TRIED TO VIEW DOCUMENT WITH REFERENCE {} BUT VIEW SERVER RETURNED AN ERROR PAGE", reference);//from www . j a v a2 s . c o m return controllerUtils.buildErrorModelAndView(new ErrorModelAndViewInfo.Builder().setRequest(request) .setMainMessageCode("error.viewServerErrorMain").setSubMessageCode("error.viewServerErrorSub") .setSubMessageArguments(new Object[] { reference }) .setStatusCode(HttpStatus.INTERNAL_SERVER_ERROR.value()).setContactSupport(true).setException(e) .build()); }
From source file:com.hp.autonomy.frontend.find.idol.view.IdolViewController.java
@ExceptionHandler @ResponseStatus(HttpStatus.BAD_REQUEST)//w w w . j a va2 s .c o m public ModelAndView handleViewNoReferenceFieldException(final ViewNoReferenceFieldException e, final HttpServletRequest request, final ServletResponse response) { response.reset(); final String reference = e.getReference(); final String referenceField = configService.getConfig().getViewConfig().getReferenceField(); log.info(Markers.AUDIT, "TRIED TO VIEW DOCUMENT WITH REFERENCE {} BUT THE REFERENCE FIELD {} WAS MISSING", reference, referenceField); return controllerUtils.buildErrorModelAndView(new ErrorModelAndViewInfo.Builder().setRequest(request) .setMainMessageCode("error.documentNoReferenceField") .setSubMessageCode("error.documentNoReferenceFieldExtended") .setSubMessageArguments(new Object[] { reference, referenceField }) .setStatusCode(HttpStatus.BAD_REQUEST.value()).setContactSupport(true).setException(e).build()); }
From source file:org.apache.catalina.valves.ErrorReportValve.java
/** * Invoke the next Valve in the sequence. When the invoke returns, check * the response state, and output an error report is necessary. * * @param request The servlet request to be processed * @param response The servlet response to be created * @param context The valve context used to invoke the next valve * in the current processing pipeline/* w ww . j a v a 2 s .c om*/ * * @exception IOException if an input/output error occurs * @exception ServletException if a servlet error occurs */ public void invoke(Request request, Response response, ValveContext context) throws IOException, ServletException { // Perform the request context.invokeNext(request, response); ServletRequest sreq = (ServletRequest) request; Throwable throwable = (Throwable) sreq.getAttribute(Globals.EXCEPTION_ATTR); ServletResponse sresp = (ServletResponse) response; if (sresp.isCommitted()) { return; } if (throwable != null) { // The response is an error response.setError(); // Reset the response (if possible) try { sresp.reset(); } catch (IllegalStateException e) { ; } ServletResponse sresponse = (ServletResponse) response; if (sresponse instanceof HttpServletResponse) ((HttpServletResponse) sresponse).sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } response.setSuspended(false); try { report(request, response, throwable); } catch (Throwable tt) { tt.printStackTrace(); } }