Skip to content

Commit ea4a174

Browse files
committed
Polishing
1 parent 3d6476d commit ea4a174

File tree

2 files changed

+23
-25
lines changed

2 files changed

+23
-25
lines changed

spring-web/src/main/java/org/springframework/http/server/reactive/UndertowServerHttpRequest.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,15 @@ public UndertowServerHttpRequest(HttpServerExchange exchange, DataBufferFactory
7171
}
7272

7373
private static URI initUri(HttpServerExchange exchange) throws URISyntaxException {
74-
Assert.notNull(exchange, "HttpServerExchange is required.");
74+
Assert.notNull(exchange, "HttpServerExchange is required");
7575
String requestURL = exchange.getRequestURL();
7676
String query = exchange.getQueryString();
7777
String requestUriAndQuery = (StringUtils.hasLength(query) ? requestURL + "?" + query : requestURL);
7878
return new URI(requestUriAndQuery);
7979
}
8080

8181
private static HttpHeaders initHeaders(HttpServerExchange exchange) {
82-
UndertowHeadersAdapter headersMap =
83-
new UndertowHeadersAdapter(exchange.getRequestHeaders());
84-
return new HttpHeaders(headersMap);
82+
return new HttpHeaders(new UndertowHeadersAdapter(exchange.getRequestHeaders()));
8583
}
8684

8785
@Override

spring-webflux/src/main/java/org/springframework/web/reactive/result/view/RedirectView.java

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -44,8 +44,8 @@
4444
* URI template in which case the URI template variables will be replaced with
4545
* values from the model or with URI variables from the current request.
4646
*
47-
* <p>By default {@link HttpStatus#SEE_OTHER} is used but alternate status
48-
* codes may be via constructor or setters arguments.
47+
* <p>By default {@link HttpStatus#SEE_OTHER} is used but alternate status codes
48+
* may be via constructor or setters arguments.
4949
*
5050
* @author Sebastien Deleuze
5151
* @author Rossen Stoyanchev
@@ -56,10 +56,10 @@ public class RedirectView extends AbstractUrlBasedView {
5656
private static final Pattern URI_TEMPLATE_VARIABLE_PATTERN = Pattern.compile("\\{([^/]+?)\\}");
5757

5858

59-
private boolean contextRelative = true;
60-
6159
private HttpStatus statusCode = HttpStatus.SEE_OTHER;
6260

61+
private boolean contextRelative = true;
62+
6363
private boolean propagateQuery = false;
6464

6565
@Nullable
@@ -91,22 +91,6 @@ public RedirectView(String redirectUrl, HttpStatus statusCode) {
9191
}
9292

9393

94-
/**
95-
* Whether to interpret a given redirect URLs that starts with a slash ("/")
96-
* as relative to the current context path ({@code true}, the default) or to
97-
* the web server root ({@code false}).
98-
*/
99-
public void setContextRelative(boolean contextRelative) {
100-
this.contextRelative = contextRelative;
101-
}
102-
103-
/**
104-
* Whether to interpret URLs as relative to the current context path.
105-
*/
106-
public boolean isContextRelative() {
107-
return this.contextRelative;
108-
}
109-
11094
/**
11195
* Set an alternate redirect status code such as
11296
* {@link HttpStatus#TEMPORARY_REDIRECT} or
@@ -124,6 +108,22 @@ public HttpStatus getStatusCode() {
124108
return this.statusCode;
125109
}
126110

111+
/**
112+
* Whether to interpret a given redirect URLs that starts with a slash ("/")
113+
* as relative to the current context path ({@code true}, the default) or to
114+
* the web server root ({@code false}).
115+
*/
116+
public void setContextRelative(boolean contextRelative) {
117+
this.contextRelative = contextRelative;
118+
}
119+
120+
/**
121+
* Whether to interpret URLs as relative to the current context path.
122+
*/
123+
public boolean isContextRelative() {
124+
return this.contextRelative;
125+
}
126+
127127
/**
128128
* Whether to append the query string of the current URL to the redirect URL
129129
* ({@code true}) or not ({@code false}, the default).

0 commit comments

Comments
 (0)