Package javax.ws.rs.core.Variant

Examples of javax.ws.rs.core.Variant.VariantListBuilder.mediaTypes()


            builder.mediaTypes(MediaType.APPLICATION_ATOM_XML_TYPE).languages(Locale.ENGLISH)
                .encodings("UTF-8").add().build();
        assertList(new Variant[] {variant1}, list);

        list =
            builder.mediaTypes(MediaType.APPLICATION_ATOM_XML_TYPE).languages(Locale.ENGLISH)
                .encodings("UTF-16").add().build();
        assertList(new Variant[] {variant2}, list);

        list =
            builder.mediaTypes(MediaType.APPLICATION_ATOM_XML_TYPE).languages(Locale.ENGLISH)
View Full Code Here


            builder.mediaTypes(MediaType.APPLICATION_ATOM_XML_TYPE).languages(Locale.ENGLISH)
                .encodings("UTF-16").add().build();
        assertList(new Variant[] {variant2}, list);

        list =
            builder.mediaTypes(MediaType.APPLICATION_ATOM_XML_TYPE).languages(Locale.ENGLISH)
                .encodings("UTF-8", "UTF-16").add().build();
        assertList(new Variant[] {variant1, variant2}, list);

        list =
            builder.mediaTypes(MediaType.APPLICATION_ATOM_XML_TYPE).languages(Locale.ENGLISH,
View Full Code Here

            builder.mediaTypes(MediaType.APPLICATION_ATOM_XML_TYPE).languages(Locale.ENGLISH)
                .encodings("UTF-8", "UTF-16").add().build();
        assertList(new Variant[] {variant1, variant2}, list);

        list =
            builder.mediaTypes(MediaType.APPLICATION_ATOM_XML_TYPE).languages(Locale.ENGLISH,
                                                                              Locale.CHINESE)
                .encodings("UTF-8", "UTF-16").add().build();
        assertList(new Variant[] {variant1, variant2, variant3, variant4}, list);

        list =
View Full Code Here

                                                                              Locale.CHINESE)
                .encodings("UTF-8", "UTF-16").add().build();
        assertList(new Variant[] {variant1, variant2, variant3, variant4}, list);

        list =
            builder
                .mediaTypes(MediaType.APPLICATION_ATOM_XML_TYPE, MediaType.APPLICATION_JSON_TYPE)
                .languages(Locale.ENGLISH, Locale.CHINESE).encodings("UTF-8", "UTF-16").add()
                .build();
        assertList(new Variant[] {variant1, variant2, variant3, variant4, variant5, variant6,
            variant7, variant8}, list);
View Full Code Here

    */
   public static List<Variant> getAvailableVariants(List<MediaType> mediaTypes)
   {
      VariantListBuilder builder = Variant.VariantListBuilder.newInstance();
      MediaType[] types = mediaTypes.toArray(new MediaType[mediaTypes.size()]);
      builder.mediaTypes(types);
      return builder.build();
   }

   /**
    * @param in
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.