/** * Get a message header as a single string value. * <p> * Each single header value is converted to String using a * {@link javax.ws.rs.ext.RuntimeDelegate.HeaderDelegate} if one is available * via {@link javax.ws.rs.ext.RuntimeDelegate#createHeaderDelegate(java.lang.Class)} * for the header value class or using its {@code toString} method if a header * delegate is not available. * * @param name the message header. * @return the message header value. If the message header is not present then * {@code null} is returned. If the message header is present but has no * value then the empty string is returned. If the message header is present * more than once then the values of joined together and separated by a ',' * character. */ public String getHeaderString(String name) { return HeaderUtils.asHeaderString(headers.get(name), RuntimeDelegate.getInstance()); }
/** * Get a message header as a single string value. * <p> * Each single header value is converted to String using a * {@link javax.ws.rs.ext.RuntimeDelegate.HeaderDelegate} if one is available * via {@link javax.ws.rs.ext.RuntimeDelegate#createHeaderDelegate(java.lang.Class)} * for the header value class or using its {@code toString} method if a header * delegate is not available. * * @param name the message header. * @return the message header value. If the message header is not present then * {@code null} is returned. If the message header is present but has no * value then the empty string is returned. If the message header is present * more than once then the values of joined together and separated by a ',' * character. */ public String getHeaderString(String name) { return HeaderUtils.asHeaderString(headers.get(name), RuntimeDelegate.getInstance()); }
/** * Transforms multi value map of headers to single {@code String} value map. * * Returned map is immutable. Map values are formatted using method {@link #asHeaderString}. * * @param headers headers to be formatted * @return immutable single {@code String} value map or * {@code null} if {@code headers} input parameter is {@code null}. */ public static Map<String, String> asStringHeadersSingleValue(final MultivaluedMap<String, Object> headers) { if (headers == null) { return null; } final RuntimeDelegate rd = RuntimeDelegate.getInstance(); return Collections.unmodifiableMap(headers.entrySet().stream() .collect(Collectors.toMap( Map.Entry::getKey, entry -> asHeaderString(entry.getValue(), rd)))); }
/** * Transforms multi value map of headers to single {@code String} value map. * * Returned map is immutable. Map values are formatted using method {@link #asHeaderString}. * * @param headers headers to be formatted * @return immutable single {@code String} value map or * {@code null} if {@code headers} input parameter is {@code null}. */ public static Map<String, String> asStringHeadersSingleValue(final MultivaluedMap<String, Object> headers) { if (headers == null) { return null; } final RuntimeDelegate rd = RuntimeDelegate.getInstance(); return Collections.unmodifiableMap(headers.entrySet().stream() .collect(Collectors.toMap( Map.Entry::getKey, entry -> asHeaderString(entry.getValue(), rd)))); }
} else { final String prevValue = headersSnapshot.get(entry.getKey()); final String newValue = asHeaderString(currentHeaders.get(entry.getKey()), rd); if (!prevValue.equals(newValue)) { changedHeaderNames.add(entry.getKey());
} else { final String prevValue = headersSnapshot.get(entry.getKey()); final String newValue = asHeaderString(currentHeaders.get(entry.getKey()), rd); if (!prevValue.equals(newValue)) { changedHeaderNames.add(entry.getKey());
/** * <p>getHeaderString.</p> * * @param headers a {@link javax.ws.rs.core.MultivaluedMap} object. * @param name a {@link java.lang.String} object. * @return a {@link java.lang.String} object. */ public static String getHeaderString(MultivaluedMap<String, Object> headers, String name) { return HeaderUtils.asHeaderString(headers.get(name), RuntimeDelegate.getInstance()); } }
private static String asHeaderString(List<String> headerValues) { return org.glassfish.jersey.message.internal.HeaderUtils.asHeaderString( headerValues.stream().filter(Objects::nonNull).collect(Collectors.toList()), RuntimeDelegate.getInstance()); }
/** * Get a message header as a single string value. * <p> * Each single header value is converted to String using a * {@link javax.ws.rs.ext.RuntimeDelegate.HeaderDelegate} if one is available * via {@link javax.ws.rs.ext.RuntimeDelegate#createHeaderDelegate(java.lang.Class)} * for the header value class or using its {@code toString} method if a header * delegate is not available. * * @param name the message header. * @return the message header value. If the message header is not present then * {@code null} is returned. If the message header is present but has no * value then the empty string is returned. If the message header is present * more than once then the values of joined together and separated by a ',' * character. */ public String getHeaderString(String name) { return HeaderUtils.asHeaderString(headers.get(name), RuntimeDelegate.getInstance()); }
/** * Transforms multi value map of headers to single {@code String} value map. * * Returned map is immutable. Map values are formatted using method {@link #asHeaderString}. * * @param headers headers to be formatted * @return immutable single {@code String} value map or * {@code null} if {@code headers} input parameter is {@code null}. */ public static Map<String, String> asStringHeadersSingleValue(final MultivaluedMap<String, Object> headers) { if (headers == null) { return null; } final RuntimeDelegate rd = RuntimeDelegate.getInstance(); return Collections.unmodifiableMap(headers.entrySet().stream() .collect(Collectors.toMap( Map.Entry::getKey, entry -> asHeaderString(entry.getValue(), rd)))); }
/** * Transforms multi value map of headers to single {@code String} value map. * * Returned map is immutable. Map values are formatted using method {@link #asHeaderString}. * * @param headers headers to be formatted * @return immutable single {@code String} value map or * {@code null} if {@code headers} input parameter is {@code null}. */ public static Map<String, String> asStringHeadersSingleValue(final MultivaluedMap<String, Object> headers) { if (headers == null) { return null; } final RuntimeDelegate rd = RuntimeDelegate.getInstance(); return Collections.unmodifiableMap(headers.entrySet().stream() .collect(Collectors.toMap( Map.Entry::getKey, entry -> asHeaderString(entry.getValue(), rd)))); }
/** * Get a message header as a single string value. * * Each single header value is converted to String using a * {@link javax.ws.rs.ext.RuntimeDelegate.HeaderDelegate} if one is available * via {@link javax.ws.rs.ext.RuntimeDelegate#createHeaderDelegate(java.lang.Class)} * for the header value class or using its {@code toString} method if a header * delegate is not available. * * @param name the message header. * @return the message header value. If the message header is not present then * {@code null} is returned. If the message header is present but has no * value then the empty string is returned. If the message header is present * more than once then the values of joined together and separated by a ',' * character. */ public String getHeaderString(String name) { return HeaderUtils.asHeaderString(headers.get(name), RuntimeDelegate.getInstance()); }
/** * Get a message header as a single string value. * * Each single header value is converted to String using a * {@link javax.ws.rs.ext.RuntimeDelegate.HeaderDelegate} if one is available * via {@link javax.ws.rs.ext.RuntimeDelegate#createHeaderDelegate(java.lang.Class)} * for the header value class or using its {@code toString} method if a header * delegate is not available. * * @param name the message header. * @return the message header value. If the message header is not present then * {@code null} is returned. If the message header is present but has no * value then the empty string is returned. If the message header is present * more than once then the values of joined together and separated by a ',' * character. */ public String getHeaderString(String name) { return HeaderUtils.asHeaderString(headers.get(name), RuntimeDelegate.getInstance()); }
/** * Get a message header as a single string value. * * Each single header value is converted to String using a * {@link javax.ws.rs.ext.RuntimeDelegate.HeaderDelegate} if one is available * via {@link javax.ws.rs.ext.RuntimeDelegate#createHeaderDelegate(java.lang.Class)} * for the header value class or using its {@code toString} method if a header * delegate is not available. * * @param name the message header. * @return the message header value. If the message header is not present then * {@code null} is returned. If the message header is present but has no * value then the empty string is returned. If the message header is present * more than once then the values of joined together and separated by a ',' * character. */ public String getHeaderString(String name) { return HeaderUtils.asHeaderString(headers.get(name), RuntimeDelegate.getInstance()); }
/** * Get a message header as a single string value. * <p> * Each single header value is converted to String using a * {@link javax.ws.rs.ext.RuntimeDelegate.HeaderDelegate} if one is available * via {@link javax.ws.rs.ext.RuntimeDelegate#createHeaderDelegate(java.lang.Class)} * for the header value class or using its {@code toString} method if a header * delegate is not available. * * @param name the message header. * @return the message header value. If the message header is not present then * {@code null} is returned. If the message header is present but has no * value then the empty string is returned. If the message header is present * more than once then the values of joined together and separated by a ',' * character. */ public String getHeaderString(String name) { return HeaderUtils.asHeaderString(headers.get(name), RuntimeDelegate.getInstance()); }
} else { final String prevValue = headersSnapshot.get(entry.getKey()); final String newValue = asHeaderString(currentHeaders.get(entry.getKey()), rd); if (!prevValue.equals(newValue)) { changedHeaderNames.add(entry.getKey());
} else { final String prevValue = headersSnapshot.get(entry.getKey()); final String newValue = asHeaderString(currentHeaders.get(entry.getKey()), rd); if (!prevValue.equals(newValue)) { changedHeaderNames.add(entry.getKey());
/** * Transforms multi value map of headers to single {@code String} value map. * * Returned map is immutable. Map values are formatted using method {@link #asHeaderString}. * * @param headers headers to be formatted * @return immutable single {@code String} value map or * {@code null} if {@code headers} input parameter is {@code null}. */ public static Map<String, String> asStringHeadersSingleValue(final MultivaluedMap<String, Object> headers) { if (headers == null) { return null; } final RuntimeDelegate rd = RuntimeDelegate.getInstance(); final ImmutableMap.Builder<String, String> immutableMapBuilder = new ImmutableMap.Builder<String, String>(); for (final Map.Entry<? extends String, ? extends List<Object>> entry : headers.entrySet()) { immutableMapBuilder.put(entry.getKey(), asHeaderString(entry.getValue(), rd)); } return immutableMapBuilder.build(); }
/** * Transforms multi value map of headers to single {@code String} value map. * * Returned map is immutable. Map values are formatted using method {@link #asHeaderString}. * * @param headers headers to be formatted * @return immutable single {@code String} value map or * {@code null} if {@code headers} input parameter is {@code null}. */ public static Map<String, String> asStringHeadersSingleValue(final MultivaluedMap<String, Object> headers) { if (headers == null) { return null; } final RuntimeDelegate rd = RuntimeDelegate.getInstance(); final ImmutableMap.Builder<String, String> immutableMapBuilder = new ImmutableMap.Builder<String, String>(); for (final Map.Entry<? extends String, ? extends List<Object>> entry : headers.entrySet()) { immutableMapBuilder.put(entry.getKey(), asHeaderString(entry.getValue(), rd)); } return immutableMapBuilder.build(); }
/** * Transforms multi value map of headers to single {@code String} value map. * * Returned map is immutable. Map values are formatted using method {@link #asHeaderString}. * * @param headers headers to be formatted * @return immutable single {@code String} value map or * {@code null} if {@code headers} input parameter is {@code null}. */ public static Map<String, String> asStringHeadersSingleValue(final MultivaluedMap<String, Object> headers) { if (headers == null) { return null; } final RuntimeDelegate rd = RuntimeDelegate.getInstance(); final ImmutableMap.Builder<String, String> immutableMapBuilder = new ImmutableMap.Builder<String, String>(); for (final Map.Entry<? extends String, ? extends List<Object>> entry : headers.entrySet()) { immutableMapBuilder.put(entry.getKey(), asHeaderString(entry.getValue(), rd)); } return immutableMapBuilder.build(); }