Examples of ResourceMethod


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

  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

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

  public <T> String urlFor(Class<T> type, Method method, Object... params) {
    Iterator<Route> matches = Iterators.filter(routes.iterator(), Filters.canHandle(type, method));
    if (matches.hasNext()) {
      try {
        ResourceMethod resourceMethod = DefaultResourceMethod.instanceFor(type, method);
        return matches.next().urlFor(type, method, creator.instanceWithParameters(resourceMethod, params));
      } catch (Exception e) {
        throw new VRaptorException("The selected route is invalid for redirection: " + type.getName() + "."
            + method.getName(), e);
      }
View Full Code Here

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

  public <T> String urlFor(Class<T> type, Method method, Object... params) {
    Iterator<Route> matches = Iterators.filter(routes.iterator(), Filters.canHandle(type, method));
    if (matches.hasNext()) {
      try {
        ResourceMethod resourceMethod = DefaultResourceMethod.instanceFor(type, method);
        return matches.next().urlFor(type, method, creator.instanceWithParameters(resourceMethod, params));
      } catch (Exception e) {
        throw new VRaptorException("The selected route is invalid for redirection: " + type.getName() + "."
            + method.getName(), e);
      }
View Full Code Here

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

  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

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

  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

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

    return proxifier.proxify(type, handler);
  }

  public void is(Class<?> type, Method method) {
    addParametersInfo(method);
    ResourceMethod resourceMethod = DefaultResourceMethod.instanceFor(type, method);
    String[] parameterNames = nameProvider.parameterNamesFor(method);
    this.strategy = new FixedMethodStrategy(originalUri, resourceMethod, this.supportedMethods, builder.build(), priority, parameterNames);

    logger.info(String.format("%-50s%s -> %10s", originalUri,
        this.supportedMethods.isEmpty() ? "[ALL]" : this.supportedMethods,
View Full Code Here

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

  public String getControllerAndMethodName() {
    Field resourceMethodField = new Mirror().on(FixedMethodStrategy.class).reflect().field("resourceMethod");
    resourceMethodField.setAccessible(true);
    try {
      ResourceMethod resourceMethod = (ResourceMethod) resourceMethodField.get(route);
      return resourceMethod.getMethod().toString();
    } catch (Exception e) {
      return "Unknown: " + e.getMessage();
    }
  }
View Full Code Here

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

  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

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()).forwardTo(referer);
    } catch (MethodNotAllowedException e) {
      result.use(page()).forwardTo(referer);
    }
View Full Code Here

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

  }

  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
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.