/** * Returns the preferred variant among a list of available variants. The * selection is based on the client preferences using the * {@link org.restlet.service.ConnegService#getPreferredVariant(List, Request, org.restlet.service.MetadataService)} * method. * * @param variants * The available variants. * @return The preferred variant. */ protected Variant getPreferredVariant(List<Variant> variants) { Variant result = null; // If variants were found, select the best matching one if ((variants != null) && (!variants.isEmpty())) { result = getConnegService().getPreferredVariant(variants, getRequest(), getMetadataService()); } return result; }
/** * Returns the first annotation descriptor matching the given method. * * @param method * The method to match. * @param query * The query parameters. * @param entity * The request entity or null. * @return The annotation descriptor. * @throws IOException */ private MethodAnnotationInfo getAnnotation(Method method, Form query, Representation entity) throws IOException { if (isAnnotated()) { return AnnotationUtils.getInstance().getMethodAnnotation( getAnnotations(), method, query, entity, getMetadataService(), getConverterService()); } return null; }
/** * Automatically describes a method by discovering the resource's * annotations. * */ private static void completeOperation(CollectInfo collectInfo, Operation operation, MethodAnnotationInfo mai, ServerResource sr, List<? extends IntrospectionHelper> introspectionHelper) { // Loop over the annotated Java methods MetadataService metadataService = sr.getMetadataService(); // Retrieve thrown classes completeOperationThrows(collectInfo, operation, mai, introspectionHelper); // Describe the input completeOperationInput(collectInfo, operation, mai, sr, introspectionHelper, metadataService); // Describe query parameters, if any. completeOperationQueryParameter(operation, mai); // Describe the success response completeOperationOutput(collectInfo, operation, mai, introspectionHelper); // Produces completeOperationProduces(operation, mai, sr, metadataService); }
/** * Automatically describes a method by discovering the resource's * annotations. * */ private static void completeOperation(CollectInfo collectInfo, Operation operation, MethodAnnotationInfo mai, ServerResource sr, List<? extends IntrospectionHelper> introspectionHelper) { // Loop over the annotated Java methods MetadataService metadataService = sr.getMetadataService(); // Retrieve thrown classes completeOperationThrows(collectInfo, operation, mai, introspectionHelper); // Describe the input completeOperationInput(collectInfo, operation, mai, sr, introspectionHelper, metadataService); // Describe query parameters, if any. completeOperationQueryParameter(operation, mai); // Describe the success response completeOperationOutput(collectInfo, operation, mai, introspectionHelper); // Produces completeOperationProduces(operation, mai, sr, metadataService); }
/** * Automatically describes a method by discovering the resource's * annotations. * */ private static void completeOperation(CollectInfo collectInfo, Operation operation, MethodAnnotationInfo mai, ServerResource sr, List<? extends IntrospectionHelper> introspectionHelper) { // Loop over the annotated Java methods MetadataService metadataService = sr.getMetadataService(); // Retrieve thrown classes completeOperationThrows(collectInfo, operation, mai, introspectionHelper); // Describe the input completeOperationInput(collectInfo, operation, mai, sr, introspectionHelper, metadataService); // Describe query parameters, if any. completeOperationQueryParameter(operation, mai); // Describe the success response completeOperationOutput(collectInfo, operation, mai, introspectionHelper); // Produces completeOperationProduces(operation, mai, sr, metadataService); }
/** * Automatically describes a method by discovering the resource's * annotations. * */ private static void completeOperation(CollectInfo collectInfo, Operation operation, MethodAnnotationInfo mai, ServerResource sr, List<? extends IntrospectionHelper> introspectionHelper) { // Loop over the annotated Java methods MetadataService metadataService = sr.getMetadataService(); // Retrieve thrown classes completeOperationThrows(collectInfo, operation, mai, introspectionHelper); // Describe the input completeOperationInput(collectInfo, operation, mai, sr, introspectionHelper, metadataService); // Describe query parameters, if any. completeOperationQueryParameter(operation, mai); // Describe the success response completeOperationOutput(collectInfo, operation, mai, introspectionHelper); // Produces completeOperationProduces(operation, mai, sr, metadataService); }
/** * Automatically describes a method by discovering the resource's * annotations. * */ private static void completeOperation(CollectInfo collectInfo, Operation operation, MethodAnnotationInfo mai, ServerResource sr, List<? extends IntrospectionHelper> introspectionHelper) { // Loop over the annotated Java methods MetadataService metadataService = sr.getMetadataService(); // Retrieve thrown classes completeOperationThrows(collectInfo, operation, mai, introspectionHelper); // Describe the input completeOperationInput(collectInfo, operation, mai, sr, introspectionHelper, metadataService); // Describe query parameters, if any. completeOperationQueryParameter(operation, mai); // Describe the success response completeOperationOutput(collectInfo, operation, mai, introspectionHelper); // Produces completeOperationProduces(operation, mai, sr, metadataService); }
.isCompatible(method, getQuery(), getRequestEntity(), getMetadataService(), getConverterService())) { annoVariants = methodAnnotationInfo .getResponseVariants( getMetadataService(), getConverterService()); MediaType emt = getRequest() .getEntity().getMediaType(); List<MediaType> amts = getMetadataService() .getAllMediaTypes( methodAnnotationInfo
ServerResource resource) { MetadataService metadataService = resource.getMetadataService(); List<AnnotationInfo> annotations = resource.isAnnotated() ? AnnotationUtils .getInstance().getAnnotations(resource.getClass()) : null; resource.getMetadataService(), resource.getConverterService()); List<Variant> responseVariants = mai .getResponseVariants( resource.getMetadataService(), resource.getConverterService());