Class ExceptionHandler


  • @Deprecated
    public class ExceptionHandler
    extends java.lang.Object
    Deprecated.
    Will be removed in next minor release.

    This class contains the methods to handle exceptions occuring in the JaxRsRestlet, e.g. while identifying the method that should handle the request.
    Therefor it contains some Restlets that handles this exceptions.

    Perhaps this class gets again public. Perhaps the special Restlets for handling will be removed, or stay only for 404.

    • Field Detail

      • HEADER_ALLOW

        private static final java.lang.String HEADER_ALLOW
        Deprecated.
        See Also:
        Constant Field Values
      • logger

        private final java.util.logging.Logger logger
        Deprecated.
      • noResMethodHandler

        private volatile Restlet noResMethodHandler
        Deprecated.
      • noResourceClHandler

        private volatile Restlet noResourceClHandler
        Deprecated.
      • noRootResClHandler

        private volatile Restlet noRootResClHandler
        Deprecated.
    • Constructor Detail

      • ExceptionHandler

        public ExceptionHandler​(java.util.logging.Logger logger)
        Deprecated.
        Creates a new ExceptionHandler.
        Parameters:
        logger - the logger to use
    • Method Detail

      • getSupportedVariants

        private static java.util.Set<javax.ws.rs.core.Variant> getSupportedVariants​(java.util.Collection<ResourceMethod> supporting)
        Deprecated.
        Parameters:
        supporting -
        Returns:
      • convertRepresentationExc

        public javax.ws.rs.WebApplicationException convertRepresentationExc​(ConvertRepresentationException cre)
                                                                     throws javax.ws.rs.WebApplicationException
        Deprecated.
        Parameters:
        cre -
        Returns:
        (static the thrown exeption for the compiler)
        Throws:
        javax.ws.rs.WebApplicationException
      • getNoResMethodHandler

        public Restlet getNoResMethodHandler()
        Deprecated.
        Returns the Restlet that is called, if no resource method class could be found.
        Returns:
        the Restlet that is called, if no resource method class could be found.
        See Also:
        setNoResMethodHandler(Restlet)
      • getNoResourceClHandler

        public Restlet getNoResourceClHandler()
        Deprecated.
        Returns the Restlet that is called, if no resource class could be found.
        Returns:
        the Restlet that is called, if no resource class could be found.
      • getNoRootResClHandler

        public Restlet getNoRootResClHandler()
        Deprecated.
        Returns the Restlet that is called, if no root resource class could be found.
        Returns:
        the Restlet that is called, if no root resource class could be found.
        See Also:
        setNoRootResClHandler(Restlet)
      • instantiateExecption

        public RequestHandledException instantiateExecption​(InstantiateException exception,
                                                            CallContext callContext,
                                                            java.lang.String logMessage)
                                                     throws RequestHandledException
        Deprecated.
        Handles the given Exception, catched by an invoke of a resource method or a creation if a sub resource object.
        Parameters:
        exception -
        callContext - Contains the encoded template Parameters, that are read from the called URI, the Restlet Request and the Restlet Response.
        methodName -
        logMessage -
        Returns:
        staticly to throw, if needed by compiler.
        Throws:
        RequestHandledException - throws this message to exit the method and indicate, that the request was handled.
        RequestHandledException
      • methodInvokeException

        public RequestHandledException methodInvokeException​(MethodInvokeException exception,
                                                             CallContext callContext,
                                                             java.lang.String logMessage)
                                                      throws RequestHandledException
        Deprecated.
        Handles the given Exception, catched by an invoke of a resource method or a creation if a sub resource object.
        Parameters:
        exception -
        callContext - Contains the encoded template Parameters, that are read from the called URI, the Restlet Request and the Restlet Response.
        methodName -
        logMessage -
        Returns:
        staticly to throw, if needed by compiler.
        Throws:
        RequestHandledException - throws this message to exit the method and indicate, that the request was handled.
        RequestHandledException
      • methodNotAllowed

        public void methodNotAllowed​(java.util.Set<Method> allowedMethods)
                              throws javax.ws.rs.WebApplicationException
        Deprecated.
        Parameters:
        allowedMethods -
        Throws:
        javax.ws.rs.WebApplicationException
      • noMessageBodyWriter

        public javax.ws.rs.WebApplicationException noMessageBodyWriter​(java.lang.Class<? extends java.lang.Object> entityClass,
                                                                       java.lang.reflect.Type genericType,
                                                                       java.lang.annotation.Annotation[] annotations,
                                                                       MediaType respMediaType,
                                                                       SortedMetadata<MediaType> accMediaTypes)
                                                                throws javax.ws.rs.WebApplicationException
        Deprecated.
        Parameters:
        entityClass -
        genericType -
        annotations -
        respMediaType -
        accMediaTypes -
        Returns:
        (static the thrown exeption for the compiler)
        Throws:
        javax.ws.rs.WebApplicationException - the exception to throw according to the JAX-RS specification.
      • noResourceMethodForAccMediaTypes

        public void noResourceMethodForAccMediaTypes​(java.util.Collection<ResourceMethod> supporting)
                                              throws javax.ws.rs.WebApplicationException
        Deprecated.
        see spec, section 3.7.2, item 3(a).4
        Parameters:
        supporting - the methods supporting the requested resource and the given HTTP method.
        Throws:
        javax.ws.rs.WebApplicationException
      • notAcceptableWhileDetermineMediaType

        public javax.ws.rs.WebApplicationException notAcceptableWhileDetermineMediaType()
                                                                                 throws javax.ws.rs.WebApplicationException
        Deprecated.
        see spec, section 3.8, item 6
        Returns:
        staticly to throw, if needed by compiler.
        Throws:
        javax.ws.rs.WebApplicationException
      • resourceMethodNotFound

        public void resourceMethodNotFound()
                                    throws javax.ws.rs.WebApplicationException,
                                           RequestHandledException
        Deprecated.
        Handles the case, if no resource method was found. If a Restlet to handle this case was given (see setNoResMethodHandler(Restlet)), it is called. Otherwise a WebApplicationException with status 404 is thrown (see JAX-RS specification)
        Throws:
        javax.ws.rs.WebApplicationException
        RequestHandledException
      • resourceNotFound

        public void resourceNotFound()
                              throws javax.ws.rs.WebApplicationException,
                                     RequestHandledException
        Deprecated.
        Handles the case, if no resource class was found. If a Restlet to handle this case was given (see setNoResourceClHandler(Restlet)), it is called. Otherwise a WebApplicationException with status 404 is thrown (see spec, section 3.7.2, item 2e)
        Throws:
        javax.ws.rs.WebApplicationException
        RequestHandledException
      • rootResourceNotFound

        public void rootResourceNotFound()
                                  throws javax.ws.rs.WebApplicationException,
                                         RequestHandledException
        Deprecated.
        Handles the case, if no root resource class was found. If a Restlet to handle this case was given (see setNoRootResClHandler(Restlet)), it is called. Otherwise a WebApplicationException with status 404 is thrown (see JAX-RS specification, section 3.7.2, item 1d)
        Throws:
        javax.ws.rs.WebApplicationException
        RequestHandledException
      • runtimeExecption

        public RequestHandledException runtimeExecption​(java.lang.RuntimeException exception,
                                                        AbstractMethodWrapper jaxRsMethod,
                                                        CallContext callContext,
                                                        java.lang.String logMessage)
                                                 throws RequestHandledException
        Deprecated.
        Handles the given Exception, catched by an invoke of a resource method or a creation if a sub resource object.
        Parameters:
        exception - the exception to log
        jaxRsMethod - the called method when the exception occurs. May be null.
        callContext - Contains the encoded template Parameters, that are read from the called URI, the Restlet Request and the Restlet Response.
        logMessage -
        methodName -
        Returns:
        staticly to throw, if needed by compiler.
        Throws:
        RequestHandledException - throws this message to exit the method and indicate, that the request was handled.
        RequestHandledException
      • setNoRootResClHandler

        public void setNoRootResClHandler​(Restlet noRootResClHandler)
        Deprecated.
        Sets the Restlet that is called, if no root resource class could be found.
        Parameters:
        noRootResClHandler - the Restlet to call, if no root resource class could be found.
        See Also:
        #getNoRootResClHandler(Restlet), #setNoResourceClHandler(), setNoResMethodHandler(Restlet)
      • unsupportedMediaType

        public void unsupportedMediaType​(java.util.Collection<ResourceMethod> accepting)
                                  throws javax.ws.rs.WebApplicationException
        Deprecated.
        see spec, section 3.7.2, item 3 (a) .3
        Parameters:
        accepting - resource methods for the requested resource and the given HTTP method.
        Throws:
        javax.ws.rs.WebApplicationException