Package org.restlet.resource

Examples of org.restlet.resource.Variant


  private final static Logger LOG = Logger.getLogger(InstancesResource.class);

  public InstancesResource(Context context, Request request, Response response)
  {
    super(context, request, response);
    getVariants().add(new Variant(MediaType.TEXT_PLAIN));
    getVariants().add(new Variant(MediaType.APPLICATION_JSON));
  }
View Full Code Here


  private final static Logger LOG = Logger.getLogger(ResourceGroupResource.class);

  public ResourceGroupResource(Context context, Request request, Response response)
  {
    super(context, request, response);
    getVariants().add(new Variant(MediaType.TEXT_PLAIN));
    getVariants().add(new Variant(MediaType.APPLICATION_JSON));
  }
View Full Code Here

  private final static Logger LOG = Logger.getLogger(ResourceGroupsResource.class);

  public ResourceGroupsResource(Context context, Request request, Response response)
  {
    super(context, request, response);
    getVariants().add(new Variant(MediaType.TEXT_PLAIN));
    getVariants().add(new Variant(MediaType.APPLICATION_JSON));
  }
View Full Code Here

   public EspressoResource(Context context,
              Request request,
              Response response)
    {
      super(context, request, response);
      getVariants().add(new Variant(MediaType.TEXT_PLAIN));
      getVariants().add(new Variant(MediaType.APPLICATION_JSON));
      _context = context;
    }
View Full Code Here

  public StopServiceResource(Context context,
      Request request,
      Response response)
  {
    super(context, request, response);
    getVariants().add(new Variant(MediaType.TEXT_PLAIN));
    getVariants().add(new Variant(MediaType.APPLICATION_JSON));
    _context = context;
  }
View Full Code Here

            MediaType variantMediaType = null;

            boolean compatibleLanguage = false;
            boolean compatibleMediaType = false;

            Variant currentVariant = null;
            Variant bestVariant = null;

            Preference<Language> currentLanguagePref = null;
            Preference<Language> bestLanguagePref = null;
            Preference<MediaType> currentMediaTypePref = null;
            Preference<MediaType> bestMediaTypePref = null;
View Full Code Here

     */
    private boolean checkMetadataConsistency(String fileName,
            MetadataService metadataService, Representation representation) {
        boolean result = true;
        if (representation != null) {
            Variant var = new Variant();
            updateMetadata(metadataService, fileName, var);
            // "rep" contains the theorical correct metadata
            if (!representation.getLanguages().isEmpty()
                    && !var.getLanguages().containsAll(
                            representation.getLanguages())) {
                result = false;
            }
            if (representation.getMediaType() != null
                    && !(var.getMediaType() != null && var.getMediaType()
                            .includes(representation.getMediaType()))) {
                result = false;
            }
            if (!representation.getEncodings().isEmpty()
                    && !var.getEncodings().containsAll(
                            representation.getEncodings())) {
                result = false;
            }
        }
        return result;
View Full Code Here

        //
        // get item
        RestletItem item = (RestletItem)flowContext.getItem();
        //
        // get Variant
        Variant variant = (Variant) item.getRestletVariant();


        JSONObject json = new JSONObject();

        try {
View Full Code Here

        //
        // get item
        RestletItem item = (RestletItem)flowContext.getItem();
        //
        // get Variant
        Variant variant = (Variant) item.getRestletVariant();


      JSONObject json = new JSONObject();

      try {
View Full Code Here

        //
        // get hello text
        String hello = "Hello World!!";
        //
        // get Variant
        Variant variant = (Variant) item.getRestletVariant();

        Representation result = null;
        if (variant.getMediaType().equals(MediaType.TEXT_PLAIN))
            result = new StringRepresentation(hello);
        else
            result = new StringRepresentation("Variant no soportada");

        //
View Full Code Here

TOP

Related Classes of org.restlet.resource.Variant

Copyright © 2018 www.massapicom. 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.