Author: fmeschbe
Date: Thu Nov 29 06:31:08 2007
New Revision: 599455
URL: http://svn.apache.org/viewvc?rev=599455&view=rev
Log:
SLING-109 Adapt to new Resource and provider interfaces
+ export org.apache and org.apache.jasper.runtime, which are used
by JSP located in bundles
Modified:
incubator/sling/trunk/scripting/jsp/pom.xml
incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspServletContext.java
Modified: incubator/sling/trunk/scripting/jsp/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/jsp/pom.xml?rev=599455&r1=599454&r2=599455&view=diff
==============================================================================
--- incubator/sling/trunk/scripting/jsp/pom.xml (original)
+++ incubator/sling/trunk/scripting/jsp/pom.xml Thu Nov 29 06:31:08 2007
@@ -67,7 +67,9 @@
org.apache.sling.scripting.jsp.util,
javax.el; javax.servlet.jsp;
javax.servlet.jsp.el;
- javax.servlet.jsp.tagext;version=2.1
+ javax.servlet.jsp.tagext;version=2.1,
+ org.apache;
+ org.apache.jasper.runtime
</Export-Package>
<Private-Package>
org.apache.sling.scripting.jsp.*
@@ -93,11 +95,6 @@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.api</artifactId>
- <version>2.0.0-incubator-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.sling</groupId>
- <artifactId>org.apache.sling.jcr.resource</artifactId>
<version>2.0.0-incubator-SNAPSHOT</version>
</dependency>
<dependency>
Modified:
incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspServletContext.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspServletContext.java?rev=599455&r1=599454&r2=599455&view=diff
==============================================================================
---
incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspServletContext.java
(original)
+++
incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspServletContext.java
Thu Nov 29 06:31:08 2007
@@ -22,16 +22,16 @@
import java.util.Enumeration;
import java.util.Set;
-import javax.jcr.Node;
import javax.servlet.RequestDispatcher;
import javax.servlet.Servlet;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
-import org.apache.jackrabbit.net.URLFactory;
import org.apache.sling.api.SlingException;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.api.resource.StreamProvider;
+import org.apache.sling.api.resource.URLProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -72,14 +72,15 @@
if (path.startsWith("/")) {
try {
Resource res = getResourceInternal(path);
- if (res != null && res.getRawData() instanceof Node) {
- // TODO: if we would have the URLAdapter ....
- Node node = (Node) res.getRawData();
- return URLFactory.createURL(node.getSession(),
node.getPath());
+ if (res instanceof URLProvider) {
+ return ((URLProvider) res).getURL();
}
// TODO: is this correct or should we try another one ??
return null;
+ } catch (MalformedURLException mue) {
+ // rethrow this
+ throw mue;
} catch (Exception ex) {
// SlingException or RepositoryException
log.error("getResource: Problem getting resource " + path, ex);
@@ -97,8 +98,8 @@
if (path.startsWith("/")) {
try {
Resource res = getResourceInternal(path);
- if (res != null) {
- return res.getInputStream();
+ if (res instanceof StreamProvider) {
+ return ((StreamProvider) res).getInputStream();
}
// TODO: is this correct or should we try another one ??