sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r588568 - /incubator/sling/trunk/maven-jspc-plugin/src/main/java/org/apache/sling/maven/jspc/JspcMojo.java
Date Fri, 26 Oct 2007 08:54:51 GMT
Author: fmeschbe
Date: Fri Oct 26 01:54:51 2007
New Revision: 588568

URL: http://svn.apache.org/viewvc?rev=588568&view=rev
Log:
SLING-85 Use the JSP script path as the name of the compiled JSP servlet/component

Modified:
    incubator/sling/trunk/maven-jspc-plugin/src/main/java/org/apache/sling/maven/jspc/JspcMojo.java

Modified: incubator/sling/trunk/maven-jspc-plugin/src/main/java/org/apache/sling/maven/jspc/JspcMojo.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/maven-jspc-plugin/src/main/java/org/apache/sling/maven/jspc/JspcMojo.java?rev=588568&r1=588567&r2=588568&view=diff
==============================================================================
--- incubator/sling/trunk/maven-jspc-plugin/src/main/java/org/apache/sling/maven/jspc/JspcMojo.java
(original)
+++ incubator/sling/trunk/maven-jspc-plugin/src/main/java/org/apache/sling/maven/jspc/JspcMojo.java
Fri Oct 26 01:54:51 2007
@@ -371,14 +371,14 @@
             }
 
             // write the OSGi component descriptor
-            writeJspServiceComponent(serviceComponentWriter,
+            writeJspServiceComponent(serviceComponentWriter, jspUri,
                 clctxt.getServletPackageName() + "."
                     + clctxt.getServletClassName());
 
             // remove the java source and smap file
-            new File(clctxt.getClassFileName()+".smap").delete();
+            new File(clctxt.getClassFileName() + ".smap").delete();
             new File(clctxt.getServletJavaFileName()).delete();
-            
+
         } catch (JasperException je) {
             Throwable rootCause = je;
             while (rootCause instanceof JasperException
@@ -475,32 +475,27 @@
         loader = new URLClassLoader(urlsA, getClass().getClassLoader());
     }
 
-    private void writeJspServiceComponent(Writer out, String className) {
-
-        String id = className;
-        if (id.startsWith(servletPackage)) {
-            // account for trailing dot of the package
-            id = id.substring(servletPackage.length() + 1);
-        }
+    private void writeJspServiceComponent(Writer out, String componentName,
+            String className) {
 
         try {
             out.write("<scr:component enabled=\"true\" immediate=\"true\" name=\"");
-            out.write(id);
+            out.write(componentName);
             out.write("\">\r\n");
-            
+
             // the implementation is of course the compiled JSP
             out.write("<scr:implementation class=\"");
             out.write(className);
             out.write("\"/>\r\n");
-            
+
             // the JSP registers as a Servlet
             out.write("<scr:service>\r\n");
             out.write("<scr:provide interface=\"javax.servlet.Servlet\"/>\r\n");
             out.write("</scr:service>\r\n");
-            
+
             // use the JSP's id as the service.pid
             out.write("<scr:property name=\"service.pid\" value=\"");
-            out.write(id);
+            out.write(componentName);
             out.write("\"/>\r\n");
 
             // if the project defines an organization name, add it
@@ -510,7 +505,7 @@
                 out.write(project.getOrganization().getName());
                 out.write("\"/>\r\n");
             }
-            
+
             out.write("</scr:component>\r\n");
 
             out.flush();
@@ -557,8 +552,9 @@
             }
 
             // and set include accordingly
-            String svcComp = project.getProperties().getProperty("Service-Component");
-            svcComp= (svcComp == null) ? target : svcComp + ", " + target;
+            String svcComp = project.getProperties().getProperty(
+                "Service-Component");
+            svcComp = (svcComp == null) ? target : svcComp + ", " + target;
             project.getProperties().setProperty("Service-Component", svcComp);
 
         } finally {



Mime
View raw message