Author: cziegeler
Date: Fri Dec 14 07:11:03 2007
New Revision: 604210
URL: http://svn.apache.org/viewvc?rev=604210&view=rev
Log:
Make sling core runnable and compilable with servlet 2.4 api.
Modified:
incubator/sling/trunk/sling/core/pom.xml
incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/helper/SlingServletContext.java
Modified: incubator/sling/trunk/sling/core/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/sling/core/pom.xml?rev=604210&r1=604209&r2=604210&view=diff
==============================================================================
--- incubator/sling/trunk/sling/core/pom.xml (original)
+++ incubator/sling/trunk/sling/core/pom.xml Fri Dec 14 07:11:03 2007
@@ -113,16 +113,9 @@
<artifactId>org.apache.sling.jcr.resource</artifactId>
<version>2.0.0-incubator-SNAPSHOT</version>
</dependency>
- <!-- We explicitly use version 2.5 of the servlet spec here as we have
- an own implementation of the ServletContext which should be usable
- in 2.5 environments.
- However, Sling is fully runnable with servlet api 2.4.
- -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
- <version>2.5</version>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
Modified:
incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/helper/SlingServletContext.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/helper/SlingServletContext.java?rev=604210&r1=604209&r2=604210&view=diff
==============================================================================
---
incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/helper/SlingServletContext.java
(original)
+++
incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/helper/SlingServletContext.java
Fri Dec 14 07:11:03 2007
@@ -326,7 +326,11 @@
/** Returns the context path of the web application. (Servlet API 2.5) */
public String getContextPath() {
- return getServletContext().getContextPath();
+ try {
+ return (String)
getServletContext().getClass().getMethod("getContextPath",
null).invoke(getServletContext(), null);
+ } catch (Exception ignore) {
+ return null;
+ }
}
// ---------- internal
-----------------------------------------------------