diff options
Diffstat (limited to 'bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/registration/MatchableRegistration.java')
-rw-r--r-- | bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/registration/MatchableRegistration.java | 36 |
1 files changed, 5 insertions, 31 deletions
diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/registration/MatchableRegistration.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/registration/MatchableRegistration.java index 4da830e57..941437885 100644 --- a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/registration/MatchableRegistration.java +++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/registration/MatchableRegistration.java @@ -11,9 +11,6 @@ package org.eclipse.equinox.http.servlet.internal.registration; -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; -import java.net.URLEncoder; import org.eclipse.equinox.http.servlet.internal.servlet.Match; import org.eclipse.equinox.http.servlet.internal.util.Const; import org.osgi.dto.DTO; @@ -28,14 +25,12 @@ public abstract class MatchableRegistration<T, D extends DTO> super(t, d); } - public abstract boolean needDecode(); - public abstract String match( String name, String servletPath, String pathInfo, String extension, Match match); - private boolean isPathWildcardMatch( - String pattern, String servletPath) { + protected boolean isPathWildcardMatch( + String pattern, String servletPath, String pathInfo) { int cpl = pattern.length() - 2; @@ -52,18 +47,11 @@ public abstract class MatchableRegistration<T, D extends DTO> return false; } - final protected boolean doMatch( + protected boolean doMatch( String pattern, String servletPath, String pathInfo, String extension, Match match) throws IllegalArgumentException { - if (needDecode()) { - try { - servletPath = URLDecoder.decode(servletPath, "UTF-8"); //$NON-NLS-1$ - } - catch (UnsupportedEncodingException e) { - // do nothing - } - } + if (match == Match.EXACT) { return pattern.equals(servletPath); } @@ -78,7 +66,7 @@ public abstract class MatchableRegistration<T, D extends DTO> } if ((match == Match.REGEX) && isPathWildcardMatch( - pattern, servletPath)) { + pattern, servletPath, pathInfo)) { return true; } @@ -100,18 +88,4 @@ public abstract class MatchableRegistration<T, D extends DTO> return false; } - static boolean patternsRequireDecode(String[] patterns) { - for (String pattern : patterns) { - try { - String encode = URLEncoder.encode(pattern, "UTF-8"); //$NON-NLS-1$ - if (!encode.equals(pattern)) { - return true; - } - } - catch (UnsupportedEncodingException e) { - // do nothing - } - } - return false; - } }
\ No newline at end of file |