Examples of ExceptionMapper


Examples of javax.ws.rs.ext.ExceptionMapper

    }
   
    @SuppressWarnings("unchecked")
    public static Response convertFaultToResponse(Throwable ex, Message inMessage) {
       
        ExceptionMapper mapper =
            ProviderFactory.getInstance(inMessage).createExceptionMapper(ex.getClass(), inMessage);
        if (mapper != null) {
            try {
                return mapper.toResponse(ex);
            } catch (Exception mapperEx) {
                mapperEx.printStackTrace();
                return Response.serverError().build();
            }
        }
View Full Code Here

Examples of javax.ws.rs.ext.ExceptionMapper

      return null;
   }

   public void addExceptionMapper(Class<? extends ExceptionMapper> provider)
   {
      ExceptionMapper writer = null;
      try
      {
         writer = provider.newInstance();
      }
      catch (InstantiationException e)
View Full Code Here

Examples of javax.ws.rs.ext.ExceptionMapper

    * @param exception
    * @return true if an ExceptionMapper was found and executed
    */
   public boolean executeExceptionMapper(HttpResponse response, Throwable exception)
   {
      ExceptionMapper mapper = null;

      Class causeClass = exception.getClass();
      while (mapper == null)
      {
         if (causeClass == null) break;
         mapper = providerFactory.getExceptionMapper(causeClass);
         if (mapper == null) causeClass = causeClass.getSuperclass();
      }
      if (mapper != null)
      {
         writeFailure(response, mapper.toResponse(exception));
         return true;
      }
      return false;
   }
View Full Code Here

Examples of javax.ws.rs.ext.ExceptionMapper

      return null;
   }

   public void addExceptionMapper(Class<? extends ExceptionMapper> provider)
   {
      ExceptionMapper writer = getProviderInstance(provider);
      addExceptionMapper(writer);
   }
View Full Code Here

Examples of javax.ws.rs.ext.ExceptionMapper

    * @param exception
    * @return true if an ExceptionMapper was found and executed
    */
   public boolean executeExceptionMapper(HttpResponse response, Throwable exception)
   {
      ExceptionMapper mapper = null;

      Class causeClass = exception.getClass();
      while (mapper == null)
      {
         if (causeClass == null) break;
         mapper = providerFactory.getExceptionMapper(causeClass);
         if (mapper == null) causeClass = causeClass.getSuperclass();
      }
      if (mapper != null)
      {
         writeFailure(response, mapper.toResponse(exception));
         return true;
      }
      return false;
   }
View Full Code Here

Examples of javax.ws.rs.ext.ExceptionMapper

    }
   
    @SuppressWarnings("unchecked")
    public static Response convertFaultToResponse(Throwable ex, Message inMessage) {
       
        ExceptionMapper mapper =
            ProviderFactory.getInstance(inMessage).createExceptionMapper(ex.getClass(), inMessage);
        if (mapper != null) {
            try {
                return mapper.toResponse(ex);
            } catch (Exception mapperEx) {
                mapperEx.printStackTrace();
                return Response.serverError().build();
            }
        }
View Full Code Here

Examples of javax.ws.rs.ext.ExceptionMapper

    if (!Exception.class.isAssignableFrom(clazz)) {
      return null;
    }
    Class<?> checkedClass = clazz;
    while (true) {
      ExceptionMapper exceptionMapper = getExceptionMapperForExactType(
          checkedClass);
      if (exceptionMapper != null) {
        return exceptionMapper;
      }
      if (checkedClass == Throwable.class) {
View Full Code Here

Examples of javax.ws.rs.ext.ExceptionMapper

        return;
      } catch (IOException ex1) {
        logger.info("Exception processing response from WebApplicationException", ex1);
      }
    }
    ExceptionMapper exMapper = providers.getExceptionMapper(exception.getClass());
    if (exMapper != null) {
      logger.info("Exception with exception mapper", exception);
      javax.ws.rs.core.Response jaxResponse;
      try {
        jaxResponse = exMapper.toResponse(exception);
      } catch (Exception ex1) {
        /*
         * Return a server error (status code 500) response to
         * the client
         */
 
View Full Code Here

Examples of javax.ws.rs.ext.ExceptionMapper

    }
   
    @SuppressWarnings("unchecked")
    public static Response convertFaultToResponse(Throwable ex, Message inMessage) {
       
        ExceptionMapper mapper =
            ProviderFactory.getInstance(inMessage).createExceptionMapper(ex.getClass(), inMessage);
        if (mapper != null) {
            try {
                return mapper.toResponse(ex);
            } catch (Exception mapperEx) {
                mapperEx.printStackTrace();
                return Response.serverError().build();
            }
        }
View Full Code Here

Examples of javax.ws.rs.ext.ExceptionMapper

    }
   
    @SuppressWarnings("unchecked")
    public static Response convertFaultToResponse(Throwable ex, Message inMessage) {
       
        ExceptionMapper mapper =
            ProviderFactory.getInstance(inMessage).createExceptionMapper(ex.getClass(), inMessage);
        if (mapper != null) {
            try {
                return mapper.toResponse(ex);
            } catch (Exception mapperEx) {
                mapperEx.printStackTrace();
                return Response.serverError().build();
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.