* [EMAIL PROTECTED]:
> Author: jdonnerstag
> Date: Sat May 12 07:10:17 2007
> New Revision: 537428
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=537428
> Log:
> wicket-293: PackageRequestTargetUrlCodingStrategy should sends a 404 when a
> page/class cannot be found.
>
> fixed
>
> Modified:
>
> incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java
>
> incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/target/coding/PackageRequestTargetUrlCodingStrategy.java
>
> incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/request/target/coding/UrlMountingTest.java
>
> Modified:
> incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java
> URL:
> http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java?view=diff&rev=537428&r1=537427&r2=537428
> ==============================================================================
> ---
> incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java
> (original)
> +++
> incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java
> Sat May 12 07:10:17 2007
> @@ -24,6 +24,8 @@
> import java.util.TreeSet;
> import java.util.Map.Entry;
>
> +import javax.servlet.http.HttpServletResponse;
> +
> import org.apache.wicket.Application;
> import org.apache.wicket.Component;
> import org.apache.wicket.IPageMap;
> @@ -361,7 +363,27 @@
> {
> IRequestTargetUrlCodingStrategy encoder =
> urlCodingStrategyForPath(requestParameters
> .getPath());
> - return (encoder != null) ? encoder.decode(requestParameters) :
> null;
> + if (encoder == null)
> + {
> + return null;
> + }
> + try
> + {
> + return encoder.decode(requestParameters);
> + }
> + catch (WicketRuntimeException ex)
> + {
> + if (log.isDebugEnabled())
> + {
> + log.debug(ex.toString());
> +
> + return new
> WebErrorCodeResponseTarget(HttpServletResponse.SC_NOT_FOUND,
> + "Unable to load Page: " + ex.toString());
> + }
> +
> + return new
> WebErrorCodeResponseTarget(HttpServletResponse.SC_NOT_FOUND,
> + "Unable to load Page");
> + }
Hello Juergen,
Thanks for taking care of this. However don't you think that we
could create a custom Exception like PageNotFoundException to
avoid catching any exception? Otherwise some legitimate
exceptions might be swallowed.
Cheers,
--
Jean-Baptiste Quenot
aka John Banana Qwerty
http://caraldi.com/jbq/