Eliminate use of Optional
This commit is contained in:
parent
10a264c144
commit
2bcd4627fa
|
@ -17,7 +17,6 @@
|
||||||
package org.springframework.security.web.session;
|
package org.springframework.security.web.session;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
@ -47,9 +46,11 @@ public final class RequestedUrlRedirectInvalidSessionStrategy implements Invalid
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInvalidSessionDetected(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
public void onInvalidSessionDetected(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||||
String destinationUrl = this.urlPathHelper.getOriginatingRequestUri(request)
|
String destinationUrl = this.urlPathHelper.getOriginatingRequestUri(request);
|
||||||
+ Optional.ofNullable(this.urlPathHelper.getOriginatingQueryString(request)).filter((s) -> !s.isEmpty())
|
String queryString = this.urlPathHelper.getOriginatingQueryString(request);
|
||||||
.map((s) -> "?" + s).orElse("");
|
if (queryString != null && !queryString.equals("")) {
|
||||||
|
destinationUrl = destinationUrl + "?" + queryString;
|
||||||
|
}
|
||||||
this.logger.debug("Starting new session (if required) and redirecting to '" + destinationUrl + "'");
|
this.logger.debug("Starting new session (if required) and redirecting to '" + destinationUrl + "'");
|
||||||
if (this.createNewSession) {
|
if (this.createNewSession) {
|
||||||
request.getSession();
|
request.getSession();
|
||||||
|
|
Loading…
Reference in New Issue