ServerResource.getConverterService
Code IndexAdd Codota to your IDE (free)

Best Java code snippets using org.restlet.resource.ServerResource.getConverterService (Showing top 15 results out of 315)

  • Common ways to obtain ServerResource
private void myMethod () {
ServerResource s =
  • Finder finder;finder.find(null, null)
  • Smart code suggestions by Codota
}
origin: org.restlet.osgi/org.restlet.ext.platform

private static void completeOperationProduces(Operation operation,
    MethodAnnotationInfo mai, ServerResource sr,
    MetadataService metadataService) {
  if (metadataService != null) {
    try {
      List<Variant> responseVariants = mai.getResponseVariants(
          metadataService, sr.getConverterService());
      if (responseVariants == null || responseVariants.isEmpty()) {
        if (mai.getJavaMethod().getReturnType() != Void.TYPE) {
          LOGGER.warning("Method has no response variant: "
              + mai.getJavaMethod());
        }
        return;
      }
      // une representation per variant ?
      for (Variant variant : responseVariants) {
        if (variant.getMediaType() == null) {
          LOGGER.warning("Variant has no media type: " + variant);
          continue;
        }
        operation.getProduces().add(
            variant.getMediaType().getName());
      }
    } catch (IOException e) {
      throw new ResourceException(e);
    }
  }
}
origin: org.restlet.jee/org.restlet.ext.apispark

private static void completeOperationProduces(Operation operation,
    MethodAnnotationInfo mai, ServerResource sr,
    MetadataService metadataService) {
  if (metadataService != null) {
    try {
      List<Variant> responseVariants = mai.getResponseVariants(
          metadataService, sr.getConverterService());
      if (responseVariants == null || responseVariants.isEmpty()) {
        if (mai.getJavaMethod().getReturnType() != Void.TYPE) {
          LOGGER.warning("Method has no response variant: "
              + mai.getJavaMethod());
        }
        return;
      }
      // une representation per variant ?
      for (Variant variant : responseVariants) {
        if (variant.getMediaType() == null) {
          LOGGER.warning("Variant has no media type: " + variant);
          continue;
        }
        operation.getProduces().add(
            variant.getMediaType().getName());
      }
    } catch (IOException e) {
      throw new ResourceException(e);
    }
  }
}
origin: org.restlet.jee/org.restlet.ext.platform

private static void completeOperationProduces(Operation operation,
    MethodAnnotationInfo mai, ServerResource sr,
    MetadataService metadataService) {
  if (metadataService != null) {
    try {
      List<Variant> responseVariants = mai.getResponseVariants(
          metadataService, sr.getConverterService());
      if (responseVariants == null || responseVariants.isEmpty()) {
        if (mai.getJavaMethod().getReturnType() != Void.TYPE) {
          LOGGER.warning("Method has no response variant: "
              + mai.getJavaMethod());
        }
        return;
      }
      // une representation per variant ?
      for (Variant variant : responseVariants) {
        if (variant.getMediaType() == null) {
          LOGGER.warning("Variant has no media type: " + variant);
          continue;
        }
        operation.getProduces().add(
            variant.getMediaType().getName());
      }
    } catch (IOException e) {
      throw new ResourceException(e);
    }
  }
}
origin: org.restlet.jse/org.restlet.ext.platform

private static void completeOperationProduces(Operation operation,
    MethodAnnotationInfo mai, ServerResource sr,
    MetadataService metadataService) {
  if (metadataService != null) {
    try {
      List<Variant> responseVariants = mai.getResponseVariants(
          metadataService, sr.getConverterService());
      if (responseVariants == null || responseVariants.isEmpty()) {
        if (mai.getJavaMethod().getReturnType() != Void.TYPE) {
          LOGGER.warning("Method has no response variant: "
              + mai.getJavaMethod());
        }
        return;
      }
      // une representation per variant ?
      for (Variant variant : responseVariants) {
        if (variant.getMediaType() == null) {
          LOGGER.warning("Variant has no media type: " + variant);
          continue;
        }
        operation.getProduces().add(
            variant.getMediaType().getName());
      }
    } catch (IOException e) {
      throw new ResourceException(e);
    }
  }
}
origin: org.restlet.gae/org.restlet.ext.platform

private static void completeOperationProduces(Operation operation,
    MethodAnnotationInfo mai, ServerResource sr,
    MetadataService metadataService) {
  if (metadataService != null) {
    try {
      List<Variant> responseVariants = mai.getResponseVariants(
          metadataService, sr.getConverterService());
      if (responseVariants == null || responseVariants.isEmpty()) {
        if (mai.getJavaMethod().getReturnType() != Void.TYPE) {
          LOGGER.warning("Method has no response variant: "
              + mai.getJavaMethod());
        }
        return;
      }
      // une representation per variant ?
      for (Variant variant : responseVariants) {
        if (variant.getMediaType() == null) {
          LOGGER.warning("Variant has no media type: " + variant);
          continue;
        }
        operation.getProduces().add(
            variant.getMediaType().getName());
      }
    } catch (IOException e) {
      throw new ResourceException(e);
    }
  }
}
origin: org.restlet.osgi/org.restlet

/**
 * 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;
}
origin: org.restlet.jee/org.restlet.ext.apispark

metadataService, sr.getConverterService());
origin: org.restlet.osgi/org.restlet

} else {
  result = put(getConverterService().applyPatch(get(), entity),
      variant);
origin: org.restlet.jee/org.restlet.ext.platform

metadataService, sr.getConverterService());
origin: org.restlet.gae/org.restlet.ext.platform

metadataService, sr.getConverterService());
origin: org.restlet.jse/org.restlet.ext.platform

metadataService, sr.getConverterService());
origin: org.restlet.osgi/org.restlet.ext.platform

metadataService, sr.getConverterService());
origin: org.restlet.osgi/org.restlet

/**
 * Apply a patch entity to the current representation of the resource
 * retrieved by calling {@link #get()}. By default, the
 * {@link ConverterService#applyPatch(Representation, Representation)} method is used and then the
 * {@link #put(Representation)} method called.
 * 
 * @param entity
 *            The patch entity to apply.
 * @return The optional result entity.
 * @throws ResourceException
 * @see <a href="https://tools.ietf.org/html/rfc5789">HTTP PATCH method</a>
 */
protected Representation patch(Representation entity)
    throws ResourceException {
  AnnotationInfo annotationInfo;
  try {
    annotationInfo = getAnnotation(Method.PATCH);
    if (annotationInfo != null) {
      return doHandle(Method.PATCH, getQuery(), entity);
    } else {
      // Default implementation
      return put(getConverterService().applyPatch(get(), entity));
      // doError(Status.CLIENT_ERROR_METHOD_NOT_ALLOWED);
    }
  } catch (IOException e) {
    throw new ResourceException(e);
  }
}
origin: org.restlet.osgi/org.restlet

      getRequestEntity(),
      getMetadataService(),
      getConverterService())) {
annoVariants = methodAnnotationInfo
    .getResponseVariants(
        getMetadataService(),
        getConverterService());
origin: org.restlet.jee/org.restlet.ext.wadl

.getRequestVariants(
    resource.getMetadataService(),
    resource.getConverterService());
  .getResponseVariants(
      resource.getMetadataService(),
      resource.getConverterService());
org.restlet.resourceServerResourcegetConverterService

Popular methods of ServerResource

  • isAnnotated
    Indicates if annotations are supported. The default value is true.
  • doInit
  • getMetadataService
  • getDescription
    Returns the description.
  • getName
    Returns the display name.
  • doError
    By default, it sets the status on the response.
  • getVariants
    Returns a modifiable list of exposed variants for the given method. You can declare variants manuall
  • handle
    Handles any call to this resource. The default implementation check the #isConditional() and #isNego
  • post
    Posts a representation to the resource at the target URI reference. A variant parameter is passed to
  • updateAllowedMethods
    Invoked when the list of allowed methods needs to be updated. The #getAllowedMethods() or the #setAl
  • delete
    Deletes the resource and all its representations. A variant parameter is passed to indicate which re
  • describeVariants
    Describes the available variants to help client-side content negotiation. Return null by default.
  • delete,
  • describeVariants,
  • doCatch,
  • doConditionalHandle,
  • doHandle,
  • doNegotiatedHandle,
  • get,
  • getAllowedMethods,
  • getApplication

Popular in Java

  • Running tasks concurrently on multiple threads
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • setScale (BigDecimal)
  • startActivity (Activity)
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • JLabel (javax.swing)
  • JTable (javax.swing)

For IntelliJ IDEA,
Android Studio or Eclipse

  • Search for JavaScript code betaCodota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutBlogContact Us
  • Plugin user guideTerms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)