diff options
author | Jon Bratseth <bratseth@oath.com> | 2019-01-16 14:22:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-16 14:22:36 +0100 |
commit | bd2751be2083691996910cec53785bd883b9839b (patch) | |
tree | 3cd2cda58354f7c94e43a39e6cf04739543d374c /jdisc_http_service/src/main | |
parent | 2a9ab7e564b93ae760b607306f58d2b4de18261f (diff) |
Revert "Bratseth/disallow dash "
Diffstat (limited to 'jdisc_http_service/src/main')
-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, 20 insertions, 16 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 f7ab399574c..da76e288a2a 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,7 +67,8 @@ 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()); } /** @@ -339,8 +340,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(); @@ -399,7 +400,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); } @@ -409,11 +410,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<>(); - // Get current set of cookies first + if(cookie != null) { + List<Cookie> cookies = new ArrayList<Cookie>(); + //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()); @@ -425,7 +426,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()); @@ -507,9 +508,12 @@ 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(). @@ -517,8 +521,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; @@ -537,7 +541,6 @@ 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 2eb7f432ec2..e6bb99d4647 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,9 +33,10 @@ 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"; |