You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2014/02/02 10:22:36 UTC
[1/3] git commit: Java 7 diamonds
Updated Branches:
refs/heads/master 0a271d8a9 -> 972c71522
Java 7 diamonds
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/c97f5779
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/c97f5779
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/c97f5779
Branch: refs/heads/master
Commit: c97f5779d655dd9c2fa40ebbcb5dbdc24de0eab7
Parents: 0a271d8
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Sun Feb 2 10:17:15 2014 +0100
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Sun Feb 2 10:17:15 2014 +0100
----------------------------------------------------------------------
.../org/apache/wicket/ajax/attributes/AjaxRequestAttributes.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/c97f5779/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxRequestAttributes.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxRequestAttributes.java b/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxRequestAttributes.java
index df01b01..b8b4e2e 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxRequestAttributes.java
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxRequestAttributes.java
@@ -242,7 +242,7 @@ public final class AjaxRequestAttributes
{
if (extraParameters == null)
{
- extraParameters = new HashMap<String, Object>();
+ extraParameters = new HashMap<>();
}
return extraParameters;
}
@@ -283,7 +283,7 @@ public final class AjaxRequestAttributes
{
if (dynamicExtraParameters == null)
{
- dynamicExtraParameters = new ArrayList<CharSequence>();
+ dynamicExtraParameters = new ArrayList<>();
}
return dynamicExtraParameters;
}
[2/3] git commit: Fix #setPreventDefault and #isPreventDefault's
javadoc.
Posted by mg...@apache.org.
Fix #setPreventDefault and #isPreventDefault's javadoc.
Add back #setAllowDefault and #isAllowDefault as deprecated for easier migration to 7.x
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/7c2f79a6
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/7c2f79a6
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/7c2f79a6
Branch: refs/heads/master
Commit: 7c2f79a6f2f84ee970729205f5e574c23340c4e1
Parents: c97f577
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Sun Feb 2 10:17:29 2014 +0100
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Sun Feb 2 10:17:29 2014 +0100
----------------------------------------------------------------------
.../ajax/attributes/AjaxRequestAttributes.java | 54 ++++++++++++++------
1 file changed, 37 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/7c2f79a6/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxRequestAttributes.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxRequestAttributes.java b/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxRequestAttributes.java
index b8b4e2e..9eff742 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxRequestAttributes.java
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxRequestAttributes.java
@@ -289,14 +289,14 @@ public final class AjaxRequestAttributes
}
/**
- * Only applies for event behaviors. Returns whether the behavior should allow the default event
+ * Only applies for event behaviors. Returns whether the behavior should prevent the default event
* handler to be invoked. For example if the behavior is attached to a link and
- * {@link #isPreventDefault()} returns <code>false</code> (which is default value), the link's
+ * isPreventDefault() returns <code>true</code>, the link's
* URL will not be followed. If the Ajax behavior is attached to a checkbox or a radio button
* then the default behavior should be allowed to actually check the box or radio button, i.e.
- * this method should return <code>true</code>.
+ * this method should return <code>false</code>.
*
- * @return {@code true} if the default event handler should be invoked, {@code false} otherwise.
+ * @return {@code false} if the default event handler should be invoked
*/
public boolean isPreventDefault()
{
@@ -304,20 +304,11 @@ public final class AjaxRequestAttributes
}
/**
- * Only applies for event behaviors. Returns whether the behavior should allow the JavaScript
- * event to propagate to the parent of its target.
- */
- public EventPropagation getEventPropagation()
- {
- return eventPropagation;
- }
-
- /**
- * Only applies for event behaviors. Determines whether the behavior should allow the default
+ * Only applies for event behaviors. Determines whether the behavior should prevent the default
* event handler to be invoked.
- *
+ *
* @see #isPreventDefault()
- *
+ *
* @param preventDefault
* @return {@code this} object for chaining
* @see #isPreventDefault()
@@ -329,6 +320,35 @@ public final class AjaxRequestAttributes
}
/**
+ * @return {@code this} object for chaining
+ * @deprecated Use #setPreventDefault() instead
+ */
+ @Deprecated
+ public AjaxRequestAttributes setAllowDefault(boolean allowDefault)
+ {
+ this.preventDefault = !allowDefault;
+ return this;
+ }
+
+ /**
+ * @deprecated Use #isPreventDefault() instead
+ */
+ @Deprecated
+ public boolean isAllowDefault()
+ {
+ return !preventDefault;
+ }
+
+ /**
+ * Only applies for event behaviors. Returns whether the behavior should allow the JavaScript
+ * event to propagate to the parent of its target.
+ */
+ public EventPropagation getEventPropagation()
+ {
+ return eventPropagation;
+ }
+
+ /**
* Only applies to event behaviors. Determines whether the behavior should allow the JavaScript
* event to propagate to the parent of its target.
*
@@ -502,4 +522,4 @@ public final class AjaxRequestAttributes
return this;
}
-}
\ No newline at end of file
+}
[3/3] git commit: Restore MountMapper and related classes as
deprecated.
Posted by mg...@apache.org.
Restore MountMapper and related classes as deprecated.
They are not used and will be removed in Wicket 8.0.0 but can stay until then for easier migration to 7.x
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/972c7152
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/972c7152
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/972c7152
Branch: refs/heads/master
Commit: 972c71522caddfa3c6836dafab6831a9643cbd08
Parents: 7c2f79a
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Sun Feb 2 10:21:11 2014 +0100
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Sun Feb 2 10:21:11 2014 +0100
----------------------------------------------------------------------
.../mapper/mount/IMountedRequestMapper.java | 70 ++++++++
.../wicket/request/mapper/mount/Mount.java | 73 ++++++++
.../request/mapper/mount/MountMapper.java | 174 +++++++++++++++++++
.../request/mapper/mount/MountParameters.java | 121 +++++++++++++
.../mapper/mount/UnmountedMapperAdapter.java | 80 +++++++++
.../mount/UnmountedRequestHandlerAdapter.java | 77 ++++++++
6 files changed, 595 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/972c7152/wicket-request/src/main/java/org/apache/wicket/request/mapper/mount/IMountedRequestMapper.java
----------------------------------------------------------------------
diff --git a/wicket-request/src/main/java/org/apache/wicket/request/mapper/mount/IMountedRequestMapper.java b/wicket-request/src/main/java/org/apache/wicket/request/mapper/mount/IMountedRequestMapper.java
new file mode 100644
index 0000000..3100b78
--- /dev/null
+++ b/wicket-request/src/main/java/org/apache/wicket/request/mapper/mount/IMountedRequestMapper.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.request.mapper.mount;
+
+import org.apache.wicket.request.IRequestHandler;
+import org.apache.wicket.request.Request;
+
+/**
+ * TODO javadoc, explain "parameters resolved from the mount"
+ *
+ * @author igor.vaynberg
+ * @deprecated Will be removed in Wicket 8.0
+ */
+@Deprecated
+public interface IMountedRequestMapper
+{
+ /**
+ * Returns {@link org.apache.wicket.request.IRequestHandler} for the request or <code>null</code> if the encoder does not
+ * recognize the URL.
+ *
+ * @param request
+ * provides access to request data (i.e. Url and Parameters)
+ * @param mountParams
+ * parameters resolved from the mount
+ * @return RequestHandler instance or <code>null</code>
+ */
+ IRequestHandler mapRequest(Request request, MountParameters mountParams);
+
+ /**
+ * Returns the score representing how compatible this request mapper is to processing the given
+ * request. When a request comes in all mappers are scored and are tried in order from highest
+ * score to lowest.
+ * <p>
+ * A good criteria for calculating the score is the number of matched url segments. For example
+ * when there are two encoders for mounted page, one mapped to <code>/foo</code> another to
+ * <code>/foo/bar</code> and the incomming reqest URL is </code>/foo/bar/baz</code>, the encoder
+ * mapped to <code>/foo/bar</code> will handle the request first as it has matching segments
+ * count of 2 while the first one has only matching segments count of 1.
+ * <p>
+ * Note that the method can return value greater then zero even if the encoder can not decode
+ * the request.
+ *
+ * @param request
+ * @return count of matching segments
+ */
+ int getCompatibilityScore(Request request);
+
+ /**
+ * Returns the {@link Mount} for given {@link org.apache.wicket.request.IRequestHandler} or <code>null</code> if the
+ * encoder does not recognize the request handler.
+ *
+ * @param requestHandler
+ * @return Url instance or <code>null</code>.
+ */
+ Mount mapHandler(IRequestHandler requestHandler);
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/972c7152/wicket-request/src/main/java/org/apache/wicket/request/mapper/mount/Mount.java
----------------------------------------------------------------------
diff --git a/wicket-request/src/main/java/org/apache/wicket/request/mapper/mount/Mount.java b/wicket-request/src/main/java/org/apache/wicket/request/mapper/mount/Mount.java
new file mode 100644
index 0000000..5040bf7
--- /dev/null
+++ b/wicket-request/src/main/java/org/apache/wicket/request/mapper/mount/Mount.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.request.mapper.mount;
+
+import org.apache.wicket.request.Url;
+
+/**
+ * @deprecated Will be removed in Wicket 8.0
+ */
+@Deprecated
+public class Mount
+{
+ /**
+ * The {@link org.apache.wicket.request.Url} to mount on
+ */
+ private final Url url;
+
+ /**
+ * A map of placeholder key/value pairs for the {@link #url}'s segments
+ */
+ private MountParameters mountParameters = new MountParameters();
+
+ /**
+ * Construct.
+ *
+ * @param url
+ */
+ public Mount(final Url url)
+ {
+ this.url = url;
+ }
+
+ /**
+ *
+ * @param mountParameters
+ */
+ public void setMountParameters(final MountParameters mountParameters)
+ {
+ this.mountParameters = mountParameters;
+ }
+
+ /**
+ *
+ * @return mount parameters
+ */
+ public MountParameters getMountParameters()
+ {
+ return mountParameters;
+ }
+
+ /**
+ *
+ * @return Url
+ */
+ public Url getUrl()
+ {
+ return url;
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/972c7152/wicket-request/src/main/java/org/apache/wicket/request/mapper/mount/MountMapper.java
----------------------------------------------------------------------
diff --git a/wicket-request/src/main/java/org/apache/wicket/request/mapper/mount/MountMapper.java b/wicket-request/src/main/java/org/apache/wicket/request/mapper/mount/MountMapper.java
new file mode 100644
index 0000000..40d0edd
--- /dev/null
+++ b/wicket-request/src/main/java/org/apache/wicket/request/mapper/mount/MountMapper.java
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.request.mapper.mount;
+
+import org.apache.wicket.request.IRequestHandler;
+import org.apache.wicket.request.IRequestMapper;
+import org.apache.wicket.request.Request;
+import org.apache.wicket.request.Url;
+import org.apache.wicket.request.mapper.AbstractMapper;
+import org.apache.wicket.util.lang.Args;
+import org.apache.wicket.util.lang.Checks;
+import org.apache.wicket.util.string.StringValue;
+
+/**
+ * {@link org.apache.wicket.request.IRequestMapper} that can mount requests onto urls. TODO docs and unit test
+ *
+ * @author igor.vaynberg
+ * @deprecated Will be removed in Wicket 8.0
+ */
+@Deprecated
+public class MountMapper extends AbstractMapper
+{
+ private final String[] mountSegments;
+ private final IMountedRequestMapper mapper;
+
+ /**
+ * Construct.
+ *
+ * @param mountPath
+ * @param mapper
+ */
+ public MountMapper(final String mountPath, final IMountedRequestMapper mapper)
+ {
+ Args.notEmpty(mountPath, "mountPath");
+ Args.notNull(mapper, "mapper");
+
+ mountSegments = getMountSegments(mountPath);
+ this.mapper = mapper;
+ }
+
+ /**
+ * Construct.
+ *
+ * @param mountPath
+ * @param mapper
+ */
+ public MountMapper(final String mountPath, final IRequestMapper mapper)
+ {
+ Args.notEmpty(mountPath, "mountPath");
+ Args.notNull(mapper, "mapper");
+
+ mountSegments = getMountSegments(mountPath);
+ this.mapper = new UnmountedMapperAdapter(mapper);
+ }
+
+ /**
+ * Construct.
+ *
+ * @param mountPath
+ * @param handler
+ */
+ public MountMapper(final String mountPath, final IRequestHandler handler)
+ {
+ Args.notEmpty(mountPath, "mountPath");
+ Args.notNull(handler, "handler");
+
+ mountSegments = getMountSegments(mountPath);
+ mapper = new UnmountedRequestHandlerAdapter(handler);
+ }
+
+ /**
+ * @see org.apache.wicket.request.IRequestMapper#getCompatibilityScore(org.apache.wicket.request.Request)
+ */
+ @Override
+ public int getCompatibilityScore(final Request request)
+ {
+ if (urlStartsWith(request.getUrl(), mountSegments))
+ {
+ return mountSegments.length + mapper.getCompatibilityScore(dismountRequest(request));
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ /**
+ *
+ * @param request
+ * a {@link org.apache.wicket.request.Request} with the all mount segments - mount ones and the ones for the
+ * delegated mapper
+ * @return a {@link org.apache.wicket.request.Request} with {@link org.apache.wicket.request.Url} without the mount segments
+ */
+ private Request dismountRequest(final Request request)
+ {
+ Url dismountedUrl = new Url(request.getUrl());
+ dismountedUrl.removeLeadingSegments(mountSegments.length);
+ return request.cloneWithUrl(dismountedUrl);
+ }
+
+ /**
+ * @see org.apache.wicket.request.IRequestMapper#mapRequest(org.apache.wicket.request.Request)
+ */
+ @Override
+ public final IRequestHandler mapRequest(final Request request)
+ {
+ final Url url = request.getUrl();
+
+ if ((url.getSegments().size() >= mountSegments.length) && urlStartsWith(url, mountSegments))
+ {
+ MountParameters params = new MountParameters();
+ for (int i = 0; i < mountSegments.length; i++)
+ {
+ String placeholder = getPlaceholder(mountSegments[i]);
+ if (placeholder != null)
+ {
+ params.setValue(placeholder, StringValue.valueOf(url.getSegments().get(i)));
+ }
+ }
+
+ return mapper.mapRequest(dismountRequest(request), params);
+ }
+
+ return null;
+ }
+
+ /**
+ * @see org.apache.wicket.request.IRequestMapper#mapHandler(org.apache.wicket.request.IRequestHandler)
+ */
+ @Override
+ public Url mapHandler(final IRequestHandler handler)
+ {
+ Mount mount = mapper.mapHandler(handler);
+ if (mount == null)
+ {
+ return null;
+ }
+
+ Checks.notNull(mount.getUrl(), "Mount's Url should not be null");
+ Checks.notNull(mount.getMountParameters(), "Mount's parameters should not be null");
+
+ for (int i = mountSegments.length; i > 0; i--)
+ {
+ String segment = mountSegments[i - 1];
+ String placeholder = getPlaceholder(segment);
+ String replacement = segment;
+
+ if (placeholder != null)
+ {
+ replacement = mount.getMountParameters().getValue(placeholder).toString();
+ Checks.notNull(replacement, "Cannot find a value for placeholder '%s'.",
+ placeholder);
+ }
+
+ mount.getUrl().getSegments().add(0, replacement);
+ }
+
+ return mount.getUrl();
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/972c7152/wicket-request/src/main/java/org/apache/wicket/request/mapper/mount/MountParameters.java
----------------------------------------------------------------------
diff --git a/wicket-request/src/main/java/org/apache/wicket/request/mapper/mount/MountParameters.java b/wicket-request/src/main/java/org/apache/wicket/request/mapper/mount/MountParameters.java
new file mode 100644
index 0000000..f5340fb
--- /dev/null
+++ b/wicket-request/src/main/java/org/apache/wicket/request/mapper/mount/MountParameters.java
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.request.mapper.mount;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.wicket.util.string.StringValue;
+
+/**
+ * A container for the placeholders (e.g. ${placeholder}) found in the mount segments
+ *
+ * @author igor.vaynberg
+ * @deprecated Will be removed in Wicket 8.0
+ */
+@Deprecated
+public class MountParameters
+{
+ private final Map<String, String> map = new HashMap<>();
+
+ /**
+ *
+ * @param parameterName
+ * the name of the placeholder
+ * @return a StringValue which contains either the actual value if there is a placeholder with
+ * name <code>parameterName</code> or <code>null</code> otherwise
+ */
+ public final StringValue getValue(final String parameterName)
+ {
+ return StringValue.valueOf(map.get(parameterName));
+ }
+
+ /**
+ * Sets new placeholder name/pair
+ *
+ * @param parameterName
+ * @param value
+ */
+ public final void setValue(final String parameterName, final StringValue value)
+ {
+ map.put(parameterName, value.toString());
+ }
+
+ /**
+ * @return an unmodifiable view of the parameters names
+ */
+ public final Collection<String> getParameterNames()
+ {
+ return Collections.unmodifiableCollection(map.keySet());
+ }
+
+ /**
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((map == null) ? 0 : map.hashCode());
+ return result;
+ }
+
+ /**
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(final Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+ if (obj == null)
+ {
+ return false;
+ }
+ if (getClass() != obj.getClass())
+ {
+ return false;
+ }
+ MountParameters other = (MountParameters)obj;
+ if (map == null)
+ {
+ if (other.map != null)
+ {
+ return false;
+ }
+ }
+ else if (!map.equals(other.map))
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString()
+ {
+ return "MountParameters [" + map + "]";
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/972c7152/wicket-request/src/main/java/org/apache/wicket/request/mapper/mount/UnmountedMapperAdapter.java
----------------------------------------------------------------------
diff --git a/wicket-request/src/main/java/org/apache/wicket/request/mapper/mount/UnmountedMapperAdapter.java b/wicket-request/src/main/java/org/apache/wicket/request/mapper/mount/UnmountedMapperAdapter.java
new file mode 100644
index 0000000..a969b44
--- /dev/null
+++ b/wicket-request/src/main/java/org/apache/wicket/request/mapper/mount/UnmountedMapperAdapter.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.request.mapper.mount;
+
+import org.apache.wicket.request.IRequestHandler;
+import org.apache.wicket.request.IRequestMapper;
+import org.apache.wicket.request.Request;
+import org.apache.wicket.request.Url;
+
+/**
+ * Adapts a {@link org.apache.wicket.request.IRequestMapper} to be used as a {@link IMountedRequestMapper}
+ *
+ * TODO javadoc
+ *
+ * @author igor.vaynberg
+ * @deprecated Will be removed in Wicket 8.0
+ */
+@Deprecated
+class UnmountedMapperAdapter implements IMountedRequestMapper
+{
+ private final IRequestMapper mapper;
+
+ /**
+ * Construct.
+ *
+ * @param mapper
+ */
+ public UnmountedMapperAdapter(final IRequestMapper mapper)
+ {
+ super();
+ this.mapper = mapper;
+ }
+
+ /**
+ * @see org.apache.wicket.request.mapper.mount.IMountedRequestMapper#getCompatibilityScore(org.apache.wicket.request.Request)
+ */
+ @Override
+ public int getCompatibilityScore(final Request request)
+ {
+ return mapper.getCompatibilityScore(request);
+ }
+
+ /**
+ * @see org.apache.wicket.request.mapper.mount.IMountedRequestMapper#mapHandler(org.apache.wicket.request.IRequestHandler)
+ */
+ @Override
+ public Mount mapHandler(final IRequestHandler requestHandler)
+ {
+ Url url = mapper.mapHandler(requestHandler);
+ if (url != null)
+ {
+ return new Mount(url);
+ }
+ return null;
+ }
+
+ /**
+ * @see org.apache.wicket.request.mapper.mount.IMountedRequestMapper#mapRequest(org.apache.wicket.request.Request,
+ * org.apache.wicket.request.mapper.mount.MountParameters)
+ */
+ @Override
+ public IRequestHandler mapRequest(final Request request, final MountParameters mountParams)
+ {
+ return mapper.mapRequest(request);
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/972c7152/wicket-request/src/main/java/org/apache/wicket/request/mapper/mount/UnmountedRequestHandlerAdapter.java
----------------------------------------------------------------------
diff --git a/wicket-request/src/main/java/org/apache/wicket/request/mapper/mount/UnmountedRequestHandlerAdapter.java b/wicket-request/src/main/java/org/apache/wicket/request/mapper/mount/UnmountedRequestHandlerAdapter.java
new file mode 100644
index 0000000..7c345d5
--- /dev/null
+++ b/wicket-request/src/main/java/org/apache/wicket/request/mapper/mount/UnmountedRequestHandlerAdapter.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.request.mapper.mount;
+
+import org.apache.wicket.request.IRequestHandler;
+import org.apache.wicket.request.Request;
+import org.apache.wicket.request.Url;
+
+/**
+ * Adapts a singleton {@link org.apache.wicket.request.IRequestHandler} instance to {@link IMountedRequestMapper}
+ *
+ * TODO javadoc
+ *
+ * @author igor.vaynberg
+ * @deprecated Will be removed in Wicket 8.0
+ */
+@Deprecated
+class UnmountedRequestHandlerAdapter implements IMountedRequestMapper
+{
+ private final IRequestHandler handler;
+
+ /**
+ * Construct.
+ *
+ * @param handler
+ */
+ public UnmountedRequestHandlerAdapter(final IRequestHandler handler)
+ {
+ this.handler = handler;
+ }
+
+ /**
+ * @see org.apache.wicket.request.mapper.mount.IMountedRequestMapper#getCompatibilityScore(org.apache.wicket.request.Request)
+ */
+ @Override
+ public int getCompatibilityScore(final Request request)
+ {
+ return 0;
+ }
+
+ /**
+ * @see org.apache.wicket.request.mapper.mount.IMountedRequestMapper#mapHandler(org.apache.wicket.request.IRequestHandler)
+ */
+ @Override
+ public Mount mapHandler(final IRequestHandler requestHandler)
+ {
+ if (requestHandler.equals(handler))
+ {
+ return new Mount(new Url());
+ }
+ return null;
+ }
+
+ /**
+ * @see org.apache.wicket.request.mapper.mount.IMountedRequestMapper#mapRequest(org.apache.wicket.request.Request,
+ * org.apache.wicket.request.mapper.mount.MountParameters)
+ */
+ @Override
+ public IRequestHandler mapRequest(final Request request, final MountParameters mountParams)
+ {
+ return handler;
+ }
+}