Author: markt
Date: Sat Oct 22 21:12:47 2011
New Revision: 1187793
URL: http://svn.apache.org/viewvc?rev=1187793&view=rev
Log:
Whitespace removal from /java/org/apache/catalina/filters
Modified:
tomcat/trunk/java/org/apache/catalina/filters/AddDefaultCharsetFilter.java
tomcat/trunk/java/org/apache/catalina/filters/Constants.java
tomcat/trunk/java/org/apache/catalina/filters/CsrfPreventionFilter.java
tomcat/trunk/java/org/apache/catalina/filters/ExpiresFilter.java
tomcat/trunk/java/org/apache/catalina/filters/FilterBase.java
tomcat/trunk/java/org/apache/catalina/filters/RemoteAddrFilter.java
tomcat/trunk/java/org/apache/catalina/filters/RemoteHostFilter.java
tomcat/trunk/java/org/apache/catalina/filters/RemoteIpFilter.java
tomcat/trunk/java/org/apache/catalina/filters/RequestDumperFilter.java
tomcat/trunk/java/org/apache/catalina/filters/RequestFilter.java
tomcat/trunk/java/org/apache/catalina/filters/WebdavFixFilter.java
Modified:
tomcat/trunk/java/org/apache/catalina/filters/AddDefaultCharsetFilter.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/filters/AddDefaultCharsetFilter.java?rev=1187793&r1=1187792&r2=1187793&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/filters/AddDefaultCharsetFilter.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/filters/AddDefaultCharsetFilter.java
Sat Oct 22 21:12:47 2011
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -40,7 +40,7 @@ import org.apache.juli.logging.LogFactor
* auto-detect the character set. This may be exploited by an attacker to
* perform an XSS attack. Internet Explorer has this behaviour by default.
Other
* browsers have an option to enable it.<br/>
- *
+ *
* This filter prevents the attack by explicitly setting a character set.
Unless
* the provided character set is explicitly overridden by the user - in which
* case they deserve everything they get - the browser will adhere to an
@@ -52,7 +52,7 @@ public class AddDefaultCharsetFilter ext
LogFactory.getLog(AddDefaultCharsetFilter.class);
private static final String DEFAULT_ENCODING = "ISO-8859-1";
-
+
private String encoding;
public void setEncoding(String encoding) {
@@ -81,7 +81,7 @@ public class AddDefaultCharsetFilter ext
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
-
+
// Wrap the response
if (response instanceof HttpServletResponse) {
ResponseWrapper wrapped =
@@ -99,7 +99,7 @@ public class AddDefaultCharsetFilter ext
public static class ResponseWrapper extends HttpServletResponseWrapper {
private String encoding;
-
+
public ResponseWrapper(HttpServletResponse response, String encoding) {
super(response);
this.encoding = encoding;
@@ -107,7 +107,7 @@ public class AddDefaultCharsetFilter ext
@Override
public void setContentType(String ct) {
-
+
if (ct != null && ct.startsWith("text/")) {
if (ct.indexOf("charset=") < 0) {
super.setContentType(ct + ";charset=" + encoding);
Modified: tomcat/trunk/java/org/apache/catalina/filters/Constants.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/filters/Constants.java?rev=1187793&r1=1187792&r2=1187793&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/filters/Constants.java (original)
+++ tomcat/trunk/java/org/apache/catalina/filters/Constants.java Sat Oct 22
21:12:47 2011
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,10 +30,10 @@ package org.apache.catalina.filters;
public final class Constants {
public static final String Package = "org.apache.catalina.filters";
-
+
public static final String CSRF_NONCE_SESSION_ATTR_NAME =
"org.apache.catalina.filters.CSRF_NONCE";
-
+
public static final String CSRF_NONCE_REQUEST_PARAM =
"org.apache.catalina.filters.CSRF_NONCE";
Modified:
tomcat/trunk/java/org/apache/catalina/filters/CsrfPreventionFilter.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/filters/CsrfPreventionFilter.java?rev=1187793&r1=1187792&r2=1187793&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/filters/CsrfPreventionFilter.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/filters/CsrfPreventionFilter.java Sat
Oct 22 21:12:47 2011
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -52,13 +52,13 @@ public class CsrfPreventionFilter extend
private static final Log log =
LogFactory.getLog(CsrfPreventionFilter.class);
-
+
private String randomClass = SecureRandom.class.getName();
-
+
private Random randomSource;
private final Set<String> entryPoints = new HashSet<String>();
-
+
private int nonceCacheSize = 5;
@Override
@@ -72,7 +72,7 @@ public class CsrfPreventionFilter extend
* application after navigating away from it. Entry points will be limited
* to HTTP GET requests and should not trigger any security sensitive
* actions.
- *
+ *
* @param entryPoints Comma separated list of URLs to be configured as
* entry points.
*/
@@ -89,17 +89,17 @@ public class CsrfPreventionFilter extend
* in the browser and similar behaviors that may result in the submission
* of a previous nonce rather than the current one. If not set, the default
* value of 5 will be used.
- *
+ *
* @param nonceCacheSize The number of nonces to cache
*/
public void setNonceCacheSize(int nonceCacheSize) {
this.nonceCacheSize = nonceCacheSize;
}
-
+
/**
* Specify the class to use to generate the nonces. Must be in instance of
* {@link Random}.
- *
+ *
* @param randomClass The name of the class to use
*/
public void setRandomClass(String randomClass) {
@@ -110,7 +110,7 @@ public class CsrfPreventionFilter extend
public void init(FilterConfig filterConfig) throws ServletException {
// Set the parameters
super.init(filterConfig);
-
+
try {
Class<?> clazz = Class.forName(randomClass);
randomSource = (Random) clazz.newInstance();
@@ -134,21 +134,21 @@ public class CsrfPreventionFilter extend
FilterChain chain) throws IOException, ServletException {
ServletResponse wResponse = null;
-
+
if (request instanceof HttpServletRequest &&
response instanceof HttpServletResponse) {
-
+
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse res = (HttpServletResponse) response;
boolean skipNonceCheck = false;
-
+
if (Constants.METHOD_GET.equals(req.getMethod())) {
String path = req.getServletPath();
if (req.getPathInfo() != null) {
path = path + req.getPathInfo();
}
-
+
if (entryPoints.contains(path)) {
skipNonceCheck = true;
}
@@ -158,7 +158,7 @@ public class CsrfPreventionFilter extend
LruCache<String> nonceCache =
(LruCache<String>) req.getSession(true).getAttribute(
Constants.CSRF_NONCE_SESSION_ATTR_NAME);
-
+
if (!skipNonceCheck) {
String previousNonce =
req.getParameter(Constants.CSRF_NONCE_REQUEST_PARAM);
@@ -168,22 +168,22 @@ public class CsrfPreventionFilter extend
return;
}
}
-
+
if (nonceCache == null) {
nonceCache = new LruCache<String>(nonceCacheSize);
req.getSession().setAttribute(
Constants.CSRF_NONCE_SESSION_ATTR_NAME, nonceCache);
}
-
+
String newNonce = generateNonce();
-
+
nonceCache.add(newNonce);
-
+
wResponse = new CsrfResponseWrapper(res, newNonce);
} else {
wResponse = response;
}
-
+
chain.doFilter(request, wResponse);
}
@@ -191,7 +191,7 @@ public class CsrfPreventionFilter extend
* Generate a once time token (nonce) for authenticating subsequent
* requests. This will also add the token to the session. The nonce
* generation is a simplified version of ManagerBase.generateSessionId().
- *
+ *
*/
protected String generateNonce() {
byte random[] = new byte[16];
@@ -200,7 +200,7 @@ public class CsrfPreventionFilter extend
StringBuilder buffer = new StringBuilder();
randomSource.nextBytes(random);
-
+
for (int j = 0; j < random.length; j++) {
byte b1 = (byte) ((random[j] & 0xf0) >> 4);
byte b2 = (byte) (random[j] & 0x0f);
@@ -248,9 +248,9 @@ public class CsrfPreventionFilter extend
public String encodeURL(String url) {
return addNonce(super.encodeURL(url));
}
-
+
/**
- * Return the specified URL with the nonce added to the query string.
+ * Return the specified URL with the nonce added to the query string.
*
* @param url URL to be modified
* @param nonce The nonce to add
@@ -287,7 +287,7 @@ public class CsrfPreventionFilter extend
return (sb.toString());
}
}
-
+
protected static class LruCache<T> implements Serializable {
private static final long serialVersionUID = 1L;
@@ -295,7 +295,7 @@ public class CsrfPreventionFilter extend
// Although the internal implementation uses a Map, this cache
// implementation is only concerned with the keys.
private final Map<T,T> cache;
-
+
public LruCache(final int cacheSize) {
cache = new LinkedHashMap<T,T>() {
private static final long serialVersionUID = 1L;
@@ -308,7 +308,7 @@ public class CsrfPreventionFilter extend
}
};
}
-
+
public void add(T key) {
synchronized (cache) {
cache.put(key, null);
Modified: tomcat/trunk/java/org/apache/catalina/filters/ExpiresFilter.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/filters/ExpiresFilter.java?rev=1187793&r1=1187792&r2=1187793&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/filters/ExpiresFilter.java (original)
+++ tomcat/trunk/java/org/apache/catalina/filters/ExpiresFilter.java Sat Oct 22
21:12:47 2011
@@ -51,7 +51,7 @@ import org.apache.juli.logging.LogFactor
* <tt>Cache-Control: max-age=</tt>' headers to HTTP response according to its
'
* <tt>Content-Type</tt>'.
* </p>
- *
+ *
* <p>
* Following documentation is inspired by <tt>mod_expires</tt> .
* </p>
@@ -79,7 +79,7 @@ import org.apache.juli.logging.LogFactor
* <h1>Filter Configuration</h1><h2>Basic configuration to add '
* <tt>Expires</tt>' and ' <tt>Cache-Control: max-age=</tt>'
* headers to images, css and javascript</h2>
- *
+ *
* <code><pre>
* <web-app ...>
* ...
@@ -108,9 +108,9 @@ import org.apache.juli.logging.LogFactor
* ...
* </web-app>
* </pre></code>
- *
+ *
* <h2>Configuration Parameters</h2>
- *
+ *
* <h3>
* <tt>ExpiresByType <content-type></tt></h3>
* <p>
@@ -145,12 +145,12 @@ import org.apache.juli.logging.LogFactor
* <p>
* <strong>Example:</strong>
* </p>
- *
+ *
* <code><pre>
* <init-param>
* <param-name>ExpiresByType
text/html</param-name><param-value>access plus 1 month 15 days 2
hours</param-value>
* </init-param>
- *
+ *
* <init-param>
* <!-- 2592000 seconds = 30 days -->
* <param-name>ExpiresByType
image/gif</param-name><param-value>A2592000</param-value>
@@ -183,13 +183,13 @@ import org.apache.juli.logging.LogFactor
* <p>
* Configuration sample :
* </p>
- *
+ *
* <code><pre>
* <init-param>
*
<param-name>ExpiresExcludedResponseStatusCodes</param-name><param-value>302,
500, 503</param-value>
* </init-param>
* </pre></code>
- *
+ *
* <h3>ExpiresDefault</h3>
* <p>
* This directive sets the default algorithm for calculating the expiration
time
@@ -203,12 +203,12 @@ import org.apache.juli.logging.LogFactor
* The <tt>ExpiresDefault</tt> and <tt>ExpiresByType</tt> directives can also
be
* defined in a more readable syntax of the form:
* </p>
- *
+ *
* <code><pre>
* <init-param>
*
<param-name>ExpiresDefault</param-name><param-value><base>
[plus] {<num> <type>}*</param-value>
* </init-param>
- *
+ *
* <init-param>
* <param-name>ExpiresByType
type/encoding</param-name><param-value><base> [plus]
{<num> <type>}*</param-value>
* </init-param>
@@ -237,16 +237,16 @@ import org.apache.juli.logging.LogFactor
* For example, any of the following directives can be used to make documents
* expire 1 month after being accessed, by default:
* </p>
- *
+ *
* <code><pre>
* <init-param>
*
<param-name>ExpiresDefault</param-name><param-value>access
plus 1 month</param-value>
* </init-param>
- *
+ *
* <init-param>
*
<param-name>ExpiresDefault</param-name><param-value>access
plus 4 weeks</param-value>
* </init-param>
- *
+ *
* <init-param>
*
<param-name>ExpiresDefault</param-name><param-value>access
plus 30 days</param-value>
* </init-param>
@@ -255,12 +255,12 @@ import org.apache.juli.logging.LogFactor
* The expiry time can be fine-tuned by adding several '
* <tt><num> <type></tt>' clauses:
* </p>
- *
+ *
* <code><pre>
* <init-param>
* <param-name>ExpiresByType
text/html</param-name><param-value>access plus 1 month 15 days 2
hours</param-value>
* </init-param>
- *
+ *
* <init-param>
* <param-name>ExpiresByType
image/gif</param-name><param-value>modification plus 5 hours 3
minutes</param-value>
* </init-param>
@@ -364,29 +364,29 @@ import org.apache.juli.logging.LogFactor
* <p>
* Extract of logging.properties
* </p>
- *
+ *
* <code><pre>
* org.apache.catalina.filters.ExpiresFilter.level = FINE
* </pre></code>
* <p>
* Sample of initialization log message :
* </p>
- *
+ *
* <code><pre>
* Mar 26, 2010 2:01:41 PM org.apache.catalina.filters.ExpiresFilter init
* FINE: Filter initialized with configuration ExpiresFilter[
- * excludedResponseStatusCode=[304],
- * default=null,
+ * excludedResponseStatusCode=[304],
+ * default=null,
* byType={
- * image=ExpiresConfiguration[startingPoint=ACCESS_TIME, duration=[10
MINUTE]],
- * text/css=ExpiresConfiguration[startingPoint=ACCESS_TIME, duration=[10
MINUTE]],
+ * image=ExpiresConfiguration[startingPoint=ACCESS_TIME, duration=[10
MINUTE]],
+ * text/css=ExpiresConfiguration[startingPoint=ACCESS_TIME, duration=[10
MINUTE]],
* text/javascript=ExpiresConfiguration[startingPoint=ACCESS_TIME,
duration=[10 MINUTE]]}]
* </pre></code>
* <p>
* Sample of per-request log message where <tt>ExpiresFilter</tt> adds an
* expiration date
* </p>
- *
+ *
* <code><pre>
* Mar 26, 2010 2:09:47 PM org.apache.catalina.filters.ExpiresFilter
onBeforeWriteResponseBody
* FINE: Request "/tomcat.gif" with response status "200" content-type
"image/gif", set expiration date 3/26/10 2:19 PM
@@ -395,12 +395,12 @@ import org.apache.juli.logging.LogFactor
* Sample of per-request log message where <tt>ExpiresFilter</tt> does not add
* an expiration date
* </p>
- *
+ *
* <code><pre>
* Mar 26, 2010 2:10:27 PM org.apache.catalina.filters.ExpiresFilter
onBeforeWriteResponseBody
* FINE: Request "/docs/config/manager.html" with response status "200"
content-type "text/html", no expiration configured
* </pre></code>
- *
+ *
*/
public class ExpiresFilter extends FilterBase {
@@ -1016,7 +1016,7 @@ public class ExpiresFilter extends Filte
/**
* Convert a comma delimited list of numbers into an <tt>int[]</tt>.
- *
+ *
* @param commaDelimitedInts
* can be <code>null</code>
* @return never <code>null</code> array
@@ -1040,7 +1040,7 @@ public class ExpiresFilter extends Filte
/**
* Convert a given comma delimited list of strings into an array of String
- *
+ *
* @return array of patterns (non <code>null</code>)
*/
protected static String[] commaDelimitedListToStringArray(
@@ -1098,7 +1098,7 @@ public class ExpiresFilter extends Filte
/**
* Return <code>true</code> if the given <code>string</code> starts with
the
* given <code>prefix</code> ignoring case.
- *
+ *
* @param string
* can be <code>null</code>
* @param prefix
@@ -1120,7 +1120,7 @@ public class ExpiresFilter extends Filte
* occurence of the given <code>separator</code>. Return <code>null</code>
* if the given <code>str</code> or the given <code>separator</code> is
* null. Return and empty string if the <code>separator</code> is empty.
- *
+ *
* @param str
* can be <code>null</code>
* @param separator
@@ -1209,7 +1209,7 @@ public class ExpiresFilter extends Filte
* <p>
* <code>protected</code> for extension.
* </p>
- *
+ *
* @see HttpServletResponse#getContentType()
*/
protected Date getExpirationDate(XHttpServletResponse response) {
@@ -1366,7 +1366,7 @@ public class ExpiresFilter extends Filte
}
/**
- *
+ *
* <p>
* <code>protected</code> for extension.
* </p>
@@ -1458,7 +1458,7 @@ public class ExpiresFilter extends Filte
* Parse configuration lines like '
* <tt>access plus 1 month 15 days 2 hours</tt>' or '
* <tt>modification 1 day 2 hours 5 seconds</tt>'
- *
+ *
* @param inputLine
*/
protected ExpiresConfiguration parseExpiresConfiguration(String inputLine)
{
Modified: tomcat/trunk/java/org/apache/catalina/filters/FilterBase.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/filters/FilterBase.java?rev=1187793&r1=1187792&r2=1187793&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/filters/FilterBase.java (original)
+++ tomcat/trunk/java/org/apache/catalina/filters/FilterBase.java Sat Oct 22
21:12:47 2011
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -29,18 +29,18 @@ import org.apache.tomcat.util.res.String
/**
* Base class for filters that provides generic initialisation and a simple
- * no-op destruction.
- *
+ * no-op destruction.
+ *
* @author xxd
*
*/
public abstract class FilterBase implements Filter {
-
+
protected static final StringManager sm =
StringManager.getManager(Constants.Package);
protected abstract Log getLogger();
-
+
@Override
public void init(FilterConfig filterConfig) throws ServletException {
Enumeration<String> paramNames = filterConfig.getInitParameterNames();
@@ -51,7 +51,7 @@ public abstract class FilterBase impleme
getLogger().warn(sm.getString("filterbase.noSuchProperty",
paramName, this.getClass().getName()));
}
- }
+ }
}
@Override
Modified: tomcat/trunk/java/org/apache/catalina/filters/RemoteAddrFilter.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/filters/RemoteAddrFilter.java?rev=1187793&r1=1187792&r2=1187793&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/filters/RemoteAddrFilter.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/filters/RemoteAddrFilter.java Sat Oct
22 21:12:47 2011
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -37,7 +37,7 @@ import org.apache.juli.logging.LogFactor
* based on the string representation of the remote client's IP address.
*
* @author Craig R. McClanahan
- *
+ *
*/
public final class RemoteAddrFilter
@@ -70,7 +70,7 @@ public final class RemoteAddrFilter
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
-
+
process(request.getRemoteAddr(), request, response, chain);
}
@@ -90,7 +90,7 @@ public final class RemoteAddrFilter
public void doFilterEvent(CometEvent event, CometFilterChain chain)
throws IOException, ServletException {
processCometEvent(event.getHttpServletRequest().getRemoteAddr(),
- event, chain);
+ event, chain);
}
@Override
Modified: tomcat/trunk/java/org/apache/catalina/filters/RemoteHostFilter.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/filters/RemoteHostFilter.java?rev=1187793&r1=1187792&r2=1187793&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/filters/RemoteHostFilter.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/filters/RemoteHostFilter.java Sat Oct
22 21:12:47 2011
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -37,13 +37,13 @@ import org.apache.juli.logging.LogFactor
* based on the remote client's host name.
*
* @author Craig R. McClanahan
- *
+ *
*/
public final class RemoteHostFilter
extends RequestFilter {
-
+
// ----------------------------------------------------- Instance Variables
private static final Log log = LogFactory.getLog(RemoteHostFilter.class);
@@ -71,11 +71,11 @@ public final class RemoteHostFilter
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
-
+
process(request.getRemoteHost(), request, response, chain);
}
-
+
/**
* Extract the desired request property, and pass it (along with the comet
* event and filter chain) to the protected <code>process()</code> method
@@ -91,7 +91,7 @@ public final class RemoteHostFilter
public void doFilterEvent(CometEvent event, CometFilterChain chain)
throws IOException, ServletException {
processCometEvent(event.getHttpServletRequest().getRemoteHost(),
- event, chain);
+ event, chain);
}
@Override
Modified: tomcat/trunk/java/org/apache/catalina/filters/RemoteIpFilter.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/filters/RemoteIpFilter.java?rev=1187793&r1=1187792&r2=1187793&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/filters/RemoteIpFilter.java (original)
+++ tomcat/trunk/java/org/apache/catalina/filters/RemoteIpFilter.java Sat Oct
22 21:12:47 2011
@@ -165,7 +165,7 @@ import org.apache.juli.logging.LogFactor
* <strong>Regular expression vs. IP address blocks:</strong>
<code>mod_remoteip</code> allows to use address blocks (e.g.
* <code>192.168/16</code>) to configure <code>RemoteIPInternalProxy</code>
and <code>RemoteIPTrustedProxy</code> ; as the JVM doesn't have a
* library similar to <a
- *
href="http://apr.apache.org/docs/apr/1.3/group__apr__network__io.html#gb74d21b8898b7c40bf7fd07ad3eb993d">apr_ipsubnet_test</a>,
we rely on
+ *
href="http://apr.apache.org/docs/apr/1.3/group__apr__network__io.html#gb74d21b8898b7c40bf7fd07ad3eb993d">apr_ipsubnet_test</a>,
we rely on
* regular expressions.
* </p>
* <hr/>
@@ -196,7 +196,7 @@ import org.apache.juli.logging.LogFactor
* <param-value>x-forwarded-proto</param-value>
* </init-param>
* </filter>
- *
+ *
* <filter-mapping>
* <filter-name>RemoteIpFilter</filter-name>
* <url-pattern>/*</url-pattern>
@@ -277,7 +277,7 @@ import org.apache.juli.logging.LogFactor
* <param-value>proxy1|proxy2</param-value>
* </init-param>
* </filter>
- *
+ *
* <filter-mapping>
* <filter-name>RemoteIpFilter</filter-name>
* <url-pattern>/*</url-pattern>
@@ -338,7 +338,7 @@ import org.apache.juli.logging.LogFactor
* <param-value>proxy1|proxy2</param-value>
* </init-param>
* </filter>
- *
+ *
* <filter-mapping>
* <filter-name>RemoteIpFilter</filter-name>
* <url-pattern>/*</url-pattern>
@@ -400,7 +400,7 @@ import org.apache.juli.logging.LogFactor
* <param-value>proxy1|proxy2</param-value>
* </init-param>
* </filter>
- *
+ *
* <filter-mapping>
* <filter-name>RemoteIpFilter</filter-name>
* <url-pattern>/*</url-pattern>
@@ -439,7 +439,7 @@ import org.apache.juli.logging.LogFactor
*/
public class RemoteIpFilter implements Filter {
public static class XForwardedRequest extends HttpServletRequestWrapper {
-
+
static final ThreadLocal<SimpleDateFormat[]> threadLocalDateFormats =
new ThreadLocal<SimpleDateFormat[]>() {
@Override
protected SimpleDateFormat[] initialValue() {
@@ -448,22 +448,22 @@ public class RemoteIpFilter implements F
new SimpleDateFormat("EEEEEE, dd-MMM-yy HH:mm:ss zzz",
Locale.US),
new SimpleDateFormat("EEE MMMM d HH:mm:ss yyyy", Locale.US)
};
-
+
}
};
-
+
protected Map<String, List<String>> headers;
-
+
protected int localPort;
protected String remoteAddr;
-
+
protected String remoteHost;
-
+
protected String scheme;
-
+
protected boolean secure;
-
+
protected int serverPort;
public XForwardedRequest(HttpServletRequest request) {
@@ -474,14 +474,14 @@ public class RemoteIpFilter implements F
this.scheme = request.getScheme();
this.secure = request.isSecure();
this.serverPort = request.getServerPort();
-
+
headers = new HashMap<String, List<String>>();
for (Enumeration<String> headerNames = request.getHeaderNames();
headerNames.hasMoreElements();) {
String header = headerNames.nextElement();
headers.put(header,
Collections.list(request.getHeaders(header)));
}
}
-
+
@Override
public long getDateHeader(String name) {
String value = getHeader(name);
@@ -503,7 +503,7 @@ public class RemoteIpFilter implements F
}
return date.getTime();
}
-
+
@Override
public String getHeader(String name) {
Map.Entry<String, List<String>> header = getHeaderEntry(name);
@@ -512,7 +512,7 @@ public class RemoteIpFilter implements F
}
return header.getValue().get(0);
}
-
+
protected Map.Entry<String, List<String>> getHeaderEntry(String name) {
for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
if (entry.getKey().equalsIgnoreCase(name)) {
@@ -521,12 +521,12 @@ public class RemoteIpFilter implements F
}
return null;
}
-
+
@Override
public Enumeration<String> getHeaderNames() {
return Collections.enumeration(headers.keySet());
}
-
+
@Override
public Enumeration<String> getHeaders(String name) {
Map.Entry<String, List<String>> header = getHeaderEntry(name);
@@ -535,7 +535,7 @@ public class RemoteIpFilter implements F
}
return Collections.enumeration(header.getValue());
}
-
+
@Override
public int getIntHeader(String name) {
String value = getHeader(name);
@@ -544,44 +544,44 @@ public class RemoteIpFilter implements F
}
return Integer.parseInt(value);
}
-
+
@Override
public int getLocalPort() {
return localPort;
}
-
+
@Override
public String getRemoteAddr() {
return this.remoteAddr;
}
-
+
@Override
public String getRemoteHost() {
return this.remoteHost;
}
-
+
@Override
public String getScheme() {
return scheme;
}
-
+
@Override
public int getServerPort() {
return serverPort;
}
-
+
@Override
public boolean isSecure() {
return secure;
}
-
+
public void removeHeader(String name) {
Map.Entry<String, List<String>> header = getHeaderEntry(name);
if (header != null) {
headers.remove(header.getKey());
}
}
-
+
public void setHeader(String name, String value) {
List<String> values = Arrays.asList(value);
Map.Entry<String, List<String>> header = getHeaderEntry(name);
@@ -590,9 +590,9 @@ public class RemoteIpFilter implements F
} else {
header.setValue(values);
}
-
+
}
-
+
public void setLocalPort(int localPort) {
this.localPort = localPort;
}
@@ -600,64 +600,64 @@ public class RemoteIpFilter implements F
public void setRemoteAddr(String remoteAddr) {
this.remoteAddr = remoteAddr;
}
-
+
public void setRemoteHost(String remoteHost) {
this.remoteHost = remoteHost;
}
-
+
public void setScheme(String scheme) {
this.scheme = scheme;
}
-
+
public void setSecure(boolean secure) {
this.secure = secure;
}
-
+
public void setServerPort(int serverPort) {
this.serverPort = serverPort;
}
}
-
+
/**
* {@link Pattern} for a comma delimited string that support whitespace
characters
*/
private static final Pattern commaSeparatedValuesPattern =
Pattern.compile("\\s*,\\s*");
-
+
protected static final String HTTP_SERVER_PORT_PARAMETER =
"httpServerPort";
protected static final String HTTPS_SERVER_PORT_PARAMETER =
"httpsServerPort";
-
+
protected static final String INTERNAL_PROXIES_PARAMETER =
"internalProxies";
-
+
/**
* Logger
*/
private static final Log log = LogFactory.getLog(RemoteIpFilter.class);
-
+
protected static final String PROTOCOL_HEADER_PARAMETER = "protocolHeader";
-
+
protected static final String PROTOCOL_HEADER_HTTPS_VALUE_PARAMETER =
"protocolHeaderHttpsValue";
-
+
protected static final String PORT_HEADER_PARAMETER = "portHeader";
protected static final String CHANGE_LOCAL_PORT_PARAMETER =
"changeLocalPort";
protected static final String PROXIES_HEADER_PARAMETER = "proxiesHeader";
-
+
protected static final String REMOTE_IP_HEADER_PARAMETER =
"remoteIpHeader";
-
+
protected static final String TRUSTED_PROXIES_PARAMETER = "trustedProxies";
-
+
/**
* Convert a given comma delimited list of regular expressions into an
array of String
- *
+ *
* @return array of patterns (non <code>null</code>)
*/
protected static String[] commaDelimitedListToStringArray(String
commaDelimitedStrings) {
return (commaDelimitedStrings == null ||
commaDelimitedStrings.length() == 0) ? new String[0] :
commaSeparatedValuesPattern
.split(commaDelimitedStrings);
}
-
+
/**
* Convert an array of strings in a comma delimited string
*/
@@ -677,7 +677,7 @@ public class RemoteIpFilter implements F
}
return result.toString();
}
-
+
/**
* @see #setHttpServerPort(int)
*/
@@ -696,28 +696,28 @@ public class RemoteIpFilter implements F
"192\\.168\\.\\d{1,3}\\.\\d{1,3}|" +
"169\\.254\\.\\d{1,3}\\.\\d{1,3}|" +
"127\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}");
-
+
/**
* @see #setProtocolHeader(String)
*/
private String protocolHeader = null;
-
+
private String protocolHeaderHttpsValue = "https";
-
+
private String portHeader = null;
-
+
private boolean changeLocalPort = false;
/**
* @see #setProxiesHeader(String)
*/
private String proxiesHeader = "X-Forwarded-By";
-
+
/**
* @see #setRemoteIpHeader(String)
*/
private String remoteIpHeader = "X-Forwarded-For";
-
+
/**
* @see #setRequestAttributesEnabled(boolean)
*/
@@ -727,21 +727,21 @@ public class RemoteIpFilter implements F
* @see #setTrustedProxies(String)
*/
private Pattern trustedProxies = null;
-
+
@Override
public void destroy() {
// NOOP
}
-
+
public void doFilter(HttpServletRequest request, HttpServletResponse
response, FilterChain chain) throws IOException, ServletException {
-
+
if (internalProxies != null &&
internalProxies.matcher(request.getRemoteAddr()).matches()) {
String remoteIp = null;
// In java 6, proxiesHeaderValue should be declared as a
java.util.Deque
LinkedList<String> proxiesHeaderValue = new LinkedList<String>();
StringBuilder concatRemoteIpHeaderValue = new StringBuilder();
-
+
for (Enumeration<String> e = request.getHeaders(remoteIpHeader);
e.hasMoreElements();) {
if (concatRemoteIpHeaderValue.length() > 0) {
concatRemoteIpHeaderValue.append(", ");
@@ -772,13 +772,13 @@ public class RemoteIpFilter implements F
String currentRemoteIp = remoteIpHeaderValue[idx];
newRemoteIpHeaderValue.addFirst(currentRemoteIp);
}
-
+
XForwardedRequest xRequest = new XForwardedRequest(request);
if (remoteIp != null) {
-
+
xRequest.setRemoteAddr(remoteIp);
xRequest.setRemoteHost(remoteIp);
-
+
if (proxiesHeaderValue.size() == 0) {
xRequest.removeHeader(proxiesHeader);
} else {
@@ -792,7 +792,7 @@ public class RemoteIpFilter implements F
xRequest.setHeader(remoteIpHeader,
commaDelimitedRemoteIpHeaderValue);
}
}
-
+
if (protocolHeader != null) {
String protocolHeaderValue = request.getHeader(protocolHeader);
if (protocolHeaderValue == null) {
@@ -807,7 +807,7 @@ public class RemoteIpFilter implements F
setPorts(xRequest, httpServerPort);
}
}
-
+
if (log.isDebugEnabled()) {
log.debug("Incoming request " + request.getRequestURI() + "
with originalRemoteAddr '" + request.getRemoteAddr()
+ "', originalRemoteHost='" + request.getRemoteHost()
+ "', originalSecure='" + request.isSecure()
@@ -836,9 +836,9 @@ public class RemoteIpFilter implements F
}
chain.doFilter(request, response);
}
-
+
}
-
+
private void setPorts(XForwardedRequest xrequest, int defaultPort) {
int port = defaultPort;
if (getPortHeader() != null) {
@@ -869,39 +869,39 @@ public class RemoteIpFilter implements F
chain.doFilter(request, response);
}
}
-
+
public boolean isChangeLocalPort() {
return changeLocalPort;
}
-
+
public int getHttpsServerPort() {
return httpsServerPort;
}
-
+
public Pattern getInternalProxies() {
return internalProxies;
}
-
+
public String getProtocolHeader() {
return protocolHeader;
}
-
+
public String getPortHeader() {
return portHeader;
}
-
+
public String getProtocolHeaderHttpsValue() {
return protocolHeaderHttpsValue;
}
-
+
public String getProxiesHeader() {
return proxiesHeader;
}
-
+
public String getRemoteIpHeader() {
return remoteIpHeader;
}
-
+
/**
* @see #setRequestAttributesEnabled(boolean)
* @return <code>true</code> if the attributes will be logged, otherwise
@@ -914,41 +914,41 @@ public class RemoteIpFilter implements F
public Pattern getTrustedProxies() {
return trustedProxies;
}
-
+
@Override
public void init(FilterConfig filterConfig) throws ServletException {
if (filterConfig.getInitParameter(INTERNAL_PROXIES_PARAMETER) != null)
{
setInternalProxies(filterConfig.getInitParameter(INTERNAL_PROXIES_PARAMETER));
}
-
+
if (filterConfig.getInitParameter(PROTOCOL_HEADER_PARAMETER) != null) {
setProtocolHeader(filterConfig.getInitParameter(PROTOCOL_HEADER_PARAMETER));
}
-
+
if
(filterConfig.getInitParameter(PROTOCOL_HEADER_HTTPS_VALUE_PARAMETER) != null) {
setProtocolHeaderHttpsValue(filterConfig.getInitParameter(PROTOCOL_HEADER_HTTPS_VALUE_PARAMETER));
}
-
+
if (filterConfig.getInitParameter(PORT_HEADER_PARAMETER) != null) {
setPortHeader(filterConfig.getInitParameter(PORT_HEADER_PARAMETER));
}
-
+
if (filterConfig.getInitParameter(CHANGE_LOCAL_PORT_PARAMETER) !=
null) {
setChangeLocalPort(Boolean.parseBoolean(filterConfig.getInitParameter(CHANGE_LOCAL_PORT_PARAMETER)));
}
-
+
if (filterConfig.getInitParameter(PROXIES_HEADER_PARAMETER) != null) {
setProxiesHeader(filterConfig.getInitParameter(PROXIES_HEADER_PARAMETER));
}
-
+
if (filterConfig.getInitParameter(REMOTE_IP_HEADER_PARAMETER) != null)
{
setRemoteIpHeader(filterConfig.getInitParameter(REMOTE_IP_HEADER_PARAMETER));
}
-
+
if (filterConfig.getInitParameter(TRUSTED_PROXIES_PARAMETER) != null) {
setTrustedProxies(filterConfig.getInitParameter(TRUSTED_PROXIES_PARAMETER));
}
-
+
if (filterConfig.getInitParameter(HTTP_SERVER_PORT_PARAMETER) != null)
{
try {
setHttpServerPort(Integer.parseInt(filterConfig.getInitParameter(HTTP_SERVER_PORT_PARAMETER)));
@@ -956,7 +956,7 @@ public class RemoteIpFilter implements F
throw new NumberFormatException("Illegal " +
HTTP_SERVER_PORT_PARAMETER + " : " + e.getMessage());
}
}
-
+
if (filterConfig.getInitParameter(HTTPS_SERVER_PORT_PARAMETER) !=
null) {
try {
setHttpsServerPort(Integer.parseInt(filterConfig.getInitParameter(HTTPS_SERVER_PORT_PARAMETER)));
@@ -965,7 +965,7 @@ public class RemoteIpFilter implements F
}
}
}
-
+
/**
* <p>
* If <code>true</code>, the return values for both {@link
@@ -980,11 +980,11 @@ public class RemoteIpFilter implements F
public void setChangeLocalPort(boolean changeLocalPort) {
this.changeLocalPort = changeLocalPort;
}
-
+
/**
* <p>
* Server Port value if the {@link #protocolHeader} indicates HTTP (i.e.
{@link #protocolHeader} is not null and
- * has a value different of {@link #protocolHeaderHttpsValue}).
+ * has a value different of {@link #protocolHeaderHttpsValue}).
* </p>
* <p>
* Default value : 80
@@ -993,7 +993,7 @@ public class RemoteIpFilter implements F
public void setHttpServerPort(int httpServerPort) {
this.httpServerPort = httpServerPort;
}
-
+
/**
* <p>
* Server Port value if the {@link #protocolHeader} indicates HTTPS
@@ -1005,7 +1005,7 @@ public class RemoteIpFilter implements F
public void setHttpsServerPort(int httpsServerPort) {
this.httpsServerPort = httpsServerPort;
}
-
+
/**
* <p>
* Regular expression that defines the internal proxies.
@@ -1021,7 +1021,7 @@ public class RemoteIpFilter implements F
this.internalProxies = Pattern.compile(internalProxies);
}
}
-
+
/**
* <p>
* Header that holds the incoming port, usally named
@@ -1035,7 +1035,7 @@ public class RemoteIpFilter implements F
public void setPortHeader(String portHeader) {
this.portHeader = portHeader;
}
-
+
/**
* <p>
* Header that holds the incoming protocol, usally named
<code>X-Forwarded-Proto</code>. If <code>null</code>, request.scheme and
@@ -1048,7 +1048,7 @@ public class RemoteIpFilter implements F
public void setProtocolHeader(String protocolHeader) {
this.protocolHeader = protocolHeader;
}
-
+
/**
* <p>
* Case insensitive value of the protocol header to indicate that the
incoming http request uses HTTPS.
@@ -1060,7 +1060,7 @@ public class RemoteIpFilter implements F
public void setProtocolHeaderHttpsValue(String protocolHeaderHttpsValue) {
this.protocolHeaderHttpsValue = protocolHeaderHttpsValue;
}
-
+
/**
* <p>
* The proxiesHeader directive specifies a header into which mod_remoteip
will collect a list of all of the intermediate client IP
@@ -1080,7 +1080,7 @@ public class RemoteIpFilter implements F
public void setProxiesHeader(String proxiesHeader) {
this.proxiesHeader = proxiesHeader;
}
-
+
/**
* <p>
* Name of the http header from which the remote ip is extracted.
@@ -1095,13 +1095,13 @@ public class RemoteIpFilter implements F
public void setRemoteIpHeader(String remoteIpHeader) {
this.remoteIpHeader = remoteIpHeader;
}
-
+
/**
* Should this filter set request attributes for IP address, Hostname,
* protocol and port used for the request? This are typically used in
* conjunction with an {@link AccessLog} which will otherwise log the
* original values. Default is <code>true</code>.
- *
+ *
* The attributes set are:
* <ul>
* <li>org.apache.catalina.RemoteAddr</li>
@@ -1109,10 +1109,10 @@ public class RemoteIpFilter implements F
* <li>org.apache.catalina.Protocol</li>
* <li>org.apache.catalina.ServerPost</li>
* </ul>
- *
+ *
* @param requestAttributesEnabled <code>true</code> causes the attributes
* to be set, <code>false</code> disables
- * the setting of the attributes.
+ * the setting of the attributes.
*/
public void setRequestAttributesEnabled(boolean requestAttributesEnabled) {
this.requestAttributesEnabled = requestAttributesEnabled;
Modified: tomcat/trunk/java/org/apache/catalina/filters/RequestDumperFilter.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/filters/RequestDumperFilter.java?rev=1187793&r1=1187792&r2=1187793&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/filters/RequestDumperFilter.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/filters/RequestDumperFilter.java Sat
Oct 22 21:12:47 2011
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -41,7 +41,7 @@ import org.apache.juli.logging.LogFactor
* specified Request (before processing) and the corresponding Response
* (after processing). It is especially useful in debugging problems
* related to headers and cookies.</p>
- *
+ *
* <p>When using this Filter, it is strongly recommended that the
* <code>org.apache.catalina.filter.RequestDumperFilter</code> logger is
* directed to a dedicated file and that the
@@ -89,7 +89,7 @@ public class RequestDumperFilter impleme
HttpServletRequest hRequest = null;
HttpServletResponse hResponse = null;
-
+
if (request instanceof HttpServletRequest) {
hRequest = (HttpServletRequest) request;
}
@@ -99,7 +99,7 @@ public class RequestDumperFilter impleme
// Log pre-service information
doLog("START TIME ", getTimestamp());
-
+
if (hRequest == null) {
doLog(" requestURI", NON_HTTP_REQ_MSG);
doLog(" authType", NON_HTTP_REQ_MSG);
@@ -107,12 +107,12 @@ public class RequestDumperFilter impleme
doLog(" requestURI", hRequest.getRequestURI());
doLog(" authType", hRequest.getAuthType());
}
-
+
doLog(" characterEncoding", request.getCharacterEncoding());
doLog(" contentLength",
Integer.valueOf(request.getContentLength()).toString());
doLog(" contentType", request.getContentType());
-
+
if (hRequest == null) {
doLog(" contextPath", NON_HTTP_REQ_MSG);
doLog(" cookie", NON_HTTP_REQ_MSG);
@@ -135,15 +135,15 @@ public class RequestDumperFilter impleme
}
}
}
-
+
doLog(" locale", request.getLocale().toString());
-
+
if (hRequest == null) {
doLog(" method", NON_HTTP_REQ_MSG);
} else {
doLog(" method", hRequest.getMethod());
}
-
+
Enumeration<String> pnames = request.getParameterNames();
while (pnames.hasMoreElements()) {
String pname = pnames.nextElement();
@@ -157,24 +157,24 @@ public class RequestDumperFilter impleme
}
doLog(" parameter", result.toString());
}
-
+
if (hRequest == null) {
doLog(" pathInfo", NON_HTTP_REQ_MSG);
} else {
doLog(" pathInfo", hRequest.getPathInfo());
}
-
+
doLog(" protocol", request.getProtocol());
-
+
if (hRequest == null) {
doLog(" queryString", NON_HTTP_REQ_MSG);
} else {
doLog(" queryString", hRequest.getQueryString());
}
-
+
doLog(" remoteAddr", request.getRemoteAddr());
doLog(" remoteHost", request.getRemoteHost());
-
+
if (hRequest == null) {
doLog(" remoteUser", NON_HTTP_REQ_MSG);
doLog("requestedSessionId", NON_HTTP_REQ_MSG);
@@ -182,18 +182,18 @@ public class RequestDumperFilter impleme
doLog(" remoteUser", hRequest.getRemoteUser());
doLog("requestedSessionId", hRequest.getRequestedSessionId());
}
-
+
doLog(" scheme", request.getScheme());
doLog(" serverName", request.getServerName());
doLog(" serverPort",
Integer.valueOf(request.getServerPort()).toString());
-
+
if (hRequest == null) {
doLog(" servletPath", NON_HTTP_REQ_MSG);
} else {
doLog(" servletPath", hRequest.getServletPath());
}
-
+
doLog(" isSecure",
Boolean.valueOf(request.isSecure()).toString());
doLog("------------------",
@@ -210,9 +210,9 @@ public class RequestDumperFilter impleme
} else {
doLog(" authType", hRequest.getAuthType());
}
-
+
doLog(" contentType", response.getContentType());
-
+
if (hResponse == null) {
doLog(" header", NON_HTTP_RES_MSG);
} else {
@@ -229,7 +229,7 @@ public class RequestDumperFilter impleme
} else {
doLog(" remoteUser", hRequest.getRemoteUser());
}
-
+
if (hResponse == null) {
doLog(" remoteUser", NON_HTTP_RES_MSG);
} else {
@@ -255,7 +255,7 @@ public class RequestDumperFilter impleme
private String getTimestamp() {
Timestamp ts = timestamp.get();
long currentTime = System.currentTimeMillis();
-
+
if ((ts.date.getTime() + 999) < currentTime) {
ts.date.setTime(currentTime - (currentTime % 1000));
ts.update();
Modified: tomcat/trunk/java/org/apache/catalina/filters/RequestFilter.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/filters/RequestFilter.java?rev=1187793&r1=1187792&r2=1187793&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/filters/RequestFilter.java (original)
+++ tomcat/trunk/java/org/apache/catalina/filters/RequestFilter.java Sat Oct 22
21:12:47 2011
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -73,7 +73,7 @@ public abstract class RequestFilter
* The regular expression used to test for denied requests.
*/
protected Pattern deny = null;
-
+
/**
* mime type -- "text/plain"
*/
@@ -158,7 +158,7 @@ public abstract class RequestFilter
ServletResponse response, FilterChain chain) throws IOException,
ServletException;
-
+
// ------------------------------------------------------ Protected Methods
@@ -192,7 +192,7 @@ public abstract class RequestFilter
/**
* Perform the filtering that has been configured for this Filter, matching
* against the specified request property.
- *
+ *
* @param property The property to check against the allow/deny rules
* @param event The comet event to be filtered
* @param chain The comet filter chain
@@ -202,7 +202,7 @@ public abstract class RequestFilter
protected void processCometEvent(String property, CometEvent event,
CometFilterChain chain) throws IOException, ServletException {
HttpServletResponse response = event.getHttpServletResponse();
-
+
if (isAllowed(property)) {
chain.doFilterEvent(event);
} else {
@@ -213,7 +213,7 @@ public abstract class RequestFilter
/**
* Process the allow and deny rules for the provided property.
- *
+ *
* @param property The property to test against the allow and deny lists
* @return <code>true</code> if this request should be allowed,
* <code>false</code> otherwise
@@ -222,7 +222,7 @@ public abstract class RequestFilter
if (deny != null && deny.matcher(property).matches()) {
return false;
}
-
+
// Check the allow patterns, if any
if (allow != null && allow.matcher(property).matches()) {
return true;
Modified: tomcat/trunk/java/org/apache/catalina/filters/WebdavFixFilter.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/filters/WebdavFixFilter.java?rev=1187793&r1=1187792&r2=1187793&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/filters/WebdavFixFilter.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/filters/WebdavFixFilter.java Sat Oct
22 21:12:47 2011
@@ -38,13 +38,13 @@ import javax.servlet.http.HttpServletRes
* <li>Cancelling the first authentication dialog box and then trying to
* reconnect.</li>
* </ul>
- *
+ *
* Generally each different version of the MS client has a different set of
* problems.
* <p>
* TODO: Update this filter to recognise specific MS clients and apply the
* appropriate workarounds for that particular client
- * <p>
+ * <p>
* As a filter, this is configured in web.xml like any other Filter. You
usually
* want to map this filter to whatever your WebDAV servlet is mapped to.
* <p>
@@ -70,7 +70,7 @@ public class WebdavFixFilter implements
/* XP 32-bit SP3 */
private static final String UA_MINIDIR_5_1_2600 =
"Microsoft-WebDAV-MiniRedir/5.1.2600";
-
+
/* XP 64-bit SP2 */
private static final String UA_MINIDIR_5_2_3790 =
"Microsoft-WebDAV-MiniRedir/5.2.3790";
@@ -100,7 +100,7 @@ public class WebdavFixFilter implements
HttpServletRequest httpRequest = ((HttpServletRequest) request);
HttpServletResponse httpResponse = ((HttpServletResponse) response);
String ua = httpRequest.getHeader("User-Agent");
-
+
if (ua == null || ua.length() == 0 ||
!ua.startsWith(UA_MINIDIR_START)) {
// No UA or starts with non MS value
@@ -118,14 +118,14 @@ public class WebdavFixFilter implements
// Namespace issue maybe
// see http://greenbytes.de/tech/webdav/webdav-redirector-list.html
log(request, "XP-x64-SP2 is known not to work with WebDAV
Servlet");
-
+
chain.doFilter(request, response);
} else {
// Don't know which MS client it is - try the redirect with an
// explicit port in the hope that it moves the client to a
different
// WebDAV implementation that works
httpResponse.sendRedirect(buildRedirect(httpRequest));
- }
+ }
}
private String buildRedirect(HttpServletRequest request) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]