Examples of MediaType


Examples of org.restlet.data.MediaType

  protected final Representation get(Variant variant)
    throws ResourceException
  {
    getResponse().setDimensions(ServerUtil.VARY_ACCEPT);

    MediaType mediaType = variant.getMediaType();

    FF format = registry.getFileFormatForMIMEType(mediaType.getName());

    if (format == null) {
      throw new ResourceException(CLIENT_ERROR_NOT_ACCEPTABLE, "No acceptable file format found.");
    }
View Full Code Here

Examples of org.restlet.data.MediaType

    if (Method.GET.equals(reqMethod) || Method.HEAD.equals(reqMethod)) {
      return request.getResourceRef().getQueryAsForm();
    }
    else if (Method.POST.equals(reqMethod)) {
      MediaType mediaType = request.getEntity().getMediaType();

      if (MediaType.APPLICATION_WWW_FORM.equals(mediaType, true)) {
        return request.getEntityAsForm();
      }
      else {
View Full Code Here

Examples of org.restlet.data.MediaType

    throws ResourceException
  {
    vf = valueFactory;
    params = req.getResourceRef().getQueryAsForm();

    MediaType mediaType = req.getEntity().getMediaType();

    if (MediaType.APPLICATION_WWW_FORM.equals(mediaType, true)) {
      // Include parameters from request's body
      params = new Form(params);
      params.addAll(req.getEntityAsForm());
    }
    else if (mediaType != null) {
      throw new ResourceException(CLIENT_ERROR_UNSUPPORTED_MEDIA_TYPE, "Unsupported MIME type: "
          + mediaType.getName());
    }
  }
View Full Code Here

Examples of org.springframework.http.MediaType

        RestTemplate restTemplate = new RestTemplate();
        List<HttpMessageConverter<?>> mc = restTemplate.getMessageConverters();
        // Add JSON message handler
        MappingJackson2HttpMessageConverter json = new MappingJackson2HttpMessageConverter();
        List<MediaType> supportedMediaTypes = new ArrayList<MediaType>();
        supportedMediaTypes.add(new MediaType("application","json", Charset.forName("UTF-8")));
        // Add default media type in case marketplace uses incorrect MIME type, otherwise
        // Spring refuses to process it, even if its valid JSON
        supportedMediaTypes.add(new MediaType("application","octet-stream", Charset.forName("UTF-8")));
        json.setSupportedMediaTypes(supportedMediaTypes);
        mc.add(json);
        restTemplate.setMessageConverters(mc);
        return restTemplate;
    }
View Full Code Here

Examples of ratpack.http.MediaType

              public void execute(RequestOutcome thing) throws Exception {
                byteBuf.release();
              }
            });

            MediaType contentType;
            String rawContentType = nettyFileUpload.getContentType();
            if (rawContentType == null) {
              contentType = null;
            } else {
              Charset charset = nettyFileUpload.getCharset();
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.