Java Code Examples for javax.servlet.ServletResponse#reset()
The following examples show how to use
javax.servlet.ServletResponse#reset() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HodViewController.java From find with MIT License | 6 votes |
@SuppressWarnings("TypeMayBeWeakened") @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()); }
Example 2
Source File: IdolViewController.java From find with MIT License | 6 votes |
@SuppressWarnings("TypeMayBeWeakened") @ExceptionHandler @ResponseStatus(HttpStatus.NOT_FOUND) 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()); }
Example 3
Source File: IdolViewController.java From find with MIT License | 6 votes |
@SuppressWarnings("TypeMayBeWeakened") @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); 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()); }
Example 4
Source File: ExportController.java From find with MIT License | 6 votes |
@ExceptionHandler @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) public ModelAndView handleException( final Exception e, final HttpServletRequest request, final ServletResponse response ) { response.reset(); return controllerUtils.buildErrorModelAndView( new ErrorModelAndViewInfo.Builder() .setRequest(request) .setMainMessageCode("error.internalServerErrorMain") .setSubMessageCode("error.internalServerErrorSub") .setSubMessageArguments(null) .setStatusCode(HttpStatus.INTERNAL_SERVER_ERROR.value()) .setContactSupport(true) .setException(e) .build() ); }
Example 5
Source File: RequestDispatcherImpl.java From knopflerfish.org with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void forward(ServletRequest request, ServletResponse response) throws IOException, ServletException { if (!(request instanceof HttpServletRequest && response instanceof HttpServletResponse)) { throw new ServletException("Must be http request"); } if (response.isCommitted()) { throw new IllegalStateException( "Cannot forward request after response is committed"); } response.reset(); service((RequestImpl) request, (ResponseImpl) response); response.flushBuffer(); }
Example 6
Source File: SpamFilter.java From jivejdon with Apache License 2.0 | 5 votes |
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpRequest = (HttpServletRequest) request; if (safeips.contains(request.getRemoteAddr())) { chain.doFilter(request, response); return; } if (safeips.size() > 500) { safeips.clear(); } if (iPBanListManagerIF == null) iPBanListManagerIF = (IPBanListManagerIF) WebAppUtil.getComponentInstance("iPBanListManager", servletContext); if (!httpRequest.getRequestURI().contains("registerCode")) { if (isSpam(httpRequest)) { log.debug("spammer, giving 'em a 503"); safeips.remove(request.getRemoteAddr()); disableSessionOnlines(httpRequest); if (!response.isCommitted()) response.reset(); HttpServletResponse httpResponse = (HttpServletResponse) response; httpResponse.sendError(503); return; } } safeips.add(request.getRemoteAddr()); chain.doFilter(request, response); return; }
Example 7
Source File: SpamFilterTooFreq.java From jivejdon with Apache License 2.0 | 5 votes |
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (!isFilter) { chain.doFilter(request, response); return; } HttpServletRequest httpRequest = (HttpServletRequest) request; if (!httpRequest.getRequestURI().contains("registerCode")) if (!isPermittedRobot(httpRequest)) { String path = httpRequest.getServletPath(); if (numPattern.matcher(path).matches()) { int slash = path.lastIndexOf("/"); String id = path.substring(slash + 1, path.length()); if (!checkSpamHit(id, httpRequest)) { log.warn("spammer, fetching too frequency:" + httpRequest.getRequestURI() + " remote:" + httpRequest.getRemoteAddr()); disableSessionOnlines(httpRequest); if (!response.isCommitted()) response.reset(); HttpServletResponse httpResponse = (HttpServletResponse) response; httpResponse.sendError(503); return; } } } chain.doFilter(request, response); return; }
Example 8
Source File: RequestDispatcherImpl.java From lams with GNU General Public License v2.0 | 4 votes |
public void forward( ServletRequest request, ServletResponse response ) throws ServletException, IOException { response.reset(); _servletMetaData.getServlet().service( DispatchedRequestWrapper.createForwardRequestWrapper( (HttpServletRequest) request, this ), response ); }