Examples of ResourceMethod


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 <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);
                    forwardTo(resourceMethod);
                    return null;
                } catch (Exception e) {
                    throw new ProxyInvocationException(e);
        }
View Full Code Here

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

  }

  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

  @Test
  public void shouldObeyPriorityOfRoutes() throws Exception {
    Route first = mock(Route.class);
    Route second = mock(Route.class);
   
    ResourceMethod method2 = second.resourceMethod(request, "second");
   
    router.add(second);
    router.add(first);

    when(first.getPriority()).thenReturn(Path.HIGH);
    when(second.getPriority()).thenReturn(Path.LOW);
   
    EnumSet<HttpMethod> get = EnumSet.of(HttpMethod.GET);
    when(first.allowedMethods()).thenReturn(get);
    when(second.allowedMethods()).thenReturn(get);
   
    when(first.canHandle(anyString())).thenReturn(false);
    when(second.canHandle(anyString())).thenReturn(true);
   
    ResourceMethod found = router.parse("anything", HttpMethod.GET, request);
    assertThat(found, is(method2));
  }
View Full Code Here

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

    when(route.canHandle("/clients/add")).thenReturn(true);
    when(route.allowedMethods()).thenReturn(EnumSet.of(HttpMethod.POST));
    when(route.resourceMethod(request, "/clients/add")).thenReturn(method);

    router.add(route);
    ResourceMethod found = router.parse("/clients/add", HttpMethod.POST, request);
   
    assertThat(found, is(equalTo(method)));
    verify(route, atLeastOnce()).getPriority();
  }
View Full Code Here

Examples of com.linkedin.restli.common.ResourceMethod

      crudBuilderClasses.put(ResourceMethod.BATCH_GET, BatchGetRequestBuilderBase.class);
    }

    for (Map.Entry<ResourceMethod, Class<?>> entry : crudBuilderClasses.entrySet())
    {
      ResourceMethod method = entry.getKey();
      if (supportedMethods.contains(method))
      {
        String methodName = RestLiToolsUtils.normalizeUnderscores(method.toString());

        JClass builderClass = getCodeModel().ref(entry.getValue()).narrow(keyClass, valueClass);
        JDefinedClass derivedBuilder;
        if (_config.isRestli2Format())
        {
View Full Code Here

Examples of com.lunatech.doclets.jax.jaxrs.model.ResourceMethod

      if (lrm.size() == 0) {
        // not expected (resource with no methods)
        break;
      }
      // All methods on same resource, so path should be same
      ResourceMethod rm = lrm.get(0);
      for (MethodParameter param : rm.getPathParameters()) {
        if (needsPathHeading) {
          open("dt");
          around("b", "Path parameters:");
          close("dt");
          needsPathHeading = false;
        }
        open("dd");
        around("b", param.getName());
        String regex = rm.getPathParamRegex(param.getName());
        if (regex != null) {
          around("tt", " (" + regex + ")");
        }
        print(" - " + param.getDoc());
        close("dd");
View Full Code Here

Examples of com.sun.jersey.server.impl.model.method.ResourceMethod

        final Matcher m = new Matcher();
        final MatchStatus s = m.match(methods, request.getMediaType(), accept);

        if (s == MatchStatus.MATCH) {
            // If there is a match choose the first method
            final ResourceMethod method = m.rmSelected;

            if (method instanceof ViewResourceMethod) {
                // Set the content type to the most acceptable
                if (!m.mSelected.isWildcardType() &&
                        !m.mSelected.isWildcardSubtype()) {
                    response.getHttpHeaders().putSingle(HttpHeaders.CONTENT_TYPE, m.mSelected);
                }

                // Allow the view to be processed by the further matching view rule
                return false;

                // TODO what about resource specific request and response filters?
                // Should the viewable rule be responsible for those declared on
                // the class
            }

            // If a sub-resource method then need to push the resource
            // (again) as as to keep in sync with the ancestor URIs
            if (isSubResource) {
                context.pushResource(resource);
                // Set the template values
                context.pushMatch(method.getTemplate(), method.getTemplate().getTemplateVariables());
            }

            if (context.isTracingEnabled()) {
                if (isSubResource) {
                    context.trace(String.format("matched sub-resource method: @Path(\"%s\") %s",
                            method.getTemplate(),
                            method.getDispatcher()));
                } else {
                    context.trace(String.format("matched resource method: %s",
                            method.getDispatcher()));
                }
            }

            // Push the response filters
            context.pushContainerResponseFilters(method.getResponseFilters());

            ContainerRequest containerRequest = context.getContainerRequest();

            // Process the request filter
            if (!method.getRequestFilters().isEmpty()) {
                for (ContainerRequestFilter f : method.getRequestFilters()) {
                    containerRequest = f.filter(containerRequest);
                    context.setContainerRequest(containerRequest);
                }
            }

            context.pushMethod(method.getAbstractResourceMethod());

            // Dispatch to the resource method
            try {
                dispatchingListener.onResourceMethod(Thread.currentThread().getId(), method.getAbstractResourceMethod());

                SecurityContext sc = containerRequest.getSecurityContext();
                if (sc instanceof SubjectSecurityContext) {
                    ((SubjectSecurityContext) sc).doAsSubject(new PrivilegedAction() {
                        @Override
                        public Object run() {
                            method.getDispatcher().dispatch(resource, context);
                            return null;
                        }
                    });
                } else {
                    method.getDispatcher().dispatch(resource, context);
                }
            } catch (RuntimeException e) {
                if (m.rmSelected.isProducesDeclared() &&
                        !m.mSelected.isWildcardType() &&
                        !m.mSelected.isWildcardSubtype()) {
View Full Code Here

Examples of com.sun.jersey.server.impl.model.method.ResourceMethod

                Errors.error(String.format("Illegal URI template for sub-resource method %s: %s",
                        method.getMethod(), ex.getMessage()));
                continue;
            }

            final ResourceMethod rm = new ResourceHttpMethod(dp, ff, p.getTemplate(), method);
            ResourceMethodMap rmm = patternMethodMap.get(p);
            if (rmm == null) {
                rmm = new ResourceMethodMap();
                patternMethodMap.put(p, rmm);
            }
View Full Code Here

Examples of com.sun.jersey.server.impl.model.method.ResourceMethod

            final AbstractResource resource,
            final List<QualitySourceMediaType> implictProduces,
            final RulesMap<UriRule> rulesMap) {
        final ResourceMethodMap rmm = new ResourceMethodMap();
        for (final AbstractResourceMethod resourceMethod : resource.getResourceMethods()) {
            ResourceMethod rm = new ResourceHttpMethod(dp, ff, resourceMethod);

            if (isValidResourceMethod(rm, rmm)) {
                rmm.put(rm);
            }
        }
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.