Package br.com.caelum.vraptor

Examples of br.com.caelum.vraptor.InterceptionException


    try {
      if (!"OPTIONS".equalsIgnoreCase(request.getRequest().getMethod())) {
        request.getResponse().sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
      }
    } catch (IOException e) {
      throw new InterceptionException(e);
    }
  }
View Full Code Here


      Object returnObject = new Mirror().on(interceptor).invoke().method(stepMethod).withArgs(params);
      return returnObject;
    } catch (MirrorException e) {
      // we dont wanna wrap it if it is a simple controller business logic exception
      Throwables.propagateIfInstanceOf(e.getCause(), ApplicationLogicException.class);
      throw new InterceptionException(e.getCause());
    }
  }
View Full Code Here

  public void couldntFind(RequestInfo request) {
    FilterChain chain = request.getChain();
    try {
      chain.doFilter(request.getRequest(), request.getResponse());
    } catch (IOException e) {
      throw new InterceptionException(e);
    } catch (ServletException e) {
      throw new InterceptionException(e);
    }
  }
View Full Code Here

        }
      }

      stack.next(method, controllerInstance);
    } catch (IOException e) {
      throw new InterceptionException(e);
    }

  }
View Full Code Here

  public void couldntFind(RequestInfo request) {
    FilterChain chain = request.getChain();
    try {
      chain.doFilter(request.getRequest(), request.getResponse());
    } catch (IOException e) {
      throw new InterceptionException(e);
    } catch (ServletException e) {
      throw new InterceptionException(e);
    }
  }
View Full Code Here

    try {
      if (!"OPTIONS".equalsIgnoreCase(request.getRequest().getMethod())) {
        request.getResponse().sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
      }
    } catch (IOException e) {
      throw new InterceptionException(e);
    }
  }
View Full Code Here

      throws InterceptionException {
    boolean accepts;
    try {
      accepts = getAcceptor().accepts(method);
    } catch (NullPointerException e) {
      throw new InterceptionException("StaticInterceptors should not use constructor parameters inside the accepts method", e);
    }
    if (accepts) {
      Interceptor interceptor = container.instanceFor(type);
      if (interceptor == null) {
        throw new InterceptionException("Unable to instantiate interceptor for " + type.getName()
            + ": the container returned null.");
      }
      logger.debug("Invoking interceptor {}", interceptor.getClass().getSimpleName());
      interceptor.intercept(stack, method, resourceInstance);
    } else {
View Full Code Here

        Constructor<?> constructor = type.getDeclaredConstructors()[0];
        int argsLength = constructor.getParameterTypes().length;
        acceptor = type.cast(new Mirror().on(type).invoke().constructor(constructor).withArgs(new Object[argsLength]));
      } catch (MirrorException e) {
        if (e.getCause() instanceof NullPointerException) {
          throw new InterceptionException("StaticInterceptors should not use constructor parameters inside the constructor", e);
        } else {
          throw new InterceptionException(e);
        }
      }
    }
    return acceptor;
  }
View Full Code Here

  public void execute(InterceptorStack stack, ResourceMethod method, Object resourceInstance)
      throws InterceptionException {
    Interceptor interceptor = container.instanceFor(type);
    if (interceptor == null) {
      throw new InterceptionException("Unable to instantiate interceptor for " + type.getName()
          + ": the container returned null.");
    }
    if (interceptor.accepts(method)) {
      logger.debug("Invoking interceptor {}", interceptor.getClass().getSimpleName());
      interceptor.intercept(stack, method, resourceInstance);
View Full Code Here

    boolean hasAfterMethod = hasAnnotatedMethod(AfterCall.class, originalType, methods);
    boolean hasAroundMethod = hasAnnotatedMethod(AroundCall.class, originalType, methods);
    boolean hasBeforeMethod = hasAnnotatedMethod(BeforeCall.class, originalType, methods);

    if (!hasAfterMethod && !hasAroundMethod && !hasBeforeMethod) {
      throw new InterceptionException(format("Interceptor %s must "
        + "declare at least one method whith @AfterCall, @AroundCall "
        + "or @BeforeCall annotation", originalType.getCanonicalName()));
    }
  }
View Full Code Here

TOP

Related Classes of br.com.caelum.vraptor.InterceptionException

Copyright © 2018 www.massapicom. 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.