1 24 package org.riotfamily.common.web.controller; 25 26 import javax.servlet.http.HttpServletRequest ; 27 import javax.servlet.http.HttpServletResponse ; 28 29 import org.springframework.web.servlet.ModelAndView; 30 import org.springframework.web.servlet.mvc.Controller; 31 32 38 public class HttpErrorController implements Controller { 39 40 private int statusCode; 41 42 private String message; 43 44 public HttpErrorController(int code) { 45 this.statusCode = code; 46 } 47 48 public HttpErrorController(int code, String message) { 49 this.statusCode = code; 50 this.message = message; 51 } 52 53 public ModelAndView handleRequest(HttpServletRequest request, 54 HttpServletResponse response) throws Exception { 55 56 response.sendError(statusCode, message); 57 return null; 58 } 59 60 } 61 | Popular Tags |