public Token(final String token, final String secret, final String consumerKey, final String callbackUrl, final Map<String, List<String>> attributes) { this(token, secret, consumerKey, callbackUrl, null, Collections.<String>emptySet(), new ImmutableMultivaluedMap<>(getImmutableMap(attributes))); }
/** * Get immutable empty message headers container. The factory method can be * used to for both message header container types – inbound * as well as outbound. * * @param <V> header value type. Typically {@link Object} in case of the outbound * headers and {@link String} in case of the inbound headers. * @return an immutable empty message headers container. */ public static <V> MultivaluedMap<String, V> empty() { return ImmutableMultivaluedMap.empty(); }
/** * Returns an empty immutable map. * * @return an empty immutable map. */ public static <K, V> ImmutableMultivaluedMap<K, V> empty() { return new ImmutableMultivaluedMap<K, V>(new MultivaluedHashMap<K, V>()); }
/** * Get immutable empty message headers container. The factory method can be * used to for both message header container types – inbound * as well as outbound. * * @param <V> header value type. Typically {@link Object} in case of the outbound * headers and {@link String} in case of the inbound headers. * @return an immutable empty message headers container. */ public static <V> MultivaluedMap<String, V> empty() { return ImmutableMultivaluedMap.empty(); }
/** * Returns an immutable map of parameterized HTTP header value(s) for this {@code BodyPart}, * keyed by header name. Key comparisons in the returned map must be case-insensitive. If you wish to modify the headers * map for this {@code BodyPart}, modify the map returned by {@code getHeaders()} instead. * * @return immutable map of HTTP header values. * @throws ParseException if an un-expected/in-correct value is found during parsing the headers. */ public MultivaluedMap<String, ParameterizedHeader> getParameterizedHeaders() throws ParseException { return new ImmutableMultivaluedMap<>(new ParameterizedHeadersMap(headers)); }
public Token(final String token, final String secret, final Token requestToken) { this(token, secret, requestToken.getConsumer().getKey(), null, requestToken.principal, requestToken.roles, ImmutableMultivaluedMap.<String, String>empty()); }
/** * Returns an empty immutable map. * * @return an empty immutable map. */ public static <K, V> ImmutableMultivaluedMap<K, V> empty() { return new ImmutableMultivaluedMap<K, V>(new MultivaluedHashMap<K, V>()); }
/** * Get immutable empty message headers container. The factory method can be * used to for both message header container types – inbound * as well as outbound. * * @param <V> header value type. Typically {@link Object} in case of the outbound * headers and {@link String} in case of the inbound headers. * @return an immutable empty message headers container. */ public static <V> MultivaluedMap<String, V> empty() { return ImmutableMultivaluedMap.empty(); }
@Override public MultivaluedMap<String, String> getQueryParameters(final boolean decode) { if (decode) { if (decodedQueryParamsView != null) { return decodedQueryParamsView; } decodedQueryParamsView = new ImmutableMultivaluedMap<>(UriComponent.decodeQuery(getRequestUri(), true)); return decodedQueryParamsView; } else { if (encodedQueryParamsView != null) { return encodedQueryParamsView; } encodedQueryParamsView = new ImmutableMultivaluedMap<>(UriComponent.decodeQuery(getRequestUri(), false)); return encodedQueryParamsView; } }
/** * Get immutable empty message headers container. The factory method can be * used to for both message header container types – inbound * as well as outbound. * * @param <V> header value type. Typically {@link Object} in case of the outbound * headers and {@link String} in case of the inbound headers. * @return an immutable empty message headers container. */ public static <V> MultivaluedMap<String, V> empty() { return ImmutableMultivaluedMap.empty(); }
@Override public MultivaluedMap<String, String> getPathParameters(final boolean decode) { if (decode) { if (decodedTemplateValuesView != null) { return decodedTemplateValuesView; } else if (decodedTemplateValues == null) { decodedTemplateValues = new MultivaluedHashMap<>(); for (final Map.Entry<String, List<String>> e : encodedTemplateValues.entrySet()) { decodedTemplateValues.put( UriComponent.decode(e.getKey(), UriComponent.Type.PATH_SEGMENT), // we need to keep the ability to add new entries e.getValue().stream().map(s -> UriComponent.decode(s, UriComponent.Type.PATH)) .collect(Collectors.toCollection(ArrayList::new))); } } decodedTemplateValuesView = new ImmutableMultivaluedMap<>(decodedTemplateValues); return decodedTemplateValuesView; } else { return encodedTemplateValuesView; } }
/** * Get immutable empty message headers container. The factory method can be * used to for both message header container types – inbound * as well as outbound. * * @param <V> header value type. Typically {@link Object} in case of the outbound * headers and {@link String} in case of the inbound headers. * @return an immutable empty message headers container. */ public static <V> MultivaluedMap<String, V> empty() { return ImmutableMultivaluedMap.empty(); }
@Override public MultivaluedMap<String, String> getPathParameters(final boolean decode) { if (decode) { if (decodedTemplateValuesView != null) { return decodedTemplateValuesView; } else if (decodedTemplateValues == null) { decodedTemplateValues = new MultivaluedHashMap<>(); for (final Map.Entry<String, List<String>> e : encodedTemplateValues.entrySet()) { decodedTemplateValues.put( UriComponent.decode(e.getKey(), UriComponent.Type.PATH_SEGMENT), // we need to keep the ability to add new entries e.getValue().stream().map(s -> UriComponent.decode(s, UriComponent.Type.PATH)) .collect(Collectors.toCollection(ArrayList::new))); } } decodedTemplateValuesView = new ImmutableMultivaluedMap<>(decodedTemplateValues); return decodedTemplateValuesView; } else { return encodedTemplateValuesView; } }
/** * Get immutable empty message headers container. The factory method can be * used to for both message header container types – inbound * as well as outbound. * * @param <V> header value type. Typically {@link Object} in case of the outbound * headers and {@link String} in case of the inbound headers. * @return an immutable empty message headers container. */ public static <V> MultivaluedMap<String, V> empty() { return ImmutableMultivaluedMap.empty(); }
@Override public MultivaluedMap<String, String> getQueryParameters(final boolean decode) { if (decode) { if (decodedQueryParamsView != null) { return decodedQueryParamsView; } decodedQueryParamsView = new ImmutableMultivaluedMap<>(UriComponent.decodeQuery(getRequestUri(), true)); return decodedQueryParamsView; } else { if (encodedQueryParamsView != null) { return encodedQueryParamsView; } encodedQueryParamsView = new ImmutableMultivaluedMap<>(UriComponent.decodeQuery(getRequestUri(), false)); return encodedQueryParamsView; } }
/** * Get immutable empty message headers container. The factory method can be * used to for both message header container types – inbound * as well as outbound. * * @param <V> header value type. Typically {@link Object} in case of the outbound * headers and {@link String} in case of the inbound headers. * @return an immutable empty message headers container. */ public static <V> MultivaluedMap<String, V> empty() { return ImmutableMultivaluedMap.empty(); }
@Override public MultivaluedMap<String, String> getQueryParameters(final boolean decode) { if (decode) { if (decodedQueryParamsView != null) { return decodedQueryParamsView; } decodedQueryParamsView = new ImmutableMultivaluedMap<>(UriComponent.decodeQuery(getRequestUri(), true)); return decodedQueryParamsView; } else { if (encodedQueryParamsView != null) { return encodedQueryParamsView; } encodedQueryParamsView = new ImmutableMultivaluedMap<>(UriComponent.decodeQuery(getRequestUri(), false)); return encodedQueryParamsView; } }
public Token(final String token, final String secret, final Token requestToken) { this(token, secret, requestToken.getConsumer().getKey(), null, requestToken.principal, requestToken.roles, ImmutableMultivaluedMap.<String, String>empty()); }
@Override public MultivaluedMap<String, String> getPathParameters(final boolean decode) { if (decode) { if (decodedTemplateValuesView != null) { return decodedTemplateValuesView; } else if (decodedTemplateValues == null) { decodedTemplateValues = new MultivaluedHashMap<>(); for (final Map.Entry<String, List<String>> e : encodedTemplateValues.entrySet()) { decodedTemplateValues.put( UriComponent.decode(e.getKey(), UriComponent.Type.PATH_SEGMENT), // we need to keep the ability to add new entries e.getValue().stream().map(s -> UriComponent.decode(s, UriComponent.Type.PATH)) .collect(Collectors.toCollection(ArrayList::new))); } } decodedTemplateValuesView = new ImmutableMultivaluedMap<>(decodedTemplateValues); return decodedTemplateValuesView; } else { return encodedTemplateValuesView; } }
public Token(final String token, final String secret, final Token requestToken) { this(token, secret, requestToken.getConsumer().getKey(), null, requestToken.principal, requestToken.roles, ImmutableMultivaluedMap.<String, String>empty()); }