private static void addErrorPages(Context context) { for (int errorCode : ERROR_PAGE_STATUSES) { ErrorPage errorPage = new ErrorPage(); errorPage.setErrorCode(errorCode); errorPage.setLocation("/error"); context.addErrorPage(errorPage); } ErrorPage errorPage = new ErrorPage(); errorPage.setExceptionType(Throwable.class.getName()); errorPage.setLocation("/error"); context.addErrorPage(errorPage); }
public boolean setProperty(String name, String value) { if (name.startsWith("errorCode.")) { int code = Integer.parseInt(name.substring(10)); ErrorPage ep = new ErrorPage(); ep.setErrorCode(code); ep.setLocation(value); errorPageSupport.add(ep); return true; } else if (name.startsWith("exceptionType.")) { String className = name.substring(14); ErrorPage ep = new ErrorPage(); ep.setExceptionType(className); ep.setLocation(value); errorPageSupport.add(ep); return true; } return false; }
public boolean setProperty(String name, String value) { if (name.startsWith("errorCode.")) { int code = Integer.parseInt(name.substring(10)); ErrorPage ep = new ErrorPage(); ep.setErrorCode(code); ep.setLocation(value); errorPageSupport.add(ep); return true; } else if (name.startsWith("exceptionType.")) { String className = name.substring(14); ErrorPage ep = new ErrorPage(); ep.setExceptionType(className); ep.setLocation(value); errorPageSupport.add(ep); return true; } return false; }
ErrorPage page = new ErrorPage(); page.setLocation(en.getValue()); String key = en.getKey();