Consistently use tabs rather than spaces
Update code that has accidentally used spaces instead of tabs. Also remove all trailing whitespace. Issue: SPR-16968
This commit is contained in:
committed by
Juergen Hoeller
parent
be85bd8e09
commit
5cedd0d5d4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -159,7 +159,7 @@ public class HttpComponentsAsyncClientHttpRequestFactory extends HttpComponentsC
|
||||
}
|
||||
|
||||
private HttpAsyncClient startAsyncClient() {
|
||||
HttpAsyncClient client = getAsyncClient();
|
||||
HttpAsyncClient client = getAsyncClient();
|
||||
if (client instanceof CloseableHttpAsyncClient) {
|
||||
CloseableHttpAsyncClient closeableAsyncClient = (CloseableHttpAsyncClient) client;
|
||||
if (!closeableAsyncClient.isRunning()) {
|
||||
@@ -175,10 +175,10 @@ public class HttpComponentsAsyncClientHttpRequestFactory extends HttpComponentsC
|
||||
|
||||
HttpUriRequest httpRequest = createHttpUriRequest(httpMethod, uri);
|
||||
postProcessHttpRequest(httpRequest);
|
||||
HttpContext context = createHttpContext(httpMethod, uri);
|
||||
if (context == null) {
|
||||
context = HttpClientContext.create();
|
||||
}
|
||||
HttpContext context = createHttpContext(httpMethod, uri);
|
||||
if (context == null) {
|
||||
context = HttpClientContext.create();
|
||||
}
|
||||
|
||||
// Request configuration not set in the context
|
||||
if (context.getAttribute(HttpClientContext.REQUEST_CONFIG) == null) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -82,21 +82,21 @@ final class HttpComponentsClientHttpResponse extends AbstractClientHttpResponse
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
// Release underlying connection back to the connection manager
|
||||
try {
|
||||
try {
|
||||
// Attempt to keep connection alive by consuming its remaining content
|
||||
EntityUtils.consume(this.httpResponse.getEntity());
|
||||
}
|
||||
// Release underlying connection back to the connection manager
|
||||
try {
|
||||
try {
|
||||
// Attempt to keep connection alive by consuming its remaining content
|
||||
EntityUtils.consume(this.httpResponse.getEntity());
|
||||
}
|
||||
finally {
|
||||
if (this.httpResponse instanceof Closeable) {
|
||||
((Closeable) this.httpResponse).close();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException ex) {
|
||||
}
|
||||
}
|
||||
catch (IOException ex) {
|
||||
// Ignore exception on close...
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -38,7 +38,7 @@ import org.springframework.util.MultiValueMap;
|
||||
* @since 5.0
|
||||
*/
|
||||
public class ClientHttpRequestDecorator implements ClientHttpRequest {
|
||||
|
||||
|
||||
private final ClientHttpRequest delegate;
|
||||
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.springframework.util.MultiValueMap;
|
||||
* @since 5.0
|
||||
*/
|
||||
public class ClientHttpResponseDecorator implements ClientHttpResponse {
|
||||
|
||||
|
||||
private final ClientHttpResponse delegate;
|
||||
|
||||
|
||||
|
||||
@@ -35,63 +35,63 @@ import org.springframework.lang.Nullable;
|
||||
public final class ServerSentEvent<T> {
|
||||
|
||||
@Nullable
|
||||
private final String id;
|
||||
private final String id;
|
||||
|
||||
@Nullable
|
||||
private final String event;
|
||||
private final String event;
|
||||
|
||||
@Nullable
|
||||
private final Duration retry;
|
||||
private final Duration retry;
|
||||
|
||||
@Nullable
|
||||
private final String comment;
|
||||
private final String comment;
|
||||
|
||||
@Nullable
|
||||
private final T data;
|
||||
|
||||
|
||||
private ServerSentEvent(@Nullable String id, @Nullable String event, @Nullable Duration retry,
|
||||
private ServerSentEvent(@Nullable String id, @Nullable String event, @Nullable Duration retry,
|
||||
@Nullable String comment, @Nullable T data) {
|
||||
|
||||
this.id = id;
|
||||
this.event = event;
|
||||
this.retry = retry;
|
||||
this.comment = comment;
|
||||
this.id = id;
|
||||
this.event = event;
|
||||
this.retry = retry;
|
||||
this.comment = comment;
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the {@code id} field of this event, if available.
|
||||
*/
|
||||
@Nullable
|
||||
public String id() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the {@code event} field of this event, if available.
|
||||
*/
|
||||
/**
|
||||
* Return the {@code id} field of this event, if available.
|
||||
*/
|
||||
@Nullable
|
||||
public String event() {
|
||||
return this.event;
|
||||
}
|
||||
public String id() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the {@code retry} field of this event, if available.
|
||||
*/
|
||||
/**
|
||||
* Return the {@code event} field of this event, if available.
|
||||
*/
|
||||
@Nullable
|
||||
public Duration retry() {
|
||||
return this.retry;
|
||||
}
|
||||
public String event() {
|
||||
return this.event;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the comment of this event, if available.
|
||||
*/
|
||||
/**
|
||||
* Return the {@code retry} field of this event, if available.
|
||||
*/
|
||||
@Nullable
|
||||
public String comment() {
|
||||
return this.comment;
|
||||
}
|
||||
public Duration retry() {
|
||||
return this.retry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the comment of this event, if available.
|
||||
*/
|
||||
@Nullable
|
||||
public String comment() {
|
||||
return this.comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the {@code data} field of this event, if available.
|
||||
@@ -102,11 +102,11 @@ public final class ServerSentEvent<T> {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ("ServerSentEvent [id = '" + this.id + "\', event='" + this.event + "\', retry=" +
|
||||
@Override
|
||||
public String toString() {
|
||||
return ("ServerSentEvent [id = '" + this.id + "\', event='" + this.event + "\', retry=" +
|
||||
this.retry + ", comment='" + this.comment + "', data=" + this.data + ']');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -128,41 +128,41 @@ public final class ServerSentEvent<T> {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A mutable builder for a {@code SseEvent}.
|
||||
*
|
||||
* @param <T> the type of data that this event contains
|
||||
*/
|
||||
public interface Builder<T> {
|
||||
/**
|
||||
* A mutable builder for a {@code SseEvent}.
|
||||
*
|
||||
* @param <T> the type of data that this event contains
|
||||
*/
|
||||
public interface Builder<T> {
|
||||
|
||||
/**
|
||||
* Set the value of the {@code id} field.
|
||||
* @param id the value of the id field
|
||||
* @return {@code this} builder
|
||||
*/
|
||||
Builder<T> id(String id);
|
||||
/**
|
||||
* Set the value of the {@code id} field.
|
||||
* @param id the value of the id field
|
||||
* @return {@code this} builder
|
||||
*/
|
||||
Builder<T> id(String id);
|
||||
|
||||
/**
|
||||
* Set the value of the {@code event} field.
|
||||
* @param event the value of the event field
|
||||
* @return {@code this} builder
|
||||
*/
|
||||
Builder<T> event(String event);
|
||||
/**
|
||||
* Set the value of the {@code event} field.
|
||||
* @param event the value of the event field
|
||||
* @return {@code this} builder
|
||||
*/
|
||||
Builder<T> event(String event);
|
||||
|
||||
/**
|
||||
* Set the value of the {@code retry} field.
|
||||
* @param retry the value of the retry field
|
||||
* @return {@code this} builder
|
||||
*/
|
||||
Builder<T> retry(Duration retry);
|
||||
/**
|
||||
* Set the value of the {@code retry} field.
|
||||
* @param retry the value of the retry field
|
||||
* @return {@code this} builder
|
||||
*/
|
||||
Builder<T> retry(Duration retry);
|
||||
|
||||
/**
|
||||
* Set SSE comment. If a multi-line comment is provided, it will be turned into multiple
|
||||
* SSE comment lines as defined in Server-Sent Events W3C recommendation.
|
||||
* @param comment the comment to set
|
||||
* @return {@code this} builder
|
||||
*/
|
||||
Builder<T> comment(String comment);
|
||||
/**
|
||||
* Set SSE comment. If a multi-line comment is provided, it will be turned into multiple
|
||||
* SSE comment lines as defined in Server-Sent Events W3C recommendation.
|
||||
* @param comment the comment to set
|
||||
* @return {@code this} builder
|
||||
*/
|
||||
Builder<T> comment(String comment);
|
||||
|
||||
/**
|
||||
* Set the value of the {@code data} field. If the {@code data} argument is a multi-line
|
||||
@@ -174,61 +174,61 @@ public final class ServerSentEvent<T> {
|
||||
*/
|
||||
Builder<T> data(@Nullable T data);
|
||||
|
||||
/**
|
||||
* Builds the event.
|
||||
* @return the built event
|
||||
*/
|
||||
ServerSentEvent<T> build();
|
||||
}
|
||||
/**
|
||||
* Builds the event.
|
||||
* @return the built event
|
||||
*/
|
||||
ServerSentEvent<T> build();
|
||||
}
|
||||
|
||||
|
||||
private static class BuilderImpl<T> implements Builder<T> {
|
||||
private static class BuilderImpl<T> implements Builder<T> {
|
||||
|
||||
@Nullable
|
||||
private String id;
|
||||
private String id;
|
||||
|
||||
@Nullable
|
||||
private String event;
|
||||
private String event;
|
||||
|
||||
@Nullable
|
||||
private Duration retry;
|
||||
private Duration retry;
|
||||
|
||||
@Nullable
|
||||
private String comment;
|
||||
private String comment;
|
||||
|
||||
@Nullable
|
||||
private T data;
|
||||
|
||||
public BuilderImpl() {
|
||||
}
|
||||
}
|
||||
|
||||
public BuilderImpl(T data) {
|
||||
this.data = data;
|
||||
}
|
||||
public BuilderImpl(T data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder<T> id(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public Builder<T> id(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder<T> event(String event) {
|
||||
this.event = event;
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public Builder<T> event(String event) {
|
||||
this.event = event;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder<T> retry(Duration retry) {
|
||||
this.retry = retry;
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public Builder<T> retry(Duration retry) {
|
||||
this.retry = retry;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder<T> comment(String comment) {
|
||||
this.comment = comment;
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public Builder<T> comment(String comment) {
|
||||
this.comment = comment;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder<T> data(@Nullable T data) {
|
||||
@@ -236,10 +236,10 @@ public final class ServerSentEvent<T> {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerSentEvent<T> build() {
|
||||
return new ServerSentEvent<>(this.id, this.event, this.retry, this.comment, this.data);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public ServerSentEvent<T> build() {
|
||||
return new ServerSentEvent<>(this.id, this.event, this.retry, this.comment, this.data);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ public abstract class AbstractJackson2Encoder extends Jackson2CodecSupport imple
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
protected ObjectWriter customizeWriter(ObjectWriter writer, @Nullable MimeType mimeType,
|
||||
ResolvableType elementType, @Nullable Map<String, Object> hints) {
|
||||
|
||||
@@ -227,5 +227,5 @@ public abstract class AbstractJackson2Encoder extends Jackson2CodecSupport imple
|
||||
protected <A extends Annotation> A getAnnotation(MethodParameter parameter, Class<A> annotType) {
|
||||
return parameter.getMethodAnnotation(annotType);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class Jackson2JsonEncoder extends AbstractJackson2Encoder {
|
||||
|
||||
@Nullable
|
||||
private final PrettyPrinter ssePrettyPrinter;
|
||||
|
||||
|
||||
|
||||
public Jackson2JsonEncoder() {
|
||||
this(Jackson2ObjectMapperBuilder.json().build());
|
||||
@@ -70,7 +70,7 @@ public class Jackson2JsonEncoder extends AbstractJackson2Encoder {
|
||||
@Override
|
||||
protected ObjectWriter customizeWriter(ObjectWriter writer, @Nullable MimeType mimeType,
|
||||
ResolvableType elementType, @Nullable Map<String, Object> hints) {
|
||||
|
||||
|
||||
return (this.ssePrettyPrinter != null &&
|
||||
MediaType.TEXT_EVENT_STREAM.isCompatibleWith(mimeType) &&
|
||||
writer.getConfig().isEnabled(SerializationFeature.INDENT_OUTPUT) ?
|
||||
|
||||
@@ -43,8 +43,8 @@ public class Jackson2SmileEncoder extends AbstractJackson2Encoder {
|
||||
private static final MimeType[] DEFAULT_SMILE_MIME_TYPES = new MimeType[] {
|
||||
new MimeType("application", "x-jackson-smile", StandardCharsets.UTF_8),
|
||||
new MimeType("application", "*+x-jackson-smile", StandardCharsets.UTF_8)};
|
||||
|
||||
|
||||
|
||||
|
||||
public Jackson2SmileEncoder() {
|
||||
this(Jackson2ObjectMapperBuilder.smile().build(), DEFAULT_SMILE_MIME_TYPES);
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ public class SynchronossPartHttpMessageReader extends LoggingCodecSupport implem
|
||||
private final ReactiveHttpInputMessage inputMessage;
|
||||
|
||||
private final DataBufferFactory bufferFactory;
|
||||
|
||||
|
||||
private final PartBodyStreamStorageFactory streamStorageFactory;
|
||||
|
||||
SynchronossPartGenerator(ReactiveHttpInputMessage inputMessage, DataBufferFactory bufferFactory,
|
||||
|
||||
@@ -35,6 +35,6 @@ public interface ExtensionRegistryInitializer {
|
||||
* Initializes the {@code ExtensionRegistry} with Protocol Message extensions.
|
||||
* @param registry the registry to populate
|
||||
*/
|
||||
void initializeExtensionRegistry(ExtensionRegistry registry);
|
||||
void initializeExtensionRegistry(ExtensionRegistry registry);
|
||||
|
||||
}
|
||||
|
||||
@@ -108,10 +108,10 @@ class ServletServerHttpRequest extends AbstractServerHttpRequest {
|
||||
private static HttpHeaders initHeaders(HttpServletRequest request) {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
for (Enumeration<?> names = request.getHeaderNames();
|
||||
names.hasMoreElements(); ) {
|
||||
names.hasMoreElements(); ) {
|
||||
String name = (String) names.nextElement();
|
||||
for (Enumeration<?> values = request.getHeaders(name);
|
||||
values.hasMoreElements(); ) {
|
||||
values.hasMoreElements(); ) {
|
||||
headers.add(name, (String) values.nextElement());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -63,10 +63,10 @@ public class HessianServiceExporter extends HessianExporter implements HttpReque
|
||||
|
||||
response.setContentType(CONTENT_TYPE_HESSIAN);
|
||||
try {
|
||||
invoke(request.getInputStream(), response.getOutputStream());
|
||||
invoke(request.getInputStream(), response.getOutputStream());
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
throw new NestedServletException("Hessian skeleton invocation failed", ex);
|
||||
throw new NestedServletException("Hessian skeleton invocation failed", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -28,7 +28,7 @@ import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Package-private implementation of {@link ServerWebExchange.Builder}.
|
||||
*
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 5.0
|
||||
*/
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.springframework.web.server.ServerWebExchange;
|
||||
|
||||
/**
|
||||
* Request and response header-based {@link WebSessionIdResolver}.
|
||||
*
|
||||
*
|
||||
* @author Greg Turnquist
|
||||
* @author Rob Winch
|
||||
* @since 5.0
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -58,7 +58,7 @@ public class CookieGenerator {
|
||||
|
||||
private String cookiePath = DEFAULT_COOKIE_PATH;
|
||||
|
||||
@Nullable
|
||||
@Nullable
|
||||
private Integer cookieMaxAge;
|
||||
|
||||
private boolean cookieSecure = false;
|
||||
|
||||
@@ -124,7 +124,7 @@ class HtmlCharacterEntityReferences {
|
||||
*/
|
||||
@Nullable
|
||||
public String convertToReference(char character) {
|
||||
return convertToReference(character, WebUtils.DEFAULT_CHARACTER_ENCODING);
|
||||
return convertToReference(character, WebUtils.DEFAULT_CHARACTER_ENCODING);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,25 +36,25 @@ import org.springframework.util.SystemPropertyUtils;
|
||||
*/
|
||||
public abstract class ServletContextPropertyUtils {
|
||||
|
||||
private static final PropertyPlaceholderHelper strictHelper =
|
||||
new PropertyPlaceholderHelper(SystemPropertyUtils.PLACEHOLDER_PREFIX,
|
||||
private static final PropertyPlaceholderHelper strictHelper =
|
||||
new PropertyPlaceholderHelper(SystemPropertyUtils.PLACEHOLDER_PREFIX,
|
||||
SystemPropertyUtils.PLACEHOLDER_SUFFIX, SystemPropertyUtils.VALUE_SEPARATOR, false);
|
||||
|
||||
private static final PropertyPlaceholderHelper nonStrictHelper =
|
||||
new PropertyPlaceholderHelper(SystemPropertyUtils.PLACEHOLDER_PREFIX,
|
||||
private static final PropertyPlaceholderHelper nonStrictHelper =
|
||||
new PropertyPlaceholderHelper(SystemPropertyUtils.PLACEHOLDER_PREFIX,
|
||||
SystemPropertyUtils.PLACEHOLDER_SUFFIX, SystemPropertyUtils.VALUE_SEPARATOR, true);
|
||||
|
||||
|
||||
/**
|
||||
* Resolve ${...} placeholders in the given text, replacing them with corresponding
|
||||
* servlet context init parameter or system property values.
|
||||
* @param text the String to resolve
|
||||
* @param servletContext the servletContext to use for lookups.
|
||||
* @param text the String to resolve
|
||||
* @param servletContext the servletContext to use for lookups.
|
||||
* @return the resolved String
|
||||
* @throws IllegalArgumentException if there is an unresolvable placeholder
|
||||
* @see SystemPropertyUtils#PLACEHOLDER_PREFIX
|
||||
* @see SystemPropertyUtils#PLACEHOLDER_SUFFIX
|
||||
* @see SystemPropertyUtils#resolvePlaceholders(String, boolean)
|
||||
* @see SystemPropertyUtils#resolvePlaceholders(String, boolean)
|
||||
*/
|
||||
public static String resolvePlaceholders(String text, ServletContext servletContext) {
|
||||
return resolvePlaceholders(text, servletContext, false);
|
||||
@@ -65,13 +65,13 @@ public abstract class ServletContextPropertyUtils {
|
||||
* servlet context init parameter or system property values. Unresolvable placeholders
|
||||
* with no default value are ignored and passed through unchanged if the flag is set to true.
|
||||
* @param text the String to resolve
|
||||
* @param servletContext the servletContext to use for lookups.
|
||||
* @param servletContext the servletContext to use for lookups.
|
||||
* @param ignoreUnresolvablePlaceholders flag to determine is unresolved placeholders are ignored
|
||||
* @return the resolved String
|
||||
* @throws IllegalArgumentException if there is an unresolvable placeholder and the flag is false
|
||||
* @see SystemPropertyUtils#PLACEHOLDER_PREFIX
|
||||
* @see SystemPropertyUtils#PLACEHOLDER_SUFFIX
|
||||
* @see SystemPropertyUtils#resolvePlaceholders(String, boolean)
|
||||
* @see SystemPropertyUtils#resolvePlaceholders(String, boolean)
|
||||
*/
|
||||
public static String resolvePlaceholders(String text, ServletContext servletContext,
|
||||
boolean ignoreUnresolvablePlaceholders) {
|
||||
@@ -84,20 +84,20 @@ public abstract class ServletContextPropertyUtils {
|
||||
private static class ServletContextPlaceholderResolver
|
||||
implements PropertyPlaceholderHelper.PlaceholderResolver {
|
||||
|
||||
private final String text;
|
||||
private final String text;
|
||||
|
||||
private final ServletContext servletContext;
|
||||
private final ServletContext servletContext;
|
||||
|
||||
public ServletContextPlaceholderResolver(String text, ServletContext servletContext) {
|
||||
this.text = text;
|
||||
this.servletContext = servletContext;
|
||||
}
|
||||
public ServletContextPlaceholderResolver(String text, ServletContext servletContext) {
|
||||
this.text = text;
|
||||
this.servletContext = servletContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String resolvePlaceholder(String placeholderName) {
|
||||
try {
|
||||
String propVal = this.servletContext.getInitParameter(placeholderName);
|
||||
try {
|
||||
String propVal = this.servletContext.getInitParameter(placeholderName);
|
||||
if (propVal == null) {
|
||||
// Fall back to system properties.
|
||||
propVal = System.getProperty(placeholderName);
|
||||
@@ -108,12 +108,12 @@ public abstract class ServletContextPropertyUtils {
|
||||
}
|
||||
return propVal;
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
System.err.println("Could not resolve placeholder '" + placeholderName + "' in [" +
|
||||
this.text + "] as ServletContext init-parameter or system property: " + ex);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
System.err.println("Could not resolve placeholder '" + placeholderName + "' in [" +
|
||||
this.text + "] as ServletContext init-parameter or system property: " + ex);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -102,20 +102,20 @@ public class UriTemplate implements Serializable {
|
||||
return encodedComponents.toUri();
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an array of variables, expand this template into a full URI. The array represent variable values.
|
||||
* The order of variables is significant.
|
||||
* <p>Example:
|
||||
* <pre class="code">
|
||||
* UriTemplate template = new UriTemplate("http://example.com/hotels/{hotel}/bookings/{booking}");
|
||||
* System.out.println(template.expand("Rest & Relax", 42));
|
||||
* </pre>
|
||||
* will print: <blockquote>{@code http://example.com/hotels/Rest%20%26%20Relax/bookings/42}</blockquote>
|
||||
* @param uriVariableValues the array of URI variables
|
||||
* @return the expanded URI
|
||||
* @throws IllegalArgumentException if {@code uriVariables} is {@code null}
|
||||
* or if it does not contain sufficient variables
|
||||
*/
|
||||
/**
|
||||
* Given an array of variables, expand this template into a full URI. The array represent variable values.
|
||||
* The order of variables is significant.
|
||||
* <p>Example:
|
||||
* <pre class="code">
|
||||
* UriTemplate template = new UriTemplate("http://example.com/hotels/{hotel}/bookings/{booking}");
|
||||
* System.out.println(template.expand("Rest & Relax", 42));
|
||||
* </pre>
|
||||
* will print: <blockquote>{@code http://example.com/hotels/Rest%20%26%20Relax/bookings/42}</blockquote>
|
||||
* @param uriVariableValues the array of URI variables
|
||||
* @return the expanded URI
|
||||
* @throws IllegalArgumentException if {@code uriVariables} is {@code null}
|
||||
* or if it does not contain sufficient variables
|
||||
*/
|
||||
public URI expand(Object... uriVariableValues) {
|
||||
UriComponents expandedComponents = this.uriComponents.expand(uriVariableValues);
|
||||
UriComponents encodedComponents = expandedComponents.encode();
|
||||
|
||||
@@ -107,8 +107,8 @@ class CaptureVariablePathElement extends PathElement {
|
||||
match = (pathIndex == matchingContext.pathLength);
|
||||
if (!match && matchingContext.isMatchOptionalTrailingSeparator()) {
|
||||
match = //(nextPos > candidateIndex) &&
|
||||
(pathIndex + 1) == matchingContext.pathLength &&
|
||||
matchingContext.isSeparator(pathIndex);
|
||||
(pathIndex + 1) == matchingContext.pathLength &&
|
||||
matchingContext.isSeparator(pathIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ class RegexPathElement extends PathElement {
|
||||
patternBuilder.append(".*");
|
||||
int pos = matcher.start();
|
||||
if (pos < 1 || text.charAt(pos-1) != '.') {
|
||||
// To be compatible with the AntPathMatcher comparator,
|
||||
// To be compatible with the AntPathMatcher comparator,
|
||||
// '.*' is not considered a wildcard usage
|
||||
this.wildcardCount++;
|
||||
}
|
||||
@@ -129,13 +129,13 @@ class RegexPathElement extends PathElement {
|
||||
|
||||
@Override
|
||||
public boolean matches(int pathIndex, MatchingContext matchingContext) {
|
||||
String textToMatch = matchingContext.pathElementValue(pathIndex);
|
||||
String textToMatch = matchingContext.pathElementValue(pathIndex);
|
||||
Matcher matcher = this.pattern.matcher(textToMatch);
|
||||
boolean matches = matcher.matches();
|
||||
|
||||
if (matches) {
|
||||
if (isNoMorePattern()) {
|
||||
if (matchingContext.determineRemainingPath &&
|
||||
if (matchingContext.determineRemainingPath &&
|
||||
(this.variableNames.isEmpty() ? true : textToMatch.length() > 0)) {
|
||||
matchingContext.remainingPathIndex = pathIndex + 1;
|
||||
matches = true;
|
||||
@@ -143,12 +143,13 @@ class RegexPathElement extends PathElement {
|
||||
else {
|
||||
// No more pattern, is there more data?
|
||||
// If pattern is capturing variables there must be some actual data to bind to them
|
||||
matches = (pathIndex + 1) >= matchingContext.pathLength &&
|
||||
(this.variableNames.isEmpty() || textToMatch.length() > 0);
|
||||
matches = (pathIndex + 1) >= matchingContext.pathLength
|
||||
&& (this.variableNames.isEmpty() || textToMatch.length() > 0);
|
||||
if (!matches && matchingContext.isMatchOptionalTrailingSeparator()) {
|
||||
matches = (this.variableNames.isEmpty() || textToMatch.length() > 0) &&
|
||||
(pathIndex + 2) >= matchingContext.pathLength &&
|
||||
matchingContext.isSeparator(pathIndex + 1);
|
||||
matches = (this.variableNames.isEmpty()
|
||||
|| textToMatch.length() > 0)
|
||||
&& (pathIndex + 2) >= matchingContext.pathLength
|
||||
&& matchingContext.isSeparator(pathIndex + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -176,7 +177,7 @@ class RegexPathElement extends PathElement {
|
||||
}
|
||||
return matches;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getNormalizedLength() {
|
||||
int varsLength = 0;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -65,7 +65,7 @@ class SeparatorPathElement extends PathElement {
|
||||
public String toString() {
|
||||
return "Separator(" + this.separator + ")";
|
||||
}
|
||||
|
||||
|
||||
public char[] getChars() {
|
||||
return new char[] {this.separator};
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ class SingleCharWildcardedPathElement extends PathElement {
|
||||
// Not enough data to match this path element
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
char[] data = ((PathSegment)element).valueToMatchAsChars();
|
||||
if (this.caseSensitive) {
|
||||
for (int i = 0; i < this.len; i++) {
|
||||
@@ -92,7 +92,7 @@ class SingleCharWildcardedPathElement extends PathElement {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pathIndex++;
|
||||
if (isNoMorePattern()) {
|
||||
if (matchingContext.determineRemainingPath) {
|
||||
@@ -129,7 +129,7 @@ class SingleCharWildcardedPathElement extends PathElement {
|
||||
public String toString() {
|
||||
return "SingleCharWildcarded(" + String.valueOf(this.text) + ")";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public char[] getChars() {
|
||||
return this.text;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,7 +22,7 @@ import org.springframework.web.util.pattern.PathPattern.MatchingContext;
|
||||
|
||||
/**
|
||||
* A wildcard path element. In the pattern '/foo/*/goo' the * is
|
||||
* represented by a WildcardPathElement. Within a path it matches at least
|
||||
* represented by a WildcardPathElement. Within a path it matches at least
|
||||
* one character but at the end of a path it can match zero characters.
|
||||
*
|
||||
* @author Andy Clement
|
||||
@@ -36,7 +36,7 @@ class WildcardPathElement extends PathElement {
|
||||
|
||||
|
||||
/**
|
||||
* Matching on a WildcardPathElement is quite straight forward. Scan the
|
||||
* Matching on a WildcardPathElement is quite straight forward. Scan the
|
||||
* candidate from the candidateIndex onwards for the next separator or the end of the
|
||||
* candidate.
|
||||
*/
|
||||
@@ -53,7 +53,7 @@ class WildcardPathElement extends PathElement {
|
||||
segmentData = ((PathContainer.PathSegment)element).valueToMatch();
|
||||
pathIndex++;
|
||||
}
|
||||
|
||||
|
||||
if (isNoMorePattern()) {
|
||||
if (matchingContext.determineRemainingPath) {
|
||||
matchingContext.remainingPathIndex = pathIndex;
|
||||
@@ -72,7 +72,7 @@ class WildcardPathElement extends PathElement {
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
else {
|
||||
// Within a path (e.g. /aa/*/bb) there must be at least one character to match the wildcard
|
||||
if (segmentData == null || segmentData.length() == 0) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user