Author: fmeschbe
Date: Sun Dec 20 19:12:18 2009
New Revision: 892640
URL: http://svn.apache.org/viewvc?rev=892640&view=rev
Log:
SLING-1218 Copy URI class source from HttpClient 3.1 and modify such as neither
Http Client nor Commons Codec are required any more.
Added:
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/URI.java
(with props)
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/URIException.java
(with props)
Modified:
sling/trunk/bundles/jcr/resource/pom.xml
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverWebConsolePlugin.java
Modified: sling/trunk/bundles/jcr/resource/pom.xml
URL:
http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/pom.xml?rev=892640&r1=892639&r2=892640&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/resource/pom.xml (original)
+++ sling/trunk/bundles/jcr/resource/pom.xml Sun Dec 20 19:12:18 2009
@@ -69,9 +69,7 @@
<!-- Include URL support from Jackrabbit -->
<Embed-Dependency>
jackrabbit-classloader;inline="org/apache/jackrabbit/net/**|org/apache/jackrabbit/classloader/Util.*",
-
jackrabbit-jcr-commons;inline="org/apache/jackrabbit/util/ISO9075.*|org/apache/jackrabbit/name/QName.*|org/apache/jackrabbit/util/XMLChar.*|org/apache/jackrabbit/util/Text.*",
- <!--
commons-httpclient;inline="org/apache/commons/httpclient/HttpClientError.*|org/apache/commons/httpclient/HttpException.*|org/apache/commons/httpclient/URI*|org/apache/commons/httpclient/util/EncodingUtil.*"
-->
- commons-httpclient,commons-codec
+
jackrabbit-jcr-commons;inline="org/apache/jackrabbit/util/ISO9075.*|org/apache/jackrabbit/name/QName.*|org/apache/jackrabbit/util/XMLChar.*|org/apache/jackrabbit/util/Text.*"
</Embed-Dependency>
<Sling-Namespaces>
@@ -149,18 +147,6 @@
<version>3.2.1</version>
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- <version>3.1</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>1.2</version>
- <scope>provided</scope>
- </dependency>
<!-- For the Console Plugin of the JcrResourceResolverFactoryImpl -->
<dependency>
Modified:
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
URL:
http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java?rev=892640&r1=892639&r2=892640&view=diff
==============================================================================
---
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
(original)
+++
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
Sun Dec 20 19:12:18 2009
@@ -18,8 +18,6 @@
*/
package org.apache.sling.jcr.resource.internal;
-import java.net.URI;
-import java.net.URISyntaxException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
@@ -36,7 +34,6 @@
import javax.jcr.query.RowIterator;
import javax.servlet.http.HttpServletRequest;
-import org.apache.commons.httpclient.URIException;
import org.apache.sling.adapter.SlingAdaptable;
import org.apache.sling.api.SlingException;
import org.apache.sling.api.resource.NonExistingResource;
@@ -51,6 +48,8 @@
import org.apache.sling.jcr.resource.internal.helper.MapEntry;
import org.apache.sling.jcr.resource.internal.helper.RedirectResource;
import org.apache.sling.jcr.resource.internal.helper.ResourcePathIterator;
+import org.apache.sling.jcr.resource.internal.helper.URI;
+import org.apache.sling.jcr.resource.internal.helper.URIException;
import
org.apache.sling.jcr.resource.internal.helper.jcr.JcrNodeResourceIterator;
import
org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProviderEntry;
import org.apache.sling.jcr.resource.internal.helper.starresource.StarResource;
@@ -178,7 +177,7 @@
// otherwise the mapped path is an URI and we have to try to
// resolve that URI now, using the URI's path as the real path
try {
- URI uri = new URI(mappedPath[0]);
+ URI uri = new URI(mappedPath[0], false);
requestPath = getMapPath(uri.getScheme(), uri.getHost(),
uri.getPort(), uri.getPath());
realPathList = new String[] { uri.getPath() };
@@ -186,7 +185,7 @@
log.debug(
"resolve: Mapped path is an URL, using new request path
{}",
requestPath);
- } catch (URISyntaxException use) {
+ } catch (URIException use) {
// TODO: log and fail
throw new ResourceNotFoundException(absPath);
}
@@ -381,7 +380,7 @@
// use commons-httpclient's URI instead of java.net.URI, as it can
// actually accept *unescaped* URIs, such as the "mappedPath" and
// return them in proper escaped form, including the path, via
toString()
- org.apache.commons.httpclient.URI uri = new
org.apache.commons.httpclient.URI(mappedPath, false);
+ URI uri = new URI(mappedPath, false);
// 1. mangle the namespaces in the path
String path = mangleNamespaces(uri.getPath());
@@ -402,7 +401,7 @@
log.debug("map: Returning URL {} as mapping for path {}",
mappedPath, resourcePath);
-
+
// reappend fragment and/or query
if (fragmentQuery != null) {
mappedPath = mappedPath.concat(fragmentQuery);
Modified:
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverWebConsolePlugin.java
URL:
http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverWebConsolePlugin.java?rev=892640&r1=892639&r2=892640&view=diff
==============================================================================
---
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverWebConsolePlugin.java
(original)
+++
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverWebConsolePlugin.java
Sun Dec 20 19:12:18 2009
@@ -32,14 +32,14 @@
import javax.servlet.http.HttpServletRequestWrapper;
import javax.servlet.http.HttpServletResponse;
-import org.apache.commons.httpclient.URI;
-import org.apache.commons.httpclient.URIException;
import org.apache.felix.webconsole.AbstractWebConsolePlugin;
import org.apache.felix.webconsole.ConfigurationPrinter;
import org.apache.felix.webconsole.WebConsoleConstants;
import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.jcr.resource.internal.helper.MapEntries;
import org.apache.sling.jcr.resource.internal.helper.MapEntry;
+import org.apache.sling.jcr.resource.internal.helper.URI;
+import org.apache.sling.jcr.resource.internal.helper.URIException;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceRegistration;