private static void doTestServingLayer(Config config) throws IOException { try (ServingLayer servingLayer = new ServingLayer(config)) { servingLayer.start(); Context context = servingLayer.getContext(); assertNotNull(context.findErrorPage(500)); assertEquals(0, context.getApplicationLifecycleListeners().length); assertNotNull(context.findParameter(ConfigUtils.class.getName() + ".serialized")); assertNotNull(context.getName()); assertGreaterOrEqual(Double.parseDouble(context.getWebappVersion()), 3.1); } }
/** * Find and return the ErrorPage instance for the specified exception's * class, or an ErrorPage instance for the closest superclass for which * there is such a definition. If no associated ErrorPage instance is * found, return <code>null</code>. * * @param context The Context in which to search * @param exception The exception for which to find an ErrorPage */ private static ErrorPage findErrorPage (Context context, Throwable exception) { if (exception == null) return (null); Class<?> clazz = exception.getClass(); String name = clazz.getName(); while (!Object.class.equals(clazz)) { ErrorPage errorPage = context.findErrorPage(name); if (errorPage != null) return (errorPage); clazz = clazz.getSuperclass(); if (clazz == null) break; name = clazz.getName(); } return (null); }
/** * 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 * @return a string representation of the error page * @throws MBeanException propagated from the managed resource access * @deprecated Unused. Will be removed in Tomcat 10. * Use {@link #findErrorPage(Throwable)} instead. */ @Deprecated public String findErrorPage(String exceptionType) throws MBeanException { Context context = doGetManagedResource(); return context.findErrorPage(exceptionType).toString(); }
/** * 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 * @return a string representation of the error page * @throws MBeanException propagated from the managed resource access * @deprecated Unused. Will be removed in Tomcat 10. * Use {@link #findErrorPage(Throwable)} instead. */ @Deprecated public String findErrorPage(String exceptionType) throws MBeanException { Context context = doGetManagedResource(); return context.findErrorPage(exceptionType).toString(); }
/** * Return the error page entry for the specified HTTP error code, * if any; otherwise return <code>null</code>. * * @param errorCode Error code to look up * @return a string representation of the error page * @throws MBeanException propagated from the managed resource access */ public String findErrorPage(int errorCode) throws MBeanException { Context context = doGetManagedResource(); return context.findErrorPage(errorCode).toString(); }
/** * 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 * @return a string representation of the error page * @throws MBeanException propagated from the managed resource access */ public String findErrorPage(Throwable exceptionType) throws MBeanException { Context context = doGetManagedResource(); return context.findErrorPage(exceptionType).toString(); }
/** * 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 * @return a string representation of the error page * @throws MBeanException propagated from the managed resource access */ public String findErrorPage(Throwable exceptionType) throws MBeanException { Context context = doGetManagedResource(); return context.findErrorPage(exceptionType).toString(); }
/** * Return the error page entry for the specified HTTP error code, * if any; otherwise return <code>null</code>. * * @param errorCode Error code to look up * @return a string representation of the error page * @throws MBeanException propagated from the managed resource access */ public String findErrorPage(int errorCode) throws MBeanException { Context context = doGetManagedResource(); return context.findErrorPage(errorCode).toString(); }
/** * Return the error page entry for the specified HTTP error code, * if any; otherwise return <code>null</code>. * * @param errorCode Error code to look up */ public String findErrorPage(int errorCode) 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(errorCode).toString(); }
/** * Return the error page entry for the specified HTTP error code, * if any; otherwise return <code>null</code>. * * @param errorCode Error code to look up */ public String findErrorPage(int errorCode) 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(errorCode).toString(); }
/** * 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(); }
/** * 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(); }
/** * Return the error page entry for the specified HTTP error code, * if any; otherwise return <code>null</code>. * * @param errorCode Error code to look up */ public String findErrorPage(int errorCode) 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(errorCode).toString(); }
/** * Return the error page entry for the specified HTTP error code, * if any; otherwise return <code>null</code>. * * @param errorCode Error code to look up */ public String findErrorPage(int errorCode) 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(errorCode).toString(); }
/** * Return the error page entry for the specified HTTP error code, * if any; otherwise return <code>null</code>. * * @param errorCode Error code to look up */ public String findErrorPage(int errorCode) 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(errorCode).toString(); }
/** * Return the error page entry for the specified HTTP error code, * if any; otherwise return <code>null</code>. * * @param errorCode Error code to look up */ public String findErrorPage(int errorCode) 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(errorCode).toString(); }
/** * 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(); }
/** * 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(); }
/** * 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(); }
/** * 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(); }