Author: cziegeler
Date: Wed Dec 12 07:31:45 2007
New Revision: 603643
URL: http://svn.apache.org/viewvc?rev=603643&view=rev
Log:
Change signature of resolve() method from ServletRequest to HttpServletRequest.
Modified:
incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceManager.java
incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/resource/MicroslingResourceResolver.java
incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/services/MicroslingServiceLocatorTest.java
Modified:
incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java?rev=603643&r1=603642&r2=603643&view=diff
==============================================================================
---
incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java
(original)
+++
incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java
Wed Dec 12 07:31:45 2007
@@ -21,7 +21,7 @@
import java.util.Iterator;
import java.util.Map;
-import javax.servlet.ServletRequest;
+import javax.servlet.http.HttpServletRequest;
import org.apache.sling.api.SlingException;
@@ -35,7 +35,7 @@
public interface ResourceResolver {
/**
- * Resolves the resource from the given <code>ServletRequest</code>.
+ * Resolves the resource from the given <code>HttpServletRequest</code>.
* <p>
* If the request cannot be resolved to an existing resource, a
* [EMAIL PROTECTED] Resource} object is returned whose
@@ -45,12 +45,12 @@
* [EMAIL PROTECTED] Resource#adaptTo(Class) object} returns
<code>null</code>
* for all classes.
*
- * @param request The servlet request object used to resolve the resource
+ * @param request The http servlet request object used to resolve the
resource
* for.
* @return The [EMAIL PROTECTED] Resource} for the request.
* @throws SlingException May be thrown if another error occurrs.
*/
- Resource resolve(ServletRequest request) throws SlingException;
+ Resource resolve(HttpServletRequest request) throws SlingException;
/**
* Returns a [EMAIL PROTECTED] Resource} object for data located at the
given path.
Modified:
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceManager.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceManager.java?rev=603643&r1=603642&r2=603643&view=diff
==============================================================================
---
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceManager.java
(original)
+++
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceManager.java
Wed Dec 12 07:31:45 2007
@@ -33,7 +33,6 @@
import javax.jcr.Value;
import javax.jcr.query.QueryResult;
import javax.jcr.query.RowIterator;
-import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
import org.apache.jackrabbit.ocm.exception.JcrMappingException;
@@ -99,8 +98,8 @@
// ---------- ResourceResolver interface ----------------------------------
- public Resource resolve(ServletRequest request) throws SlingException {
- String pathInfo = ((HttpServletRequest) request).getPathInfo();
+ public Resource resolve(HttpServletRequest request) throws SlingException {
+ String pathInfo = request.getPathInfo();
Resource result = resolve(pathInfo);
if (result == null) {
Modified:
incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/resource/MicroslingResourceResolver.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/resource/MicroslingResourceResolver.java?rev=603643&r1=603642&r2=603643&view=diff
==============================================================================
---
incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/resource/MicroslingResourceResolver.java
(original)
+++
incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/resource/MicroslingResourceResolver.java
Wed Dec 12 07:31:45 2007
@@ -36,7 +36,6 @@
import javax.jcr.query.Query;
import javax.jcr.query.QueryResult;
import javax.jcr.query.RowIterator;
-import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
import org.apache.sling.api.SlingConstants;
@@ -104,12 +103,11 @@
/**
* Resolves the Resource from the request
*/
- public Resource resolve(ServletRequest servletRequest) throws
SlingException {
+ public Resource resolve(HttpServletRequest request) throws SlingException {
Resource result = null;
String path = null;
-
+
// look for a real JCR Resource
- final HttpServletRequest request = (HttpServletRequest)servletRequest;
String pathInfo = SlingRequestPaths.getPathInfo(request);
try {
Session session = getSession();
@@ -119,16 +117,16 @@
resolutionPath = it.next();
result = getResource(session, resolutionPath);
}
-
+
} catch (RepositoryException re) {
throw new SlingException("RepositoryException for path=" + path,
re);
}
-
+
// not found -> try synthetic resource
if (result == null) {
result = syntheticResourceProvider.getSyntheticResource(pathInfo);
}
-
+
// not found -> NonExistingResource
if (result == null) {
result = new NonExistingResource(pathInfo);
@@ -341,7 +339,7 @@
} else {
result = new JcrPropertyResource((Property)i);
}
-
+
result.getResourceMetadata().put(ResourceMetadata.RESOLUTION_PATH,
path);
log.info("Found Resource " + result);
Modified:
incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/services/MicroslingServiceLocatorTest.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/services/MicroslingServiceLocatorTest.java?rev=603643&r1=603642&r2=603643&view=diff
==============================================================================
---
incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/services/MicroslingServiceLocatorTest.java
(original)
+++
incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/services/MicroslingServiceLocatorTest.java
Wed Dec 12 07:31:45 2007
@@ -19,7 +19,7 @@
import java.util.Iterator;
import java.util.Map;
-import javax.servlet.ServletRequest;
+import javax.servlet.http.HttpServletRequest;
import junit.framework.TestCase;
@@ -61,7 +61,7 @@
return null;
}
- public Resource resolve(ServletRequest request) {
+ public Resource resolve(HttpServletRequest request) {
return null;
}