@Override public String toString() { return toContentTypeString(); } }
@Override public String toString() { return getName(); } }
/** * Parses the given input string (<code>format</code>) and returns created {@link ContentType} if input was valid or * return <code>NULL</code> if input was not parseable. * * For the definition of the supported format see {@link #create(String)}. * * @param format a string in format as defined in RFC 7231, chapter 3.1.1.1 * @return a new <code>ContentType</code> object */ public static ContentType parse(final String format) { try { return ContentType.create(format); } catch (IllegalArgumentException e) { return null; } }
/** * Creates a list of {@link AcceptType} objects based on given content type. * @param contentType the content type * @return an immutable one-element list of <code>AcceptType</code> objects that matches only the given content type */ public static List<AcceptType> fromContentType(final ContentType contentType) { return Collections.singletonList(new AcceptType( contentType.getType(), contentType.getSubtype(), contentType.getParameters(), 1F)); }
/** * Creates a content type from an existing content type and an additional parameter as key-value pair. * @param contentType an existing content type * @param parameterName the name of the additional parameter * @param parameterValue the value of the additional parameter * @return a new {@link ContentType} object */ public static ContentType create(final ContentType contentType, final String parameterName, final String parameterValue) throws IllegalArgumentException { TypeUtil.validateParameterNameAndValue(parameterName, parameterValue); ContentType type = new ContentType(contentType.type, contentType.subtype, contentType.parameters); type.parameters.put(parameterName.toLowerCase(Locale.ROOT), parameterValue); return type; }
private AcceptType(final String type, final String subtype, final Map<String, String> parameters, final Float quality) { this.type = type; this.subtype = subtype; this.parameters = TypeUtil.createParameterMap(); this.parameters.putAll(parameters); this.quality = quality; }
private String parse(String acceptCharset, Map<String, String> parameters) { final String[] charsetAndParameters = acceptCharset.split(TypeUtil.PARAMETER_SEPARATOR, 2); acceptCharset = charsetAndParameters[0]; final String params = (charsetAndParameters.length > 1 ? charsetAndParameters[1] : null); TypeUtil.parseParameters(params, parameters); return acceptCharset; }
@Override public String toString() { return toContentTypeString(); } }
@Override public String toString() { return getName(); } }
/** * Creates a list of {@link AcceptType} objects based on given content type. * @param contentType the content type * @return an immutable one-element list of <code>AcceptType</code> objects that matches only the given content type */ public static List<AcceptType> fromContentType(final ContentType contentType) { return Collections.singletonList(new AcceptType( contentType.getType(), contentType.getSubtype(), contentType.getParameters(), 1F)); }
/** * Parses the given input string (<code>format</code>) and returns created {@link ContentType} if input was valid or * return <code>NULL</code> if input was not parseable. * * For the definition of the supported format see {@link #create(String)}. * * @param format a string in format as defined in RFC 7231, chapter 3.1.1.1 * @return a new <code>ContentType</code> object */ public static ContentType parse(final String format) { try { return ContentType.create(format); } catch (IllegalArgumentException e) { return null; } }
private ClientLinkType(final ContentType contentType) { this(contentType.toContentTypeString()); }
/** * <code>Prefer</code> header, return content. * * @see org.apache.olingo.commons.api.http.HttpHeader#PREFER */ public String returnContent() { return PreferenceName.RETURN.getName(); }
private ClientLinkType(final ContentType contentType) { this(contentType.toContentTypeString()); }
/** * <code>Prefer</code> header, return content. * * @see org.apache.olingo.commons.api.http.HttpHeader#PREFER */ public String returnContent() { return PreferenceName.RETURN.getName(); }
/** * <code>Prefer</code> header, return no content. * * @see org.apache.olingo.commons.api.http.HttpHeader#PREFER */ public String returnNoContent() { return PreferenceName.RETURN_NO_CONTENT.getName(); }
/** * Gets the value of the non-standard preference that the URL should follow the convention * that keys are formatted as separate segments. * @see org.apache.olingo.commons.api.http.HttpHeader#PREFER */ public String keyAsSegment() { return PreferenceName.KEY_AS_SEGMENT.getName(); }
/** * Gets the value of the non-standard preference that the URL should follow the convention * that keys are formatted as separate segments. * @see org.apache.olingo.commons.api.http.HttpHeader#PREFER */ public String keyAsSegment() { return PreferenceName.KEY_AS_SEGMENT.getName(); }
/** * <code>Prefer</code> header, return no content. * * @see org.apache.olingo.commons.api.http.HttpHeader#PREFER */ public String returnNoContent() { return PreferenceName.RETURN_NO_CONTENT.getName(); }
/** Sets <code>odata.track-changes</code>. */ public Builder trackChanges() { add(PreferenceName.TRACK_CHANGES.getName(), null); return this; }