diff options
author | Jon Bratseth <bratseth@oath.com> | 2019-01-10 16:58:39 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@oath.com> | 2019-01-10 16:58:39 +0100 |
commit | bf43cc85cdae96022904359acd3e8f443811fdcf (patch) | |
tree | aca560ee9265389a9dcc6dcdbcc4d8fbe915f9c4 /jdisc_http_service | |
parent | f89e354e0cca24089a63557f1efbc1ace3713b23 (diff) |
Nonfunctional changes only
Diffstat (limited to 'jdisc_http_service')
-rw-r--r-- | jdisc_http_service/src/main/java/com/yahoo/jdisc/http/filter/DiscFilterRequest.java | 33 | ||||
-rw-r--r-- | jdisc_http_service/src/main/java/com/yahoo/jdisc/http/servlet/ServletRequest.java | 3 |
2 files changed, 16 insertions, 20 deletions
diff --git a/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/filter/DiscFilterRequest.java b/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/filter/DiscFilterRequest.java index da76e288a2a..f7ab399574c 100644 --- a/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/filter/DiscFilterRequest.java +++ b/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/filter/DiscFilterRequest.java @@ -67,8 +67,7 @@ public abstract class DiscFilterRequest { public abstract void setUri(URI uri); public HttpRequest getParentRequest() { - throw new UnsupportedOperationException( - "getParentRequest is not supported for " + parent.getClass().getName()); + throw new UnsupportedOperationException("getParentRequest is not supported for " + parent.getClass().getName()); } /** @@ -340,8 +339,8 @@ public abstract class DiscFilterRequest { * is included in the specified logical "role". */ public boolean isUserInRole(String role) { - if(overrideIsUserInRole) { - if(roles != null) { + if (overrideIsUserInRole) { + if (roles != null) { for (String role1 : roles) { if (role1 != null && role1.trim().length() > 0) { String userRole = role1.trim(); @@ -400,7 +399,7 @@ public abstract class DiscFilterRequest { */ public void setCharacterEncoding(String encoding) { String charEncoding = setCharsetFromContentType(this.getContentType(), encoding); - if(charEncoding != null && !charEncoding.isEmpty()) { + if (charEncoding != null && !charEncoding.isEmpty()) { removeHeaders(HttpHeaders.Names.CONTENT_TYPE); setHeaders(HttpHeaders.Names.CONTENT_TYPE, charEncoding); } @@ -410,11 +409,11 @@ public abstract class DiscFilterRequest { * Can be called multiple times to add Cookies */ public void addCookie(JDiscCookieWrapper cookie) { - if(cookie != null) { - List<Cookie> cookies = new ArrayList<Cookie>(); - //Get current set of cookies first + if (cookie != null) { + List<Cookie> cookies = new ArrayList<>(); + // Get current set of cookies first List<Cookie> c = getCookies(); - if(c != null && !c.isEmpty()) { + if (c != null && !c.isEmpty()) { cookies.addAll(c); } cookies.add(cookie.getCookie()); @@ -426,7 +425,7 @@ public abstract class DiscFilterRequest { public JDiscCookieWrapper[] getWrappedCookies() { List<Cookie> cookies = getCookies(); - if(cookies == null) { + if (cookies == null) { return null; } List<JDiscCookieWrapper> cookieWrapper = new ArrayList<>(cookies.size()); @@ -508,12 +507,9 @@ public abstract class DiscFilterRequest { } protected static ThreadLocalSimpleDateFormat formats[] = { - new ThreadLocalSimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", - Locale.US), - new ThreadLocalSimpleDateFormat("EEEEEE, dd-MMM-yy HH:mm:ss zzz", - Locale.US), - new ThreadLocalSimpleDateFormat("EEE MMMM d HH:mm:ss yyyy", - Locale.US) }; + new ThreadLocalSimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US), + new ThreadLocalSimpleDateFormat("EEEEEE, dd-MMM-yy HH:mm:ss zzz", Locale.US), + new ThreadLocalSimpleDateFormat("EEE MMMM d HH:mm:ss yyyy", Locale.US) }; /** * The set of SimpleDateFormat formats to use in getDateHeader(). @@ -521,8 +517,8 @@ public abstract class DiscFilterRequest { * Notice that because SimpleDateFormat is not thread-safe, we can't declare * formats[] as a static variable. */ - protected static final class ThreadLocalSimpleDateFormat extends - ThreadLocal<SimpleDateFormat> { + protected static final class ThreadLocalSimpleDateFormat extends ThreadLocal<SimpleDateFormat> { + private final String format; private final Locale locale; @@ -541,6 +537,7 @@ public abstract class DiscFilterRequest { public Date parse(String value) throws ParseException { return get().parse(value); } + } } diff --git a/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/servlet/ServletRequest.java b/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/servlet/ServletRequest.java index e6bb99d4647..2eb7f432ec2 100644 --- a/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/servlet/ServletRequest.java +++ b/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/servlet/ServletRequest.java @@ -33,10 +33,9 @@ import static com.yahoo.jdisc.http.core.HttpServletRequestUtils.getConnection; * You might find it tempting to remove e.g. the getParameter... methods, * but keep in mind that this IS-A servlet request and must provide the * full api of such a request for use outside the "JDisc filter world". - * - * @since 5.27 */ public class ServletRequest extends HttpServletRequestWrapper implements ServletOrJdiscHttpRequest { + public static final String JDISC_REQUEST_PRINCIPAL = "jdisc.request.principal"; public static final String JDISC_REQUEST_X509CERT = "jdisc.request.X509Certificate"; public static final String SERVLET_REQUEST_X509CERT = "javax.servlet.request.X509Certificate"; |