/** * Returns a new instance with the same type and subtype as this instance, with the {@code * charset} parameter set to the {@link Charset#name name} of the given charset. Only one {@code * charset} parameter will be present on the new instance regardless of the number set on this * one. * * <p>If a charset must be specified that is not supported on this JVM (and thus is not * representable as a {@link Charset} instance, use {@link #withParameter}. */ public MediaType withCharset(Charset charset) { checkNotNull(charset); MediaType withCharset = withParameter(CHARSET_ATTRIBUTE, charset.name()); // precache the charset so we don't need to parse it withCharset.parsedCharset = Optional.of(charset); return withCharset; }
private static MediaType create(String subtype, String protocol) { return create(subtype).withParameter("protocol", protocol); } }
supportedMediaTypesBuilder.add(MediaType.PROTOBUF.withParameter("protocol", "gRPC")); supportedMediaTypesBuilder.add(MediaType.JSON_UTF_8.withParameter("protocol", "gRPC"));
GrpcSerializationFormats.PROTO_WEB.mediaType(), GrpcSerializationFormats.JSON_WEB.mediaType(), MediaType.PROTOBUF.withParameter("protocol", "gRPC"), MediaType.JSON_UTF_8.withParameter("protocol", "gRPC")) .build())), new ServiceEntry(RECONNECT_SERVICE_DESCRIPTOR, ImmutableList.of(
private static MediaType create(String subtype, String protocol) { return create(subtype).withParameter("protocol", protocol); } }
private static MediaType create(String subtype, String protocol) { return create(subtype).withParameter("protocol", protocol); } }
private static MediaType create(String subtype, String protocol) { return create(subtype).withParameter("protocol", protocol); } }
supportedMediaTypesBuilder.add(MediaType.PROTOBUF.withParameter("protocol", "gRPC")); supportedMediaTypesBuilder.add(MediaType.JSON_UTF_8.withParameter("protocol", "gRPC"));