throw new IllegalArgumentException (rb.getString(LogFacade.ERROR_PAGE_REQUIRED_EXCEPTION)); String location = errorPage.getLocation(); if ((location != null) && !location.startsWith("/")) { if (isServlet22()) { log.log(Level.FINE, LogFacade.ERROR_PAGE_LOCATION_EXCEPTION); errorPage.setLocation("/" + location); } else { String msg = MessageFormat.format(rb.getString(LogFacade.ERROR_PAGE_LOCATION_EXCEPTION), location); String exceptionType = errorPage.getExceptionType(); if (exceptionType != null) { synchronized (exceptionPages) { exceptionPages.put(exceptionType, errorPage); } else if (errorPage.getErrorCode() > 0) { synchronized (statusPages) { int errorCode = errorPage.getErrorCode(); if ((errorCode >= 400) && (errorCode < 600)) { statusPages.put(errorCode, errorPage);
public void addErrorPage(ErrorPage errorPage) { errorPages.put(errorPage.getName(), errorPage); } public Map<String,ErrorPage> getErrorPages() { return errorPages; }
private static void addErrorPages(Context context) { for (int errorCode : ERROR_PAGE_STATUSES) { ErrorPage errorPage = new ErrorPage(); errorPage.setErrorCode(errorCode); errorPage.setLocation("/error.jspx"); context.addErrorPage(errorPage); } ErrorPage errorPage = new ErrorPage(); errorPage.setExceptionType(Throwable.class.getName()); errorPage.setLocation("/error.jspx"); context.addErrorPage(errorPage); }
/** * Remove the error page for the specified error code or * Java language exception, if it exists; otherwise, no action is taken. * * @param errorPage The error page definition to be removed */ public void removeErrorPage(ErrorPage errorPage) { String exceptionType = errorPage.getExceptionType(); if (exceptionType != null) { exceptionPages.remove(exceptionType); } else { if (errorPage.getErrorCode() == 200) { this.okErrorPage = null; } statusPages.remove(errorPage.getErrorCode()); } fireContainerEvent("removeErrorPage", errorPage); }
public JsonResult populateData(string application, string columns, string machine, string pages, string startDate, string endDate) { ErrorPage _objError = new ErrorPage(); var ErrorResult = _objError.GetErrorData(application, columns, machine, pages, startDate, endDate); //Column description: Name and Type var columnlist = new Dictionary<string, System.Type>(); foreach (System.Data.DataColumn column in _objError.ErrorData.Columns) { var t = System.Type.GetType(column.DataType.FullName); columnlist.Add(column.ColumnName, t); } _objError.ErrorColumns = columnlist; var result = JsonConvert.SerializeObject(ErrorResult.ErrorData, Formatting.Indented, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }); return Json(result, JsonRequestBehavior.AllowGet); }
if (errorPage.getExceptionType() == null) { appendElement(sb, INDENT4, "error-code", Integer.toString(errorPage.getErrorCode())); } else { appendElement(sb, INDENT4, "exception-type", errorPage.getExceptionType()); appendElement(sb, INDENT4, "location", errorPage.getLocation()); sb.append(" </error-page>\n");
/** * Return the context-relative URI of the error page for the specified * HTTP status code, if any; otherwise return <code>null</code>. * * @param status HTTP status code to look up */ @Override public String findStatusPage(int status) { ErrorPage errorPage = statusPages.get(Integer.valueOf(status)); if (errorPage!=null) { return errorPage.getLocation(); } return null; }
errorPage = new ErrorPage(); errorPage.setLocation(path); errorPage.setErrorCode(status); errorPage.setReason(reason);
/** * Return the error page entry for the specified Java exception type, * if any; otherwise return <code>null</code>. * * @param exceptionType Exception type to look up */ public String findErrorPage(String exceptionType) throws MBeanException { Context context; try { context = (Context)getManagedResource(); } catch (InstanceNotFoundException e) { throw new MBeanException(e); } catch (RuntimeOperationsException e) { throw new MBeanException(e); } catch (InvalidTargetObjectTypeException e) { throw new MBeanException(e); } return context.findErrorPage(exceptionType).toString(); }
IOException ioe = null; String message = errorPage.getReason(); if (message != null && !response.isCommitted()) { response.reset(); reader = new FileReader(errorPage.getLocation()); ioe = ResponseUtil.copy(reader, writer); try { new FileInputStream(errorPage.getLocation())); ioe = ResponseUtil.copy(istream, ostream); try {
/** * Adds the given error page to this StandardHost. * * @param errorPage The error page definition to be added */ public void addErrorPage(ErrorPage errorPage) { // Validate the input parameters if (errorPage == null) { throw new IllegalArgumentException (rb.getString(LogFacade.ERROR_PAGE_CANNOT_BE_NULL_EXCEPTION)); } // Add the specified error page to our internal collections synchronized (statusPages) { statusPages.put(errorPage.getErrorCode(), errorPage); } fireContainerEvent("addErrorPage", errorPage); }
public class MyApplication { public static void main(String[] args) { SpringApplication.run(UserDocumentLibraryClientApplication.class, args); } ... @Bean public EmbeddedServletContainerCustomizer exceptionHandling() { return container -> container.addErrorPages(new ErrorPage("/exception")); } }
if (errorPage.getExceptionType() == null) { appendElement(sb, INDENT4, "error-code", Integer.toString(errorPage.getErrorCode())); } else { appendElement(sb, INDENT4, "exception-type", errorPage.getExceptionType()); appendElement(sb, INDENT4, "location", errorPage.getLocation()); sb.append(" </error-page>\n");
/** * Return the context-relative URI of the error page for the specified * HTTP status code, if any; otherwise return <code>null</code>. * * @param status HTTP status code to look up */ @Override public String findStatusPage(int status) { ErrorPage errorPage = statusPages.get(Integer.valueOf(status)); if (errorPage!=null) { return errorPage.getLocation(); } return null; }
/** * Remove the error page for the specified error code or * Java language exception, if it exists; otherwise, no action is taken. * * @param errorPage The error page definition to be removed */ public void removeErrorPage(ErrorPage errorPage) { String exceptionType = errorPage.getExceptionType(); if (exceptionType != null) { exceptionPages.remove(exceptionType); } else { if (errorPage.getErrorCode() == 200) { this.okErrorPage = null; } statusPages.remove(errorPage.getErrorCode()); } fireContainerEvent("removeErrorPage", errorPage); }
/** * Return the error page entry for the specified Java exception type, * if any; otherwise return <code>null</code>. * * @param exceptionType Exception type to look up */ public String findErrorPage(String exceptionType) throws MBeanException { Context context; try { context = (Context)getManagedResource(); } catch (InstanceNotFoundException e) { throw new MBeanException(e); } catch (RuntimeOperationsException e) { throw new MBeanException(e); } catch (InvalidTargetObjectTypeException e) { throw new MBeanException(e); } return context.findErrorPage(exceptionType).toString(); }
response.resetBuffer(true); String message = errorPage.getReason(); if (message != null) { ((HttpResponse) response).reset(statusCode, message); reader = new FileReader(errorPage.getLocation()); ioe = ResponseUtil.copy(reader, writer); try { new FileInputStream(errorPage.getLocation())); ioe = ResponseUtil.copy(istream, ostream); try {
@Bean public EmbeddedServletContainerCustomizer exceptionHandling() { return container -> container.addErrorPages(new ErrorPage("/exception")); }
/** * Add an error page for the specified error or Java exception. * * @param errorPage The error page definition to be added */ public void addErrorPage(ErrorPage errorPage) { // Validate the input parameters if (errorPage == null) throw MESSAGES.nullErrorPage(); String location = errorPage.getLocation(); if ((location != null) && !location.startsWith("/")) { if (isServlet22()) { CatalinaLogger.CORE_LOGGER.errorPageStartsWithSlash(location); errorPage.setLocation("/" + location); } else { throw MESSAGES.errorPageMustStartWithSlash(location); } } // Add the specified error page to our internal collections String exceptionType = errorPage.getExceptionType(); if (exceptionType != null) { exceptionPages.put(exceptionType, errorPage); } else { if (errorPage.getErrorCode() == 200) { this.okErrorPage = errorPage; } statusPages.put(errorPage.getErrorCode(), errorPage); } fireContainerEvent("addErrorPage", errorPage); }
if (errorPage.getExceptionType() == null) { appendElement(sb, INDENT4, "error-code", Integer.toString(errorPage.getErrorCode())); } else { appendElement(sb, INDENT4, "exception-type", errorPage.getExceptionType()); appendElement(sb, INDENT4, "location", errorPage.getLocation()); sb.append(" </error-page>\n");