Class ExceptionHandler
- java.lang.Object
-
- org.restlet.ext.jaxrs.internal.util.ExceptionHandler
-
@Deprecated public class ExceptionHandler extends java.lang.ObjectDeprecated.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 Summary
Fields Modifier and Type Field Description private static java.lang.StringHEADER_ALLOWDeprecated.private java.util.logging.LoggerloggerDeprecated.private RestletnoResMethodHandlerDeprecated.private RestletnoResourceClHandlerDeprecated.private RestletnoRootResClHandlerDeprecated.
-
Constructor Summary
Constructors Constructor Description ExceptionHandler(java.util.logging.Logger logger)Deprecated.Creates a new ExceptionHandler.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description javax.ws.rs.WebApplicationExceptionconvertRepresentationExc(ConvertRepresentationException cre)Deprecated.handles aConvertRepresentationExceptionRestletgetNoResMethodHandler()Deprecated.Returns the Restlet that is called, if no resource method class could be found.RestletgetNoResourceClHandler()Deprecated.Returns the Restlet that is called, if no resource class could be found.RestletgetNoRootResClHandler()Deprecated.Returns the Restlet that is called, if no root resource class could be found.private static java.util.Set<javax.ws.rs.core.Variant>getSupportedVariants(java.util.Collection<ResourceMethod> supporting)Deprecated.RequestHandledExceptioninstantiateExecption(InstantiateException exception, CallContext callContext, java.lang.String logMessage)Deprecated.Handles the given Exception, catched by an invoke of a resource method or a creation if a sub resource object.RequestHandledExceptionmethodInvokeException(MethodInvokeException exception, CallContext callContext, java.lang.String logMessage)Deprecated.Handles the given Exception, catched by an invoke of a resource method or a creation if a sub resource object.voidmethodNotAllowed(java.util.Set<Method> allowedMethods)Deprecated.RequestHandledExceptionmissingAnnotation(MissingAnnotationException exception, CallContext callContext, java.lang.String logMessage)Deprecated.Handles the given Exception, catched by an invoke of a resource method or a creation if a sub resource object.javax.ws.rs.WebApplicationExceptionnoMessageBodyWriter(java.lang.Class<? extends java.lang.Object> entityClass, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, MediaType respMediaType, SortedMetadata<MediaType> accMediaTypes)Deprecated.voidnoResourceMethodForAccMediaTypes(java.util.Collection<ResourceMethod> supporting)Deprecated.see spec, section 3.7.2, item 3(a).4javax.ws.rs.WebApplicationExceptionnotAcceptableWhileDetermineMediaType()Deprecated.see spec, section 3.8, item 6voidresourceMethodNotFound()Deprecated.Handles the case, if no resource method was found.voidresourceNotFound()Deprecated.Handles the case, if no resource class was found.voidrootResourceNotFound()Deprecated.Handles the case, if no root resource class was found.RequestHandledExceptionruntimeExecption(java.lang.RuntimeException exception, AbstractMethodWrapper jaxRsMethod, CallContext callContext, java.lang.String logMessage)Deprecated.Handles the given Exception, catched by an invoke of a resource method or a creation if a sub resource object.voidsetNoResMethodHandler(Restlet noResMethodHandler)Deprecated.Sets the Restlet that will handle theRequests, if no resource method could be found.voidsetNoResourceClHandler(Restlet noResourceClHandler)Deprecated.Sets the Restlet that will handle theRequests, if no resource class could be found.voidsetNoRootResClHandler(Restlet noRootResClHandler)Deprecated.Sets the Restlet that is called, if no root resource class could be found.voidunsupportedMediaType(java.util.Collection<ResourceMethod> accepting)Deprecated.see spec, section 3.7.2, item 3 (a) .3
-
-
-
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.
-
-
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.handles aConvertRepresentationException- 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 RestletRequestand the RestletResponse.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 RestletRequestand the RestletResponse.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
-
missingAnnotation
public RequestHandledException missingAnnotation(MissingAnnotationException 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 RestletRequestand the RestletResponse.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
-
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.WebApplicationExceptionDeprecated.- 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.WebApplicationExceptionDeprecated.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, RequestHandledExceptionDeprecated.Handles the case, if no resource method was found. If a Restlet to handle this case was given (seesetNoResMethodHandler(Restlet)), it is called. Otherwise aWebApplicationExceptionwith status 404 is thrown (see JAX-RS specification)- Throws:
javax.ws.rs.WebApplicationExceptionRequestHandledException
-
resourceNotFound
public void resourceNotFound() throws javax.ws.rs.WebApplicationException, RequestHandledExceptionDeprecated.Handles the case, if no resource class was found. If a Restlet to handle this case was given (seesetNoResourceClHandler(Restlet)), it is called. Otherwise aWebApplicationExceptionwith status 404 is thrown (see spec, section 3.7.2, item 2e)- Throws:
javax.ws.rs.WebApplicationExceptionRequestHandledException
-
rootResourceNotFound
public void rootResourceNotFound() throws javax.ws.rs.WebApplicationException, RequestHandledExceptionDeprecated.Handles the case, if no root resource class was found. If a Restlet to handle this case was given (seesetNoRootResClHandler(Restlet)), it is called. Otherwise aWebApplicationExceptionwith status 404 is thrown (see JAX-RS specification, section 3.7.2, item 1d)- Throws:
javax.ws.rs.WebApplicationExceptionRequestHandledException
-
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 logjaxRsMethod- the called method when the exception occurs. May be null.callContext- Contains the encoded template Parameters, that are read from the called URI, the RestletRequestand the RestletResponse.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
-
setNoResMethodHandler
public void setNoResMethodHandler(Restlet noResMethodHandler)
Deprecated.Sets the Restlet that will handle theRequests, if no resource method could be found.- Parameters:
noResMethodHandler- the noResMethodHandler to set- See Also:
getNoResMethodHandler(),setNoResourceClHandler(Restlet),setNoRootResClHandler(Restlet)
-
setNoResourceClHandler
public void setNoResourceClHandler(Restlet noResourceClHandler)
Deprecated.Sets the Restlet that will handle theRequests, if no resource class could be found.- Parameters:
noResourceClHandler- the noResourceClHandler to set- See Also:
getNoResourceClHandler(),setNoResMethodHandler(Restlet),setNoRootResClHandler(Restlet)
-
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
-
-