public RestfulProxyBuilder<T> defaultProduces(String type) { this.serverProduces = MediaType.valueOf(type); return this; }
public RestfulProxyBuilder<T> defaultConsumes(String type) { this.serverConsumes = MediaType.valueOf(type); return this; }
/** * Creates new instance with {@code mediaType} which was obtained from user * annotations {@link Consumes} or {@link Produces}. * * @param mediaTypeValue The string media type. */ public EffectiveMediaType(String mediaTypeValue) { this(MediaType.valueOf(mediaTypeValue), false); }
/** * Creates new instance with {@code mediaType} which was obtained from user * annotations {@link Consumes} or {@link Produces}. * * @param mediaTypeValue The string media type. */ public EffectiveMediaType(String mediaTypeValue) { this(MediaType.valueOf(mediaTypeValue), false); }
public MediaType valueOf(final String value) { return MediaType.valueOf(value); } });
public MediaType valueOf(final String value) { return MediaType.valueOf(value); } });
/** * Set custom chunk data media type from a string value. * <p> * Note: Access to internal chunk media type is not a thread-safe operation and has to * be explicitly synchronized in case the chunked input is used from multiple threads. * </p> * * @param mediaType custom chunk data media type. Must not be {@code null}. * @throws IllegalArgumentException in case the {@code mediaType} cannot be parsed into * a valid {@link MediaType} instance or is {@code null}. * @see #setChunkType(javax.ws.rs.core.MediaType) */ public void setChunkType(final String mediaType) throws IllegalArgumentException { this.mediaType = MediaType.valueOf(mediaType); }
/** * Set custom chunk data media type from a string value. * <p> * Note: Access to internal chunk media type is not a thread-safe operation and has to * be explicitly synchronized in case the chunked input is used from multiple threads. * </p> * * @param mediaType custom chunk data media type. Must not be {@code null}. * @throws IllegalArgumentException in case the {@code mediaType} cannot be parsed into * a valid {@link MediaType} instance or is {@code null}. * @see #setChunkType(javax.ws.rs.core.MediaType) */ public void setChunkType(final String mediaType) throws IllegalArgumentException { this.mediaType = MediaType.valueOf(mediaType); }
private static List<MediaType> extractMediaTypes(final String[] values) { if (values.length == 0) { return Collections.emptyList(); } final List<MediaType> types = new ArrayList<>(values.length); for (final String mtEntry : values) { for (final String mt : Tokenizer.tokenize(mtEntry, ",")) { types.add(MediaType.valueOf(mt)); } } return types; }
@Override public MediaType apply(String input) { try { return MediaType.valueOf(input); } catch (IllegalArgumentException iae) { throw new ProcessingException(iae); } } }, false);
/** * Set message content type. * * @param type message content type to be set. */ public void type(final String type) { type(type == null ? null : MediaType.valueOf(type)); }
@Override public MediaType apply(String input) { try { return MediaType.valueOf(input); } catch (IllegalArgumentException iae) { throw new ProcessingException(iae); } } }, false);
private static List<MediaType> extractMediaTypes(final String[] values) { if (values.length == 0) { return Collections.emptyList(); } final List<MediaType> types = new ArrayList<>(values.length); for (final String mtEntry : values) { for (final String mt : Tokenizer.tokenize(mtEntry, ",")) { types.add(MediaType.valueOf(mt)); } } return types; }
/** * Set message content type. * * @param type message content type to be set. */ public void type(final String type) { type(type == null ? null : MediaType.valueOf(type)); }
@Override public javax.ws.rs.core.Response.ResponseBuilder type(String type) { return type(type == null ? null : MediaType.valueOf(type)); }
@Override public javax.ws.rs.core.Response.ResponseBuilder type(String type) { return type(type == null ? null : MediaType.valueOf(type)); }
@Override public MediaType getMediaType() { final Object mediaTypeHeader = getHttpHeaders().getFirst(HttpHeaders.CONTENT_TYPE); if (mediaTypeHeader instanceof MediaType) { return (MediaType)mediaTypeHeader; } else if (mediaTypeHeader != null) { return MediaType.valueOf(mediaTypeHeader.toString()); } return null; }
/** * Set the response media type. * * @param type the media type of the response entity, if null any * existing value for type will be removed * @return the updated instance * @throws IllegalArgumentException if type cannot be parsed */ public B type(String type) { return type(type == null ? null : MediaType.valueOf(type)); }
@Test public void canProvideUTF8EncodedJsonFormat() { assertNotNull( repository.inputFormat( MediaType.valueOf( "application/json;charset=UTF-8" ) ) ); }
@Test public void canProvideJsonFormat() { assertNotNull( repository.inputFormat( MediaType.valueOf( "application/json" ) ) ); }