Author: ivaynberg
Date: Sat Sep 27 00:19:09 2008
New Revision: 699585
URL: http://svn.apache.org/viewvc?rev=699585&view=rev
Log:
WICKET-1648
Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/coding/AbstractRequestTargetUrlCodingStrategy.java
Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/coding/AbstractRequestTargetUrlCodingStrategy.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/coding/AbstractRequestTargetUrlCodingStrategy.java?rev=699585&r1=699584&r2=699585&view=diff
==============================================================================
---
wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/coding/AbstractRequestTargetUrlCodingStrategy.java
(original)
+++
wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/coding/AbstractRequestTargetUrlCodingStrategy.java
Sat Sep 27 00:19:09 2008
@@ -23,8 +23,9 @@
import java.util.Map.Entry;
import org.apache.wicket.protocol.http.UnitTestSettings;
-import org.apache.wicket.protocol.http.WicketURLEncoder;
import org.apache.wicket.protocol.http.WicketURLDecoder;
+import org.apache.wicket.protocol.http.WicketURLEncoder;
+import org.apache.wicket.protocol.http.servlet.AbortWithWebErrorCodeException;
import org.apache.wicket.util.string.AppendingStringBuffer;
import org.apache.wicket.util.string.Strings;
import org.apache.wicket.util.value.ValueMap;
@@ -39,13 +40,12 @@
* @author Igor Vaynberg (ivaynberg)
*/
public abstract class AbstractRequestTargetUrlCodingStrategy
- implements
- IRequestTargetUrlCodingStrategy,
- IMountableRequestTargetUrlCodingStrategy
+ implements
+ IRequestTargetUrlCodingStrategy,
+ IMountableRequestTargetUrlCodingStrategy
{
/** log. */
- private static final Logger log = LoggerFactory
-
.getLogger(AbstractRequestTargetUrlCodingStrategy.class);
+ private static final Logger log =
LoggerFactory.getLogger(AbstractRequestTargetUrlCodingStrategy.class);
/** mounted path. */
private final String mountPath;
@@ -168,9 +168,9 @@
// If we don't have an even number of pairs
if (pairs.length % 2 != 0)
{
- // give up
- throw new IllegalStateException("URL fragment has
unmatched key/value " + "pair: " +
- urlFragment);
+ log.warn("URL fragment has unmatched key/value pairs,
responding with 404. Fragment: " +
+ urlFragment);
+ throw new AbortWithWebErrorCodeException(404);
}
// Loop through pairs
@@ -192,76 +192,78 @@
return parameters;
}
- /**
- * Url encodes a string that is mean for a URL path (e.g., between slashes)
- *
- * @param string
- * string to be encoded
- * @return encoded string
- */
- protected String urlEncodePathComponent(String string)
- {
- return WicketURLEncoder.PATH_INSTANCE.encode(string);
- }
+ /**
+ * Url encodes a string that is mean for a URL path (e.g., between
slashes)
+ *
+ * @param string
+ * string to be encoded
+ * @return encoded string
+ */
+ protected String urlEncodePathComponent(String string)
+ {
+ return WicketURLEncoder.PATH_INSTANCE.encode(string);
+ }
- /**
+ /**
* Returns a decoded value of the given value (taken from a URL path
section)
- *
+ *
* @param value
* @return Decodes the value
*/
protected String urlDecodePathComponent(String value)
{
- return WicketURLDecoder.PATH_INSTANCE.decode(value);
+ return WicketURLDecoder.PATH_INSTANCE.decode(value);
}
- /**
+ /**
* Url encodes a string mean for a URL query string
- *
+ *
* @param string
* string to be encoded
* @return encoded string
*/
protected String urlEncodeQueryComponent(String string)
{
- return WicketURLEncoder.QUERY_INSTANCE.encode(string);
+ return WicketURLEncoder.QUERY_INSTANCE.encode(string);
}
- /**
- * Returns a decoded value of the given value (taken from a URL query
string)
- *
- * @param value
- * @return Decodes the value
- */
- protected String urlDecodeQueryComponent(String value)
- {
- return WicketURLDecoder.QUERY_INSTANCE.decode(value);
- }
+ /**
+ * Returns a decoded value of the given value (taken from a URL query
string)
+ *
+ * @param value
+ * @return Decodes the value
+ */
+ protected String urlDecodeQueryComponent(String value)
+ {
+ return WicketURLDecoder.QUERY_INSTANCE.decode(value);
+ }
- /**
- * @deprecated Use urlEncodePathComponent or urlEncodeQueryComponent
instead
+ /**
+ * @deprecated Use urlEncodePathComponent or urlEncodeQueryComponent
instead
*/
+ @Deprecated
protected String urlDecode(String value)
{
- return urlDecodePathComponent(value);
+ return urlDecodePathComponent(value);
}
/**
- * @deprecated Use urlEncodePathComponent or urlEncodeQueryComponent
instead
+ * @deprecated Use urlEncodePathComponent or urlEncodeQueryComponent
instead
*/
+ @Deprecated
protected String urlEncode(String string)
{
- return urlEncodePathComponent(string);
+ return urlEncodePathComponent(string);
}
- /**
- * Does given path match this mount? We match /mount/point or
/mount/point/with/extra/path, but not
- * /mount/pointXXX.
- *
- * @param path
- * @return true if matches, false otherwise
- */
- public boolean matches(String path)
+ /**
+ * Does given path match this mount? We match /mount/point or
/mount/point/with/extra/path, but
+ * not /mount/pointXXX.
+ *
+ * @param path
+ * @return true if matches, false otherwise
+ */
+ public boolean matches(String path)
{
if (path.startsWith(mountPath))
{