Author: cziegeler
Date: Thu Jan 12 08:21:08 2012
New Revision: 1230439
URL: http://svn.apache.org/viewvc?rev=1230439&view=rev
Log:
SLING-2350 : Sling Maven JSPC Plugin depends on legacy Sling API lib which does
not support adaptable SlingHttpServletRequest objects
Added:
sling/trunk/maven/maven-jspc-plugin/src/main/java/org/apache/sling/maven/jspc/JspCServletConfig.java
(with props)
Modified:
sling/trunk/maven/maven-jspc-plugin/pom.xml
sling/trunk/maven/maven-jspc-plugin/src/main/java/org/apache/sling/maven/jspc/JspcMojo.java
Modified: sling/trunk/maven/maven-jspc-plugin/pom.xml
URL:
http://svn.apache.org/viewvc/sling/trunk/maven/maven-jspc-plugin/pom.xml?rev=1230439&r1=1230438&r2=1230439&view=diff
==============================================================================
--- sling/trunk/maven/maven-jspc-plugin/pom.xml (original)
+++ sling/trunk/maven/maven-jspc-plugin/pom.xml Thu Jan 12 08:21:08 2012
@@ -69,7 +69,6 @@
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.api</artifactId>
<version>2.2.2</version>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
Added:
sling/trunk/maven/maven-jspc-plugin/src/main/java/org/apache/sling/maven/jspc/JspCServletConfig.java
URL:
http://svn.apache.org/viewvc/sling/trunk/maven/maven-jspc-plugin/src/main/java/org/apache/sling/maven/jspc/JspCServletConfig.java?rev=1230439&view=auto
==============================================================================
---
sling/trunk/maven/maven-jspc-plugin/src/main/java/org/apache/sling/maven/jspc/JspCServletConfig.java
(added)
+++
sling/trunk/maven/maven-jspc-plugin/src/main/java/org/apache/sling/maven/jspc/JspCServletConfig.java
Thu Jan 12 08:21:08 2012
@@ -0,0 +1,57 @@
+/*
+ * 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.sling.maven.jspc;
+
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+
+public class JspCServletConfig implements ServletConfig {
+
+ private final ServletContext servletContext;
+
+ private String servletName;
+
+ private final Map<String, String> properties;
+
+ public JspCServletConfig(final ServletContext servletContext) {
+ this.servletContext = servletContext;
+
+ this.servletName = "JSPC Script Handler";
+ this.properties = new HashMap<String, String>();
+ }
+
+ public String getInitParameter(String name) {
+ return properties.get(name);
+ }
+
+ public Enumeration<String> getInitParameterNames() {
+ return Collections.enumeration(properties.keySet());
+ }
+
+ public ServletContext getServletContext() {
+ return servletContext;
+ }
+
+ public String getServletName() {
+ return servletName;
+ }
+}
\ No newline at end of file
Propchange:
sling/trunk/maven/maven-jspc-plugin/src/main/java/org/apache/sling/maven/jspc/JspCServletConfig.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
sling/trunk/maven/maven-jspc-plugin/src/main/java/org/apache/sling/maven/jspc/JspCServletConfig.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Propchange:
sling/trunk/maven/maven-jspc-plugin/src/main/java/org/apache/sling/maven/jspc/JspCServletConfig.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified:
sling/trunk/maven/maven-jspc-plugin/src/main/java/org/apache/sling/maven/jspc/JspcMojo.java
URL:
http://svn.apache.org/viewvc/sling/trunk/maven/maven-jspc-plugin/src/main/java/org/apache/sling/maven/jspc/JspcMojo.java?rev=1230439&r1=1230438&r2=1230439&view=diff
==============================================================================
---
sling/trunk/maven/maven-jspc-plugin/src/main/java/org/apache/sling/maven/jspc/JspcMojo.java
(original)
+++
sling/trunk/maven/maven-jspc-plugin/src/main/java/org/apache/sling/maven/jspc/JspcMojo.java
Thu Jan 12 08:21:08 2012
@@ -50,6 +50,7 @@ import org.apache.sling.scripting.jsp.ja
import
org.apache.sling.scripting.jsp.jasper.compiler.OriginalTldLocationsCache;
import org.apache.sling.scripting.jsp.jasper.compiler.TagPluginManager;
import org.apache.sling.scripting.jsp.jasper.compiler.TldLocationsCache;
+import org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper;
import org.apache.sling.scripting.jsp.jasper.xmlparser.TreeNode;
/**
@@ -331,13 +332,16 @@ public class JspcMojo extends AbstractMo
}
}
- private void processFile(String file) throws JasperException {
+ private void processFile(final String file) throws JasperException {
ClassLoader originalClassLoader = null;
try {
- String jspUri = file.replace('\\', '/');
- JspCompilationContext clctxt = new JspCompilationContext(jspUri,
- false, this, context, null, rctxt);
+ final String jspUri = file.replace('\\', '/');
+ final JspServletWrapper wrapper = new JspServletWrapper(new
JspCServletConfig(context), this, jspUri,
+ false, rctxt);
+
+ final JspCompilationContext clctxt = new
JspCompilationContext(jspUri,
+ false, this, context, wrapper, rctxt);
// write to a specific servlet package
clctxt.setServletPackageName(servletPackage);
@@ -364,7 +368,7 @@ public class JspcMojo extends AbstractMo
getLog().info("File up to date: " + file);
}
- } catch (JasperException je) {
+ } catch (final JasperException je) {
Throwable rootCause = je;
while (rootCause instanceof JasperException
&& ((JasperException) rootCause).getRootCause() != null) {