/** * Return allowed methods for the given {@code resource}. OPTIONS and HEAD are always returned in the result. * * @param resource Resource for which resource methods should be found. * @return Set of resource methods that can be invoked on the given resource. */ public static Set<String> getAllowedMethods(RuntimeResource resource) { boolean getFound = false; Set<String> allowedMethods = new HashSet<>(); for (ResourceMethod resourceMethod : resource.getResourceMethods()) { final String httpMethod = resourceMethod.getHttpMethod(); allowedMethods.add(httpMethod); if (!getFound && httpMethod.equals(HttpMethod.GET)) { getFound = true; } } allowedMethods.add(HttpMethod.OPTIONS); if (getFound) { allowedMethods.add(HttpMethod.HEAD); } return allowedMethods; }
/** * Return allowed methods for the given {@code resource}. OPTIONS and HEAD are always returned in the result. * * @param resource Resource for which resource methods should be found. * @return Set of resource methods that can be invoked on the given resource. */ public static Set<String> getAllowedMethods(RuntimeResource resource) { boolean getFound = false; Set<String> allowedMethods = new HashSet<>(); for (ResourceMethod resourceMethod : resource.getResourceMethods()) { final String httpMethod = resourceMethod.getHttpMethod(); allowedMethods.add(httpMethod); if (!getFound && httpMethod.equals(HttpMethod.GET)) { getFound = true; } } allowedMethods.add(HttpMethod.OPTIONS); if (getFound) { allowedMethods.add(HttpMethod.HEAD); } return allowedMethods; }
private void checkMethods(RuntimeResource resource) { final List<ResourceMethod> resourceMethods = new ArrayList<>(resource.getResourceMethods()); resourceMethods.addAll(resource.getResourceLocators()); if (resourceMethods.size() >= 2) { for (ResourceMethod m1 : resourceMethods.subList(0, resourceMethods.size() - 1)) { for (ResourceMethod m2 : resourceMethods.subList(resourceMethods.indexOf(m1) + 1, resourceMethods.size())) { if (m1.getHttpMethod() == null && m2.getHttpMethod() == null) { Errors.error(this, LocalizationMessages.AMBIGUOUS_SRLS_PATH_PATTERN(resource.getFullPathRegex()), Severity.FATAL); } else if (m1.getHttpMethod() != null && m2.getHttpMethod() != null && sameHttpMethod(m1, m2)) { checkIntersectingMediaTypes(resource, m1.getHttpMethod(), m1, m2); } } } } }
private void checkMethods(RuntimeResource resource) { final List<ResourceMethod> resourceMethods = new ArrayList<>(resource.getResourceMethods()); resourceMethods.addAll(resource.getResourceLocators()); if (resourceMethods.size() >= 2) { for (ResourceMethod m1 : resourceMethods.subList(0, resourceMethods.size() - 1)) { for (ResourceMethod m2 : resourceMethods.subList(resourceMethods.indexOf(m1) + 1, resourceMethods.size())) { if (m1.getHttpMethod() == null && m2.getHttpMethod() == null) { Errors.error(this, LocalizationMessages.AMBIGUOUS_SRLS_PATH_PATTERN(resource.getFullPathRegex()), Severity.FATAL); } else if (m1.getHttpMethod() != null && m2.getHttpMethod() != null && sameHttpMethod(m1, m2)) { checkIntersectingMediaTypes(resource, m1.getHttpMethod(), m1, m2); } } } } }
final Set<MediaType> produces = new HashSet<>(method.produces); for (ResourceMethod resourceMethod : resource.getResourceMethods()) { for (final MediaType produce : method.produces) { if (ModelProcessorUtil.isMethodOverridden(
final Set<MediaType> produces = new HashSet<>(method.produces); for (ResourceMethod resourceMethod : resource.getResourceMethods()) { for (final MediaType produce : method.produces) { if (ModelProcessorUtil.isMethodOverridden(
/** * Return allowed methods for the given {@code resource}. OPTIONS and HEAD are always returned in the result. * * @param resource Resource for which resource methods should be found. * @return Set of resource methods that can be invoked on the given resource. */ public static Set<String> getAllowedMethods(RuntimeResource resource) { boolean getFound = false; Set<String> allowedMethods = new HashSet<>(); for (ResourceMethod resourceMethod : resource.getResourceMethods()) { final String httpMethod = resourceMethod.getHttpMethod(); allowedMethods.add(httpMethod); if (!getFound && httpMethod.equals(HttpMethod.GET)) { getFound = true; } } allowedMethods.add(HttpMethod.OPTIONS); if (getFound) { allowedMethods.add(HttpMethod.HEAD); } return allowedMethods; }
if (!resource.getResourceMethods().isEmpty()) { final List<MethodRouting> methodRoutings = createResourceMethodRouters(resource, subResourceMode); final Router methodSelectingRouter = new MethodSelectingRouter(messageBodyWorkers, methodRoutings); if (!childResource.getResourceMethods().isEmpty()) { final List<MethodRouting> childMethodRoutings = createResourceMethodRouters(childResource, subResourceMode);
if (!resource.getResourceMethods().isEmpty()) { final List<MethodRouting> methodRoutings = createResourceMethodRouters(resource, subResourceMode); final Router methodSelectingRouter = new MethodSelectingRouter(messageBodyWorkers, methodRoutings); if (!childResource.getResourceMethods().isEmpty()) { final List<MethodRouting> childMethodRoutings = createResourceMethodRouters(childResource, subResourceMode);
private void checkMethods(RuntimeResource resource) { final List<ResourceMethod> resourceMethods = new ArrayList<>(resource.getResourceMethods()); resourceMethods.addAll(resource.getResourceLocators()); if (resourceMethods.size() >= 2) { for (ResourceMethod m1 : resourceMethods.subList(0, resourceMethods.size() - 1)) { for (ResourceMethod m2 : resourceMethods.subList(resourceMethods.indexOf(m1) + 1, resourceMethods.size())) { if (m1.getHttpMethod() == null && m2.getHttpMethod() == null) { Errors.error(this, LocalizationMessages.AMBIGUOUS_SRLS_PATH_PATTERN(resource.getFullPathRegex()), Severity.FATAL); } else if (m1.getHttpMethod() != null && m2.getHttpMethod() != null && sameHttpMethod(m1, m2)) { checkIntersectingMediaTypes(resource, m1.getHttpMethod(), m1, m2); } } } } }
final Set<MediaType> produces = new HashSet<>(method.produces); for (ResourceMethod resourceMethod : resource.getResourceMethods()) { for (final MediaType produce : method.produces) { if (ModelProcessorUtil.isMethodOverridden(
@Override public List<JaxRsMethod> getMethods() { return FluentIterable.from(runtimeResource.getResourceMethods()) .transform(new Function<ResourceMethod, JaxRsMethod>() { @Nullable @Override public JaxRsMethod apply(@Nullable ResourceMethod resourceMethod) { return ourMethodOf(resourceMethod, sourceParser); } }).toList(); }
@Override public List<JaxRsMethod> getMethods() { return FluentIterable.from(runtimeResource.getResourceMethods()) .transform(new Function<ResourceMethod, JaxRsMethod>() { @Nullable @Override public JaxRsMethod apply(@Nullable ResourceMethod resourceMethod) { return ourMethodOf(resourceMethod, sourceParser); } }).toList(); }
@Override public List<JaxRsMethod> getMethods() { return FluentIterable.from(runtimeResource.getResourceMethods()) .transform(new Function<ResourceMethod, JaxRsMethod>() { @Nullable @Override public JaxRsMethod apply(@Nullable ResourceMethod resourceMethod) { return ourMethodOf(resourceMethod, sourceParser); } }).toList(); }
/** * Return allowed methods for the given {@code resource}. OPTIONS and HEAD are always returned in the result. * * @param resource Resource for which resource methods should be found. * @return Set of resource methods that can be invoked on the given resource. */ public static Set<String> getAllowedMethods(RuntimeResource resource) { boolean getFound = false; Set<String> allowedMethods = Sets.newHashSet(); for (ResourceMethod resourceMethod : resource.getResourceMethods()) { final String httpMethod = resourceMethod.getHttpMethod(); allowedMethods.add(httpMethod); if (!getFound && httpMethod.equals(HttpMethod.GET)) { getFound = true; } } allowedMethods.add(HttpMethod.OPTIONS); if (getFound) { allowedMethods.add(HttpMethod.HEAD); } return allowedMethods; }
if (!resource.getResourceMethods().isEmpty()) { final List<MethodRouting> methodRoutings = createResourceMethodRouters(resource, subResourceMode); final Router methodSelectingRouter = new MethodSelectingRouter(messageBodyWorkers, methodRoutings); if (!childResource.getResourceMethods().isEmpty()) { final List<MethodRouting> childMethodRoutings = createResourceMethodRouters(childResource, subResourceMode);
private void checkMethods(RuntimeResource resource) { final List<ResourceMethod> resourceMethods = new ArrayList<>(resource.getResourceMethods()); resourceMethods.addAll(resource.getResourceLocators()); if (resourceMethods.size() >= 2) { for (ResourceMethod m1 : resourceMethods.subList(0, resourceMethods.size() - 1)) { for (ResourceMethod m2 : resourceMethods.subList(resourceMethods.indexOf(m1) + 1, resourceMethods.size())) { if (m1.getHttpMethod() == null && m2.getHttpMethod() == null) { Errors.error(this, LocalizationMessages.AMBIGUOUS_SRLS_PATH_PATTERN(resource.getFullPathRegex()), Severity.FATAL); } else if (m1.getHttpMethod() != null && m2.getHttpMethod() != null && sameHttpMethod(m1, m2)) { checkIntersectingMediaTypes(resource, m1.getHttpMethod(), m1, m2); } } } } }
private void checkMethods(RuntimeResource resource) { final List<ResourceMethod> resourceMethods = Lists.newArrayList(resource.getResourceMethods()); resourceMethods.addAll(resource.getResourceLocators()); if (resourceMethods.size() >= 2) { for (ResourceMethod m1 : resourceMethods.subList(0, resourceMethods.size() - 1)) { for (ResourceMethod m2 : resourceMethods.subList(resourceMethods.indexOf(m1) + 1, resourceMethods.size())) { if (m1.getHttpMethod() == null && m2.getHttpMethod() == null) { Errors.error(this, LocalizationMessages.AMBIGUOUS_SRLS_PATH_PATTERN(resource.getFullPathRegex()), Severity.FATAL); } else if (m1.getHttpMethod() != null && m2.getHttpMethod() != null && sameHttpMethod(m1, m2)) { checkIntersectingMediaTypes(resource, m1.getHttpMethod(), m1, m2); } } } } }
private void checkMethods(RuntimeResource resource) { final List<ResourceMethod> resourceMethods = Lists.newArrayList(resource.getResourceMethods()); resourceMethods.addAll(resource.getResourceLocators()); if (resourceMethods.size() >= 2) { for (ResourceMethod m1 : resourceMethods.subList(0, resourceMethods.size() - 1)) { for (ResourceMethod m2 : resourceMethods.subList(resourceMethods.indexOf(m1) + 1, resourceMethods.size())) { if (m1.getHttpMethod() == null && m2.getHttpMethod() == null) { Errors.error(this, LocalizationMessages.AMBIGUOUS_SRLS_PATH_PATTERN(resource.getFullPathRegex()), Severity.FATAL); } else if (m1.getHttpMethod() != null && m2.getHttpMethod() != null && sameHttpMethod(m1, m2)) { checkIntersectingMediaTypes(resource, m1.getHttpMethod(), m1, m2); } } } } }
private void checkMethods(RuntimeResource resource) { final List<ResourceMethod> resourceMethods = Lists.newArrayList(resource.getResourceMethods()); resourceMethods.addAll(resource.getResourceLocators()); if (resourceMethods.size() >= 2) { for (ResourceMethod m1 : resourceMethods.subList(0, resourceMethods.size() - 1)) { for (ResourceMethod m2 : resourceMethods.subList(resourceMethods.indexOf(m1) + 1, resourceMethods.size())) { if (m1.getHttpMethod() == null && m2.getHttpMethod() == null) { Errors.error(this, LocalizationMessages.AMBIGUOUS_SRLS_PATH_PATTERN(resource.getFullPathRegex()), Severity.FATAL); } else if (m1.getHttpMethod() != null && m2.getHttpMethod() != null && sameHttpMethod(m1, m2)) { checkIntersectingMediaTypes(resource, m1.getHttpMethod(), m1, m2); } } } } }