Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added deprecated methods back to retain backwards compatibility #4317

Merged
merged 1 commit into from
Dec 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public static MultivaluedMap<String, String> asStringHeaders(
/**
* Transforms multi value map of headers to single {@code String} value map.
*
* Returned map is immutable. Map values are formatted using method {@link #asHeaderString}.
* Returned map is immutable. Map values are formatted using method {@link #asHeaderString(List, RuntimeDelegate)}.
*
* @param headers headers to be formatted
* @param configuration the {@link Configuration} that may contain
Expand Down Expand Up @@ -298,6 +298,81 @@ public static void checkHeaderChanges(final Map<String, String> headersSnapshot,
}
}

/**
* Convert a message header value, represented as a general object, to it's
* string representation. If the supplied header value is {@code null},
* this method returns {@code null}.
*
* @param headerValue the header value represented as an object.
* @return the string representation of the supplied header value or {@code null}
* if the supplied header value is {@code null}.
* @see #asString(Object, Configuration)
*/
@Deprecated
public static String asString(final Object headerValue) {
return asString(headerValue, (Configuration) null);
}

/**
* Returns string view of list of header values. Any modifications to the underlying list are visible to the view,
* the view also supports removal of elements. Does not support other modifications.
*
* @param headerValues header values.
* @return String view of header values.
* @see #asStringList(List, Configuration)
*/
@Deprecated
public static List<String> asStringList(final List<Object> headerValues) {
return asStringList(headerValues, (Configuration) null);
}

/**
* Returns string view of passed headers. Any modifications to the headers are visible to the view, the view also
* supports removal of elements. Does not support other modifications.
*
* @param headers headers.
* @return String view of headers or {@code null} if {code headers} input parameter is {@code null}.
* @see #asStringHeaders(MultivaluedMap, Configuration)
*/
@Deprecated
public static MultivaluedMap<String, String> asStringHeaders(final MultivaluedMap<String, Object> headers) {
return asStringHeaders(headers, (Configuration) null);
}

/**
* Transforms multi value map of headers to single {@code String} value map.
*
* Returned map is immutable. Map values are formatted using method {@link #asHeaderString(List, RuntimeDelegate)}.
*
* @param headers headers to be formatted
* @return immutable single {@code String} value map or
* {@code null} if {@code headers} input parameter is {@code null}.
* @see #asStringHeadersSingleValue(MultivaluedMap, Configuration)
*/
@Deprecated
public static Map<String, String> asStringHeadersSingleValue(final MultivaluedMap<String, Object> headers) {
return asStringHeadersSingleValue(headers, (Configuration) null);
}

/**
* Compares two snapshots of headers from jersey {@code ClientRequest} and logs {@code WARNING} in case of difference.
*
* Current container implementations does not support header modification in {@link javax.ws.rs.ext.WriterInterceptor}
* and {@link javax.ws.rs.ext.MessageBodyWriter}. The method checks there are some newly added headers
* (probably by WI or MBW) and logs {@code WARNING} message about it.
*
* @param headersSnapshot first immutable snapshot of headers
* @param currentHeaders current instance of headers tobe compared to
* @param connectorName name of connector the method is invoked from, used just in logged message
* @see #checkHeaderChanges(Map, MultivaluedMap, String, Configuration)
*/
@Deprecated
public static void checkHeaderChanges(final Map<String, String> headersSnapshot,
final MultivaluedMap<String, Object> currentHeaders,
final String connectorName) {
checkHeaderChanges(headersSnapshot, currentHeaders, connectorName, (Configuration) null);
}

/**
* Preventing instantiation.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,28 @@ public InboundMessageContext(Configuration configuration, boolean translateNce)
this.configuration = configuration;
}

/**
* Create new inbound message context.
* @see #InboundMessageContext(Configuration)
*/
@Deprecated
public InboundMessageContext() {
this((Configuration) null);
}

/**
* Create new inbound message context.
*
* @param translateNce if {@code true}, the {@link javax.ws.rs.core.NoContentException} thrown by a
* selected message body reader will be translated into a {@link javax.ws.rs.BadRequestException}
* as required by JAX-RS specification on the server side. *
* @see #InboundMessageContext(Configuration)
*/
@Deprecated
public InboundMessageContext(boolean translateNce) {
this((Configuration) null, translateNce);
}

// Message headers

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,18 @@ public static OutboundJaxrsResponse from(Response response, Configuration config
}
}

/**
* Get an OutboundJaxrsResponse instance for a given JAX-RS response.
*
* @param response response instance to from.
* @return corresponding {@code OutboundJaxrsResponse} instance.
* @see #from(Response, Configuration)
*/
@Deprecated
public static OutboundJaxrsResponse from(Response response) {
return from(response, (Configuration) null);
}

/**
* Create new outbound JAX-RS response message instance.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,16 @@ public OutboundMessageContext(OutboundMessageContext original) {
this.configuration = original.configuration;
}

/**
* Create new outbound message context.
*
* @see #OutboundMessageContext(Configuration)
*/
@Deprecated
public OutboundMessageContext() {
this ((Configuration) null);
}

/**
* Replace all headers.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,30 @@ public ContainerRequest(
this.uriRoutingContext = new UriRoutingContext(this);
}

/**
* Create new Jersey container request context.
*
* @param baseUri base application URI.
* @param requestUri request URI.
* @param httpMethod request HTTP method name.
* @param securityContext security context of the current request. Must not be {@code null}.
* The {@link SecurityContext#getUserPrincipal()} must return
* {@code null} if the current request has not been authenticated
* by the container.
* @param propertiesDelegate custom {@link PropertiesDelegate properties delegate}
* to be used by the context.
* @see #ContainerRequest(URI, URI, String, SecurityContext, PropertiesDelegate, Configuration)
*/
@Deprecated
public ContainerRequest(
final URI baseUri,
final URI requestUri,
final String httpMethod,
final SecurityContext securityContext,
final PropertiesDelegate propertiesDelegate) {
this(baseUri, requestUri, httpMethod, securityContext, propertiesDelegate, (Configuration) null);
}

/**
* Get a custom container extensions initializer for the current request.
* <p/>
Expand Down