private boolean providesOpenSearch(MethodMetadata method) { if (method.getHttpMethod().equals(HttpMethod.GET) && method.getProduces() .equals(MediaTypeUtils.OPENSEARCH_TYPE)) { return true; } return false; } }
private static Set<MediaType> getProducedTypesForGet(List<MethodMetadata> methods) { Set<MediaType> getResponses = new LinkedHashSet<MediaType>(); if (methods != null) { for (MethodMetadata methodRecord : methods) { if (methodRecord.getHttpMethod().equals(HttpMethod.GET)) { getResponses.addAll(methodRecord.getProduces()); } } } return getResponses; }
private static Set<MediaType> getCollectionConsumes(ClassMetadata metadata) { Set<MediaType> consumes = new HashSet<MediaType>(); for (MethodMetadata method : metadata.getResourceMethods()) { if (method.getHttpMethod().equals(HttpMethod.POST)) { consumes.addAll(method.getConsumes()); } } for (MethodMetadata method : metadata.getSubResourceMethods()) { if (method.getHttpMethod().equals(HttpMethod.POST)) { consumes.addAll(method.getConsumes()); } } return consumes; }
/** * Checks if the method record matches the http method of the request * * @param record the method record to check * @param context the context of the current request * @return true if the method should be filtered, false otherwise */ private boolean filterByHttpMethod(MethodRecord record, RuntimeContext context) { String httpMethod = context.getRequest().getMethod(); String recordHttpMethod = record.getMetadata().getHttpMethod(); // non existing http method (with a path on the method), // then it's a sub-resource locator and it's ok if (recordHttpMethod == null) { return false; } // the http method is different than the request http method, // then the resource method should be filtered if (!recordHttpMethod.equals(httpMethod)) { return true; } return false; }
String httpMethod = methodMetadata.getHttpMethod(); if (path != null) {
AtomConstants.ATOM_REL_EDIT) == null) { for (MethodMetadata methodRecord : methods) { String httpMethod = methodRecord.getHttpMethod(); if (httpMethod.equalsIgnoreCase(HttpMethod.PUT) || httpMethod .equalsIgnoreCase(HttpMethod.DELETE)) {
/* package */Method buildMethod(ClassMetadata classMetadata, MethodMetadata metadata) { Method m = new Method(); m.setName(metadata.getHttpMethod()); java.lang.reflect.Method reflMethod = metadata.getReflectionMethod(); if (reflMethod != null) { WADLDoc d = reflMethod.getAnnotation(WADLDoc.class); if (d != null) { m.getDoc().add(getDocument(d)); } } Request r = buildRequest(classMetadata, metadata); if (r != null) { m.setRequest(r); } List<Response> resp = buildResponse(metadata); if (resp != null) { m.getResponse().addAll(resp); } return m; }
public Set<String> getOptions(ResourceInstance resource) { Set<String> set = new HashSet<String>(); List<MethodMetadata> resourceMethods; if (resource.isExactMatch()) { resourceMethods = resource.getRecord().getMetadata().getResourceMethods(); } else { String uri = UriTemplateProcessor.normalizeUri(resource.getMatcher().getTail(false)); List<SubResourceInstance> matchingMethods = resource.getRecord().getMatchingSubResourceMethods(uri); resourceMethods = new LinkedList<MethodMetadata>(); for (SubResourceInstance subResource : matchingMethods) { resourceMethods.add(subResource.getRecord().getMetadata()); } } for (MethodMetadata method : resourceMethods) { set.add(method.getHttpMethod()); } return set; }
try { String path = resourcePath; String httpMethod = methodMetadata.getHttpMethod(); String httpMethod = method.getHttpMethod(); if (httpMethod == null) { httpMethod = "(Sub-Locator)";
if (metadata.getHttpMethod() == null && metadata.getPath() == null) { if (metadata.isEncoded() || defaultValue != null) {
org.apache.wink.common.internal.model.admin.Methods.Method httpMethod = resourcesObjectFactory.createMethodsMethod(); httpMethod.setName(methodMetadata.getHttpMethod().toString());
} else { subResource.setType("Method"); //$NON-NLS-1$ subResource.setMethod(subResourceLocator.getHttpMethod().toString());