Package br.com.caelum.vraptor.resource

Examples of br.com.caelum.vraptor.resource.ResourceMethod


  public void forward() throws IllegalStateException {
    String referer = getReferer();

    try {
      ResourceMethod method = router.parse(referer, HttpMethod.GET, request);
      executeMethod(method, result.use(logic()).forwardTo(method.getResource().getType()));
    } catch (ResourceNotFoundException e) {
      result.use(page()).forward(referer);
    } catch (MethodNotAllowedException e) {
      result.use(page()).forward(referer);
    }
View Full Code Here


  }

  public void redirect() throws IllegalStateException {
    String referer = getReferer();
    try {
      ResourceMethod method = router.parse(referer, HttpMethod.GET, request);
      executeMethod(method, result.use(logic()).redirectTo(method.getResource().getType()));
    } catch (ResourceNotFoundException e) {
      result.use(page()).redirect(referer);
    } catch (MethodNotAllowedException e) {
      result.use(page()).redirect(referer);
    }
View Full Code Here

  public ResourceMethod translate(RequestInfo info) {
    MutableRequest request = info.getRequest();
    String resourceName = info.getRequestedUri();

    logger.debug("trying to access {}", resourceName);
    ResourceMethod resource = router.parse(resourceName, HttpMethod.of(request), request);

    logger.debug("found resource {}", resource);
    return resource;
  }
View Full Code Here

  public <T> T of(final Class<T> controllerType) {
    return proxifier.proxify(controllerType, new MethodInvocation<T>() {
            public Object intercept(T proxy, Method method, Object[] args, SuperMethod superMethod) {
                try {
                    ResourceMethod resourceMethod = DefaultResourceMethod.instanceFor(controllerType, method);
                    forward(resourceMethod);
                    return null;
                } catch (Exception e) {
                    throw new ProxyInvocationException(e);
        }
View Full Code Here

  public void forward() throws IllegalStateException {
    String referer = getReferer();

    try {
      ResourceMethod method = router.parse(referer, HttpMethod.GET, request);
      executeMethod(method, result.use(logic()).forwardTo(method.getResource().getType()));
    } catch (ResourceNotFoundException e) {
      result.use(page()).forward(referer);
    } catch (MethodNotAllowedException e) {
      result.use(page()).forward(referer);
    }
View Full Code Here

  }

  public void redirect() throws IllegalStateException {
    String referer = getReferer();
    try {
      ResourceMethod method = router.parse(referer, HttpMethod.GET, request);
      executeMethod(method, result.use(logic()).redirectTo(method.getResource().getType()));
    } catch (ResourceNotFoundException e) {
      result.use(page()).redirect(referer);
    } catch (MethodNotAllowedException e) {
      result.use(page()).redirect(referer);
    }
View Full Code Here

  public <T> T forwardTo(final Class<T> type) {
    return proxifier.proxify(type, new MethodInvocation<T>() {
      public Object intercept(T proxy, Method method, Object[] args, SuperMethod superMethod) {
        try {
          logger.debug("Executing {}", Stringnifier.simpleNameFor(method));
          ResourceMethod old = methodInfo.getResourceMethod();
          methodInfo.setResourceMethod(DefaultResourceMethod.instanceFor(type, method));
          Object result = method.invoke(container.instanceFor(type), args);
          methodInfo.setResourceMethod(old);

          Type returnType = method.getGenericReturnType();
View Full Code Here

  public void forward() throws IllegalStateException {
    String referer = getReferer();

    try {
      ResourceMethod method = router.parse(referer, HttpMethod.GET, request);
      executeMethod(method, result.use(logic()).forwardTo(method.getResource().getType()));
    } catch (ResourceNotFoundException e) {
      result.use(page()).forwardTo(referer);
    } catch (MethodNotAllowedException e) {
      result.use(page()).forwardTo(referer);
    }
View Full Code Here

  }

  public void redirect() throws IllegalStateException {
    String referer = getReferer();
    try {
      ResourceMethod method = router.parse(referer, HttpMethod.GET, request);
      executeMethod(method, result.use(logic()).redirectTo(method.getResource().getType()));
    } catch (ResourceNotFoundException e) {
      result.use(page()).redirectTo(referer);
    } catch (MethodNotAllowedException e) {
      result.use(page()).redirectTo(referer);
    }
View Full Code Here

  public void intercept(InterceptorStack stack, ResourceMethod ignorableMethod, Object resourceInstance)
      throws InterceptionException {

    try {
      ResourceMethod method = translator.translate(requestInfo);

      methodInfo.setResourceMethod(method);
      stack.next(method, resourceInstance);
    } catch (ResourceNotFoundException e) {
      resourceNotFoundHandler.couldntFind(requestInfo);
View Full Code Here

TOP

Related Classes of br.com.caelum.vraptor.resource.ResourceMethod

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.