You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by jc...@apache.org on 2008/05/10 15:20:59 UTC
svn commit: r655080 - in
/wicket/trunk/wicket/src/main/java/org/apache/wicket: protocol/http/
protocol/http/request/ request/
Author: jcompagner
Date: Sat May 10 06:20:59 2008
New Revision: 655080
URL: http://svn.apache.org/viewvc?rev=655080&view=rev
Log:
WICKET-1603 pass through url coding strategy
Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/request/CryptedUrlWebRequestCodingStrategy.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/request/IRequestCodingStrategy.java
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java?rev=655080&r1=655079&r2=655080&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java Sat May 10 06:20:59 2008
@@ -351,6 +351,21 @@
mount(new SharedResourceRequestTargetUrlCodingStrategy(path, resourceKey));
}
+
+ /**
+ * Partly unmounts/ignores a path that normally would map to another mount path. Like
+ * mount("/mypage", MyPage.class); and then "/mypage/arealdir" should be ignored. This can be
+ * done by calling unMount("/mypage/arealdir");
+ *
+ * @param path
+ * the path that should be ignored.
+ *
+ */
+ public final void addIgnoreMountPath(String path)
+ {
+ getRequestCycleProcessor().getRequestCodingStrategy().addIgnoreMountPath(path);
+ }
+
/**
* @see org.apache.wicket.Application#newRequestCycle(org.apache.wicket.Request,
* org.apache.wicket.Response)
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/request/CryptedUrlWebRequestCodingStrategy.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/request/CryptedUrlWebRequestCodingStrategy.java?rev=655080&r1=655079&r2=655080&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/request/CryptedUrlWebRequestCodingStrategy.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/request/CryptedUrlWebRequestCodingStrategy.java Sat May 10 06:20:59 2008
@@ -72,8 +72,7 @@
public class CryptedUrlWebRequestCodingStrategy implements IRequestCodingStrategy
{
/** log. */
- private static final Logger log = LoggerFactory
- .getLogger(CryptedUrlWebRequestCodingStrategy.class);
+ private static final Logger log = LoggerFactory.getLogger(CryptedUrlWebRequestCodingStrategy.class);
/** The default request coding strategy most of the methods are delegated to */
private final IRequestCodingStrategy defaultStrategy;
@@ -140,6 +139,11 @@
defaultStrategy.unmount(path);
}
+ public void addIgnoreMountPath(String path)
+ {
+ defaultStrategy.addIgnoreMountPath(path);
+ }
+
/**
* @see org.apache.wicket.request.IRequestTargetMounter#urlCodingStrategyForPath(java.lang.String)
*/
@@ -204,8 +208,10 @@
try
{
- encryptedQueryString = URLEncoder.encode(encryptedQueryString, Application
- .get().getRequestCycleSettings().getResponseRequestEncoding());
+ encryptedQueryString = URLEncoder.encode(encryptedQueryString,
+ Application.get()
+ .getRequestCycleSettings()
+ .getResponseRequestEncoding());
}
catch (UnsupportedEncodingException ex)
{
@@ -214,7 +220,7 @@
// build the new complete url
return new AppendingStringBuffer(urlPrefix).append("?x=").append(
- encryptedQueryString);
+ encryptedQueryString);
}
}
}
@@ -250,11 +256,14 @@
}
secureParam = URLDecoder.decode(secureParam, Application.get()
- .getRequestCycleSettings().getResponseRequestEncoding());
+ .getRequestCycleSettings()
+ .getResponseRequestEncoding());
// Get the crypt implementation from the application
- final ICrypt urlCrypt = Application.get().getSecuritySettings().getCryptFactory()
- .newCrypt();
+ final ICrypt urlCrypt = Application.get()
+ .getSecuritySettings()
+ .getCryptFactory()
+ .newCrypt();
// Decrypt the query string
String queryString = urlCrypt.decryptUrlSafe(secureParam);
@@ -295,19 +304,19 @@
protected CharSequence shortenUrl(CharSequence queryString)
{
queryString = Strings.replaceAll(queryString,
- WebRequestCodingStrategy.BEHAVIOR_ID_PARAMETER_NAME + "=", "1*");
+ WebRequestCodingStrategy.BEHAVIOR_ID_PARAMETER_NAME + "=", "1*");
queryString = Strings.replaceAll(queryString,
- WebRequestCodingStrategy.INTERFACE_PARAMETER_NAME + "=IRedirectListener", "2*");
+ WebRequestCodingStrategy.INTERFACE_PARAMETER_NAME + "=IRedirectListener", "2*");
queryString = Strings.replaceAll(queryString,
- WebRequestCodingStrategy.INTERFACE_PARAMETER_NAME + "=IFormSubmitListener", "3*");
+ WebRequestCodingStrategy.INTERFACE_PARAMETER_NAME + "=IFormSubmitListener", "3*");
queryString = Strings.replaceAll(queryString,
- WebRequestCodingStrategy.INTERFACE_PARAMETER_NAME + "=IOnChangeListener", "4*");
+ WebRequestCodingStrategy.INTERFACE_PARAMETER_NAME + "=IOnChangeListener", "4*");
queryString = Strings.replaceAll(queryString,
- WebRequestCodingStrategy.INTERFACE_PARAMETER_NAME + "=ILinkListener", "5*");
+ WebRequestCodingStrategy.INTERFACE_PARAMETER_NAME + "=ILinkListener", "5*");
queryString = Strings.replaceAll(queryString,
- WebRequestCodingStrategy.INTERFACE_PARAMETER_NAME + "=", "6*");
+ WebRequestCodingStrategy.INTERFACE_PARAMETER_NAME + "=", "6*");
queryString = Strings.replaceAll(queryString,
- WebRequestCodingStrategy.BOOKMARKABLE_PAGE_PARAMETER_NAME + "=", "7*");
+ WebRequestCodingStrategy.BOOKMARKABLE_PAGE_PARAMETER_NAME + "=", "7*");
// For debugging only: determine possibilities to further shorten
// the query string
@@ -338,19 +347,19 @@
protected String rebuildUrl(CharSequence queryString)
{
queryString = Strings.replaceAll(queryString, "1*",
- WebRequestCodingStrategy.BEHAVIOR_ID_PARAMETER_NAME + "=");
+ WebRequestCodingStrategy.BEHAVIOR_ID_PARAMETER_NAME + "=");
queryString = Strings.replaceAll(queryString, "2*",
- WebRequestCodingStrategy.INTERFACE_PARAMETER_NAME + "=IRedirectListener");
+ WebRequestCodingStrategy.INTERFACE_PARAMETER_NAME + "=IRedirectListener");
queryString = Strings.replaceAll(queryString, "3*",
- WebRequestCodingStrategy.INTERFACE_PARAMETER_NAME + "=IFormSubmitListener");
+ WebRequestCodingStrategy.INTERFACE_PARAMETER_NAME + "=IFormSubmitListener");
queryString = Strings.replaceAll(queryString, "4*",
- WebRequestCodingStrategy.INTERFACE_PARAMETER_NAME + "=IOnChangeListener");
+ WebRequestCodingStrategy.INTERFACE_PARAMETER_NAME + "=IOnChangeListener");
queryString = Strings.replaceAll(queryString, "5*",
- WebRequestCodingStrategy.INTERFACE_PARAMETER_NAME + "=ILinkListener");
+ WebRequestCodingStrategy.INTERFACE_PARAMETER_NAME + "=ILinkListener");
queryString = Strings.replaceAll(queryString, "6*",
- WebRequestCodingStrategy.INTERFACE_PARAMETER_NAME + "=");
+ WebRequestCodingStrategy.INTERFACE_PARAMETER_NAME + "=");
queryString = Strings.replaceAll(queryString, "7*",
- WebRequestCodingStrategy.BOOKMARKABLE_PAGE_PARAMETER_NAME + "=");
+ WebRequestCodingStrategy.BOOKMARKABLE_PAGE_PARAMETER_NAME + "=");
return queryString.toString();
}
@@ -381,7 +390,7 @@
* @param encodedParamReplacement
*/
public DecodedUrlRequest(final Request request, final String url,
- final String encodedParamReplacement)
+ final String encodedParamReplacement)
{
this.request = request;
@@ -393,8 +402,8 @@
String decodedParamReplacement = encodedParamReplacement;
try
{
- decodedParamReplacement = URLDecoder.decode(encodedParamReplacement, Application
- .get().getRequestCycleSettings().getResponseRequestEncoding());
+ decodedParamReplacement = URLDecoder.decode(encodedParamReplacement,
+ Application.get().getRequestCycleSettings().getResponseRequestEncoding());
}
catch (UnsupportedEncodingException ex)
{
@@ -415,7 +424,7 @@
int pos2 = url.indexOf("&");
AppendingStringBuffer urlBuf = new AppendingStringBuffer(url.length() +
- encodedParamReplacement.length());
+ encodedParamReplacement.length());
urlBuf.append(url.subSequence(0, pos1 + 1));
urlBuf.append(encodedParamReplacement);
if (pos2 != -1)
@@ -430,6 +439,7 @@
*
* @see org.apache.wicket.Request#getLocale()
*/
+ @Override
public Locale getLocale()
{
return request.getLocale();
@@ -438,6 +448,7 @@
/**
* @see org.apache.wicket.Request#getParameter(java.lang.String)
*/
+ @Override
public String getParameter(final String key)
{
if (key == null)
@@ -469,6 +480,7 @@
/**
* @see org.apache.wicket.Request#getParameterMap()
*/
+ @Override
public Map getParameterMap()
{
return parameterMap;
@@ -477,6 +489,7 @@
/**
* @see org.apache.wicket.Request#getParameters(java.lang.String)
*/
+ @Override
public String[] getParameters(final String key)
{
if (key == null)
@@ -507,17 +520,20 @@
/**
* @see org.apache.wicket.Request#getPath()
*/
+ @Override
public String getPath()
{
// Hasn't changed. We only encoded the querystring
return request.getPath();
}
+ @Override
public String getRelativePathPrefixToContextRoot()
{
return request.getRelativePathPrefixToContextRoot();
}
+ @Override
public String getRelativePathPrefixToWicketHandler()
{
return request.getRelativePathPrefixToWicketHandler();
@@ -526,11 +542,12 @@
/**
* @see org.apache.wicket.Request#getURL()
*/
+ @Override
public String getURL()
{
return url;
}
-
+
@Override
public String getQueryString()
{
@@ -560,6 +577,7 @@
*
* @see java.lang.Throwable#getStackTrace()
*/
+ @Override
public StackTraceElement[] getStackTrace()
{
return new StackTraceElement[0];
@@ -570,6 +588,7 @@
*
* @see java.lang.Throwable#toString()
*/
+ @Override
public String toString()
{
return getMessage();
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java?rev=655080&r1=655079&r2=655080&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java Sat May 10 06:20:59 2008
@@ -34,8 +34,8 @@
import org.apache.wicket.Page;
import org.apache.wicket.PageMap;
import org.apache.wicket.PageParameters;
-import org.apache.wicket.RequestContext;
import org.apache.wicket.Request;
+import org.apache.wicket.RequestContext;
import org.apache.wicket.RequestCycle;
import org.apache.wicket.RequestListenerInterface;
import org.apache.wicket.Session;
@@ -104,7 +104,7 @@
* to be present to enable the behavior
*/
public static final String IGNORE_IF_NOT_ACTIVE_PARAMETER_NAME = NAME_SPACE +
- "ignoreIfNotActive";
+ "ignoreIfNotActive";
/**
* Various settings used to configure this strategy
@@ -231,7 +231,7 @@
* org.apache.wicket.IRequestTarget)
*/
public final CharSequence encode(final RequestCycle requestCycle,
- final IRequestTarget requestTarget)
+ final IRequestTarget requestTarget)
{
// First check to see whether the target is mounted
CharSequence url = pathForTarget(requestTarget);
@@ -247,12 +247,12 @@
else if (requestTarget instanceof IBookmarkablePageRequestTarget)
{
url = requestContext.encodeRenderURL(url == null ? encode(requestCycle,
- (IBookmarkablePageRequestTarget)requestTarget) : url);
+ (IBookmarkablePageRequestTarget)requestTarget) : url);
}
else if (requestTarget instanceof ISharedResourceRequestTarget)
{
url = requestContext.encodeSharedResourceURL(url == null ? encode(requestCycle,
- (ISharedResourceRequestTarget)requestTarget) : url);
+ (ISharedResourceRequestTarget)requestTarget) : url);
sharedResourceURL = true;
}
else if (requestTarget instanceof IListenerInterfaceRequestTarget)
@@ -266,13 +266,12 @@
IListenerInterfaceRequestTarget iliRequestTarget = (IListenerInterfaceRequestTarget)requestTarget;
RequestListenerInterface rli = iliRequestTarget.getRequestListenerInterface();
if (IResourceListener.class.isAssignableFrom(rli.getMethod().getDeclaringClass()) ||
- IBehaviorListener.class.isAssignableFrom(rli.getMethod()
- .getDeclaringClass()))
+ IBehaviorListener.class.isAssignableFrom(rli.getMethod().getDeclaringClass()))
{
url = requestContext.encodeResourceURL(url);
}
else if (IRedirectListener.class.isAssignableFrom(rli.getMethod()
- .getDeclaringClass()))
+ .getDeclaringClass()))
{
if (((WebRequestCycle)requestCycle).getWebRequest().isAjax())
{
@@ -297,7 +296,7 @@
for (int i = 0, size = behaviors.size(); i < size; i++)
{
if (AbstractAjaxBehavior.class.isAssignableFrom(behaviors.get(i)
- .getClass()))
+ .getClass()))
{
forceActionURL = false;
break;
@@ -380,7 +379,7 @@
synchronized (mountsOnPath)
{
return (IRequestTargetUrlCodingStrategy[])mountsOnPath.strategies().toArray(
- new IRequestTargetUrlCodingStrategy[mountsOnPath.size()]);
+ new IRequestTargetUrlCodingStrategy[mountsOnPath.size()]);
}
}
@@ -398,7 +397,7 @@
else
{
IRequestTargetUrlCodingStrategy strategy = mountsOnPath.strategyForPath(path);
- if (strategy != null)
+ if (strategy != null && !(strategy instanceof PassThroughUrlCodingStrategy))
{
return strategy;
}
@@ -427,7 +426,7 @@
if (path.equals("/") || path.equals(""))
{
throw new IllegalArgumentException(
- "The mount path '/' is reserved for the application home page");
+ "The mount path '/' is reserved for the application home page");
}
// Sanity check in case someone doesn't read the javadoc while
@@ -442,13 +441,21 @@
if (mountsOnPath.strategyForMount(path) != null)
{
throw new WicketRuntimeException(path + " is already mounted for " +
- mountsOnPath.strategyForMount(path));
+ mountsOnPath.strategyForMount(path));
}
mountsOnPath.mount(path, encoder);
}
}
/**
+ * @see org.apache.wicket.request.IRequestCodingStrategy#addIgnoreMountPath(String)
+ */
+ public void addIgnoreMountPath(String path)
+ {
+ mount(new PassThroughUrlCodingStrategy(path));
+ }
+
+ /**
* @see org.apache.wicket.request.IRequestCodingStrategy#pathForTarget(org.apache.wicket.IRequestTarget)
*/
public final CharSequence pathForTarget(IRequestTarget requestTarget)
@@ -467,8 +474,7 @@
*/
public final IRequestTarget targetForRequest(RequestParameters requestParameters)
{
- IRequestTargetUrlCodingStrategy encoder = urlCodingStrategyForPath(requestParameters
- .getPath());
+ IRequestTargetUrlCodingStrategy encoder = urlCodingStrategyForPath(requestParameters.getPath());
if (encoder == null)
{
return null;
@@ -513,24 +519,22 @@
* the parameters object to set the found values on
*/
protected void addBookmarkablePageParameters(final Request request,
- final RequestParameters parameters)
+ final RequestParameters parameters)
{
- final String requestString = request
- .getParameter(WebRequestCodingStrategy.BOOKMARKABLE_PAGE_PARAMETER_NAME);
+ final String requestString = request.getParameter(WebRequestCodingStrategy.BOOKMARKABLE_PAGE_PARAMETER_NAME);
if (requestString != null)
{
final String[] components = Strings.split(requestString, Component.PATH_SEPARATOR);
if (components.length != 2)
{
throw new WicketRuntimeException("Invalid bookmarkablePage parameter: " +
- requestString + ", expected: 'pageMapName:pageClassName'");
+ requestString + ", expected: 'pageMapName:pageClassName'");
}
// Extract any pagemap name
final String pageMapName = components[0];
- parameters.setPageMapName(pageMapName.length() == 0
- ? PageMap.DEFAULT_NAME
- : pageMapName);
+ parameters.setPageMapName(pageMapName.length() == 0 ? PageMap.DEFAULT_NAME
+ : pageMapName);
// Extract bookmarkable page class name
final String pageClassName = components[1];
@@ -567,7 +571,7 @@
* parameters object to set the found parts in
*/
public static void addInterfaceParameters(final String interfaceParameter,
- final RequestParameters parameters)
+ final RequestParameters parameters)
{
if (interfaceParameter == null)
{
@@ -582,7 +586,7 @@
if (pathComponents.length < 6)
{
throw new WicketRuntimeException("Internal error parsing " + INTERFACE_PARAMETER_NAME +
- " = " + interfaceParameter);
+ " = " + interfaceParameter);
}
// Extract version
@@ -590,16 +594,16 @@
try
{
versionNumberString = pathComponents[pathComponents.length - 4];
- final int versionNumber = Strings.isEmpty(versionNumberString) ? 0 : Integer
- .parseInt(versionNumberString);
+ final int versionNumber = Strings.isEmpty(versionNumberString) ? 0
+ : Integer.parseInt(versionNumberString);
parameters.setVersionNumber(versionNumber);
}
catch (NumberFormatException e)
{
throw new WicketRuntimeException("Internal error parsing " + INTERFACE_PARAMETER_NAME +
- " = " + interfaceParameter +
- "; wrong format for page version argument. Expected a number but was '" +
- versionNumberString + "'", e);
+ " = " + interfaceParameter +
+ "; wrong format for page version argument. Expected a number but was '" +
+ versionNumberString + "'", e);
}
// Set pagemap name
@@ -616,9 +620,9 @@
catch (NumberFormatException e)
{
throw new WicketRuntimeException("Internal error parsing " + INTERFACE_PARAMETER_NAME +
- " = " + interfaceParameter +
- "; wrong format for url depth argument. Expected a number but was '" +
- urlDepthString + "'", e);
+ " = " + interfaceParameter +
+ "; wrong format for url depth argument. Expected a number but was '" +
+ urlDepthString + "'", e);
}
parameters.setUrlDepth(urlDepth);
@@ -628,14 +632,13 @@
// Extract interface name after second-to-last colon
final String interfaceName = pathComponents[pathComponents.length - 3];
- parameters.setInterfaceName(interfaceName.length() != 0
- ? interfaceName
- : IRedirectListener.INTERFACE.getName());
+ parameters.setInterfaceName(interfaceName.length() != 0 ? interfaceName
+ : IRedirectListener.INTERFACE.getName());
// Component path is everything after pageMapName and before version
final int start = pageMapName.length() + 1;
final int end = interfaceParameter.length() - behaviourId.length() -
- interfaceName.length() - versionNumberString.length() - urlDepthString.length() - 4;
+ interfaceName.length() - versionNumberString.length() - urlDepthString.length() - 4;
final String componentPath = interfaceParameter.substring(start, end);
parameters.setComponentPath(componentPath);
}
@@ -710,13 +713,13 @@
* @return the encoded url
*/
protected CharSequence encode(RequestCycle requestCycle,
- IBookmarkablePageRequestTarget requestTarget)
+ IBookmarkablePageRequestTarget requestTarget)
{
// Begin encoding URL
final AppendingStringBuffer url = new AppendingStringBuffer(64);
// Get page Class
- final Class<? extends Page> pageClass = requestTarget.getPageClass();
+ final Class< ? extends Page> pageClass = requestTarget.getPageClass();
final Application application = Application.get();
// Find pagemap name
@@ -745,8 +748,8 @@
WebRequestEncoder encoder = new WebRequestEncoder(url);
if (!application.getHomePage().equals(pageClass) ||
- !"".equals(pageMapName) ||
- (application.getHomePage().equals(pageClass) && requestTarget instanceof BookmarkableListenerInterfaceRequestTarget))
+ !"".equals(pageMapName) ||
+ (application.getHomePage().equals(pageClass) && requestTarget instanceof BookmarkableListenerInterfaceRequestTarget))
{
/*
* Add <page-map-name>:<bookmarkable-page-class>
@@ -759,7 +762,7 @@
* unencoded url correctly.
*/
encoder.addValue(WebRequestCodingStrategy.BOOKMARKABLE_PAGE_PARAMETER_NAME,
- pageMapName + Component.PATH_SEPARATOR + pageClass.getName());
+ pageMapName + Component.PATH_SEPARATOR + pageClass.getName());
}
// Get page parameters
@@ -805,7 +808,7 @@
* @return the encoded url
*/
protected CharSequence encode(RequestCycle requestCycle,
- ISharedResourceRequestTarget requestTarget)
+ ISharedResourceRequestTarget requestTarget)
{
final String sharedResourceKey = requestTarget.getResourceKey();
if ((sharedResourceKey == null) || (sharedResourceKey.trim().length() == 0))
@@ -814,8 +817,8 @@
}
else
{
- final AppendingStringBuffer buffer = new AppendingStringBuffer(sharedResourceKey
- .length());
+ final AppendingStringBuffer buffer = new AppendingStringBuffer(
+ sharedResourceKey.length());
buffer.append(RESOURCES_PATH_PREFIX);
buffer.append(sharedResourceKey);
Map map = requestTarget.getRequestParameters().getParameters();
@@ -853,7 +856,7 @@
* @return the encoded url
*/
protected CharSequence encode(RequestCycle requestCycle,
- IListenerInterfaceRequestTarget requestTarget)
+ IListenerInterfaceRequestTarget requestTarget)
{
final RequestListenerInterface rli = requestTarget.getRequestListenerInterface();
@@ -916,7 +919,7 @@
if (IActivePageBehaviorListener.INTERFACE.getName().equals(listenerName))
{
url.append(url.indexOf("?") > -1 ? "&" : "?").append(
- IGNORE_IF_NOT_ACTIVE_PARAMETER_NAME).append("=true");
+ IGNORE_IF_NOT_ACTIVE_PARAMETER_NAME).append("=true");
}
return url;
}
@@ -1037,8 +1040,7 @@
final String key = (String)entry.getKey();
if (path.startsWith(key))
{
- IRequestTargetUrlCodingStrategy strategy = (IRequestTargetUrlCodingStrategy)entry
- .getValue();
+ IRequestTargetUrlCodingStrategy strategy = (IRequestTargetUrlCodingStrategy)entry.getValue();
if (strategy.matches(path))
{
return strategy;
@@ -1107,7 +1109,7 @@
* @return previous coding strategy associated with the mount, or null if none
*/
public IRequestTargetUrlCodingStrategy mount(String mount,
- IRequestTargetUrlCodingStrategy encoder)
+ IRequestTargetUrlCodingStrategy encoder)
{
if (caseSensitiveMounts == false && mount != null)
{
@@ -1186,4 +1188,46 @@
return pageMapName;
}
}
+
+ private static class PassThroughUrlCodingStrategy implements IRequestTargetUrlCodingStrategy
+ {
+ private final String path;
+
+ /**
+ * Construct.
+ *
+ * @param path
+ */
+ public PassThroughUrlCodingStrategy(String path)
+ {
+ this.path = path;
+ }
+
+ public IRequestTarget decode(RequestParameters requestParameters)
+ {
+ return null;
+ }
+
+ public CharSequence encode(IRequestTarget requestTarget)
+ {
+ return null;
+ }
+
+ public String getMountPath()
+ {
+ return path;
+ }
+
+ public boolean matches(IRequestTarget requestTarget)
+ {
+ return false;
+ }
+
+ public boolean matches(String path)
+ {
+ return false;
+ }
+
+ }
+
}
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/request/IRequestCodingStrategy.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/request/IRequestCodingStrategy.java?rev=655080&r1=655079&r2=655080&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/request/IRequestCodingStrategy.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/request/IRequestCodingStrategy.java Sat May 10 06:20:59 2008
@@ -56,4 +56,15 @@
* @return the url to the provided target
*/
CharSequence encode(RequestCycle requestCycle, IRequestTarget requestTarget);
+
+ /**
+ * Partly unmounts/ignores a path that normally would map to another mount path. Like
+ * mount("/mypage", MyPage.class); and then "/mypage/arealdir" should be ignored. This can be
+ * done by calling unMount("/mypage/arealdir");
+ *
+ * @param path
+ * the path that should be ignored.
+ *
+ */
+ void addIgnoreMountPath(String path);
}