You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ry...@apache.org on 2012/03/06 18:04:20 UTC

svn commit: r1297578 - in /lucene/dev/trunk: dev-tools/eclipse/ dev-tools/maven/ dev-tools/maven/solr/core/ solr/ solr/core/src/java/org/apache/solr/servlet/ solr/example/lib/jsp-2.1/ solr/solrj/src/test/org/apache/solr/client/solrj/embedded/ solr/weba...

Author: ryan
Date: Tue Mar  6 17:04:19 2012
New Revision: 1297578

URL: http://svn.apache.org/viewvc?rev=1297578&view=rev
Log:
SOLR-3202: remove JSP support and the old admin UI

Added:
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/servlet/LoadAdminUiServlet.java
    lucene/dev/trunk/solr/webapp/web/admin.html
      - copied, changed from r1297307, lucene/dev/trunk/solr/webapp/web/index.jsp
Removed:
    lucene/dev/trunk/solr/example/lib/jsp-2.1/
    lucene/dev/trunk/solr/webapp/web/admin/
    lucene/dev/trunk/solr/webapp/web/index.jsp
Modified:
    lucene/dev/trunk/dev-tools/eclipse/dot.classpath
    lucene/dev/trunk/dev-tools/maven/pom.xml.template
    lucene/dev/trunk/dev-tools/maven/solr/core/pom.xml.template
    lucene/dev/trunk/solr/CHANGES.txt
    lucene/dev/trunk/solr/build.xml
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/servlet/LogLevelSelection.java
    lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java
    lucene/dev/trunk/solr/webapp/build.xml
    lucene/dev/trunk/solr/webapp/web/WEB-INF/web.xml

Modified: lucene/dev/trunk/dev-tools/eclipse/dot.classpath
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/dev-tools/eclipse/dot.classpath?rev=1297578&r1=1297577&r2=1297578&view=diff
==============================================================================
--- lucene/dev/trunk/dev-tools/eclipse/dot.classpath (original)
+++ lucene/dev/trunk/dev-tools/eclipse/dot.classpath Tue Mar  6 17:04:19 2012
@@ -118,10 +118,6 @@
 	<classpathentry kind="lib" path="solr/example/lib/jetty-6.1.26-patched-JETTY-1340.jar"/>
 	<classpathentry kind="lib" path="solr/example/lib/jetty-util-6.1.26-patched-JETTY-1340.jar"/>
 	<classpathentry kind="lib" path="solr/example/lib/servlet-api-2.5-20081211.jar"/>
-	<classpathentry kind="lib" path="solr/example/lib/jsp-2.1/core-3.1.1.jar"/>
-	<classpathentry kind="lib" path="solr/example/lib/jsp-2.1/jsp-2.1-glassfish-2.1.v20091210.jar"/>
-	<classpathentry kind="lib" path="solr/example/lib/jsp-2.1/jsp-2.1-jetty-6.1.26.jar"/>
-	<classpathentry kind="lib" path="solr/example/lib/jsp-2.1/jsp-api-2.1-glassfish-2.1.v20091210.jar"/>
 	<classpathentry kind="lib" path="solr/contrib/clustering/lib/carrot2-core-3.5.0.jar"/>
 	<classpathentry kind="lib" path="solr/contrib/clustering/lib/hppc-0.3.3.jar"/>
 	<classpathentry kind="lib" path="solr/contrib/clustering/lib/jackson-core-asl-1.5.2.jar"/>

Modified: lucene/dev/trunk/dev-tools/maven/pom.xml.template
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/dev-tools/maven/pom.xml.template?rev=1297578&r1=1297577&r2=1297578&view=diff
==============================================================================
--- lucene/dev/trunk/dev-tools/maven/pom.xml.template (original)
+++ lucene/dev/trunk/dev-tools/maven/pom.xml.template Tue Mar  6 17:04:19 2012
@@ -306,21 +306,6 @@
         <version>${patched.jetty.version}</version>
       </dependency>
       <dependency>
-        <groupId>org.mortbay.jetty</groupId>
-        <artifactId>jsp-2.1-glassfish</artifactId>
-        <version>2.1.v20091210</version>
-      </dependency>
-      <dependency>
-        <groupId>org.mortbay.jetty</groupId>
-        <artifactId>jsp-2.1-jetty</artifactId>
-        <version>${jetty.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.mortbay.jetty</groupId>
-        <artifactId>jsp-api-2.1-glassfish</artifactId>
-        <version>2.1.v20091210</version>
-      </dependency>
-      <dependency>
         <groupId>org.slf4j</groupId>
         <artifactId>jcl-over-slf4j</artifactId>
         <version>${slf4j.version}</version>

Modified: lucene/dev/trunk/dev-tools/maven/solr/core/pom.xml.template
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/dev-tools/maven/solr/core/pom.xml.template?rev=1297578&r1=1297577&r2=1297578&view=diff
==============================================================================
--- lucene/dev/trunk/dev-tools/maven/solr/core/pom.xml.template (original)
+++ lucene/dev/trunk/dev-tools/maven/solr/core/pom.xml.template Tue Mar  6 17:04:19 2012
@@ -182,11 +182,6 @@
       <optional>true</optional> <!-- Only used for tests and one command-line utility: JettySolrRunner -->
     </dependency>
     <dependency>
-      <groupId>org.mortbay.jetty</groupId>
-      <artifactId>jsp-2.1-jetty</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
       <groupId>org.codehaus.woodstox</groupId>
       <artifactId>wstx-asl</artifactId>
       <scope>runtime</scope>

Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1297578&r1=1297577&r2=1297578&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Tue Mar  6 17:04:19 2012
@@ -438,6 +438,9 @@ Other Changes
 
 * SOLR-2607: Removed obsolete client/ folder (ehatcher, Eric Pugh, janhoy)
 
+* SOLR-3202: Dropping Support for JSP.  New Admin UI is all client side (ryan)
+
+
 Documentation
 ----------------------
 

Modified: lucene/dev/trunk/solr/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/build.xml?rev=1297578&r1=1297577&r2=1297578&view=diff
==============================================================================
--- lucene/dev/trunk/solr/build.xml (original)
+++ lucene/dev/trunk/solr/build.xml Tue Mar  6 17:04:19 2012
@@ -130,7 +130,7 @@
   <target name="compile" description="Compile the source code."
           depends="compile-core, compile-contrib"/>
   <target name="test" description="Validate, then run core, solrj, and contrib unit tests."
-          depends="validate, test-jsp, test-core, test-contrib"/>
+          depends="validate, test-core, test-contrib"/>
   <target name="test-core" description="Runs the core and solrj unit tests."
           depends="test-solr-core, test-solrj"/>
   <target name="compile-test" description="Compile unit tests."
@@ -169,14 +169,7 @@
       <propertyset refid="uptodate.and.compiled.properties"/>
     </ant>
   </target>
-  
-  <!-- Webapp targets -->
-  <target name="test-jsp">
-    <ant dir="webapp" target="test" inheritall="false">
-      <propertyset refid="uptodate.and.compiled.properties"/>
-    </ant>
-  </target>
-  
+    
   <!-- Validation (license/ notice checks). -->
   <target name="validate" depends="compile-tools" description="Validate legal stuff.">
     <license-check-macro dir="${basedir}">
@@ -189,8 +182,6 @@
       <additional-filters>
         <replaceregex pattern="/jetty-util([^/]+)$" replace="/jetty-util" flags="gi" />
         <replaceregex pattern="/jetty-6([^/]+)$" replace="/jetty" flags="gi" />
-        <replaceregex pattern="/jsp-2.1-glassfish([^/]+)$" replace="/jsp-2.1-glassfish" flags="gi" />
-        <replaceregex pattern="/jsp-api-2.1-glassfish([^/]+)$" replace="/jsp-api-2.1-glassfish" flags="gi" />
       </additional-filters>
     </license-check-macro>
   </target>

Added: lucene/dev/trunk/solr/core/src/java/org/apache/solr/servlet/LoadAdminUiServlet.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/servlet/LoadAdminUiServlet.java?rev=1297578&view=auto
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/servlet/LoadAdminUiServlet.java (added)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/servlet/LoadAdminUiServlet.java Tue Mar  6 17:04:19 2012
@@ -0,0 +1,79 @@
+/**
+ * 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.solr.servlet;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.solr.core.CoreContainer;
+
+
+/**
+ * A simple servlet to load the Solr Admin UI
+ * 
+ * @since solr 4.0
+ */
+public final class LoadAdminUiServlet extends HttpServlet {
+
+  @Override
+  public void doGet(HttpServletRequest request,
+                    HttpServletResponse response)
+      throws IOException, ServletException {
+    response.setCharacterEncoding("UTF-8");
+    response.setContentType("text/html");
+
+    PrintWriter out = response.getWriter();
+    File f = new File(getServletContext().getRealPath("admin.html"));
+    if(f.exists()) {
+      // This attribute is set by the SolrDispatchFilter
+      CoreContainer cores = (CoreContainer) request.getAttribute("org.apache.solr.CoreContainer");
+
+      String html = IOUtils.toString(new FileInputStream(f), "UTF-8");
+      
+      String[] search = new String[] { 
+          "${contextPath}", 
+          "${adminPath}" 
+      };
+      String[] replace = new String[] {
+          request.getContextPath(),
+          cores.getAdminPath()
+      };
+      
+      out.println( StringUtils.replaceEach(html, search, replace) );
+    }
+    else {
+      out.println("solr");
+    }
+  }
+
+  @Override
+  public void doPost(HttpServletRequest request,
+                     HttpServletResponse response)
+      throws IOException, ServletException {
+    doGet(request, response);
+  }
+}

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/servlet/LogLevelSelection.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/servlet/LogLevelSelection.java?rev=1297578&r1=1297577&r2=1297578&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/servlet/LogLevelSelection.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/servlet/LogLevelSelection.java Tue Mar  6 17:04:19 2012
@@ -59,8 +59,9 @@ public final class LogLevelSelection ext
     out.write("<title>Solr Admin: JDK Log Level Selector</title>\n");
     out.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"solr-admin.css\" />");
     out.write("</head><body>\n");
-    out.write("<a href=\".\"><img border=\"0\" align=\"right\" height=\"78\" width=\"142\" src=\"solr_small.png\" alt=\"Solr\"></a>");
-    out.write("<h1>JDK Log Level Selector</h1>");
+    out.write("<a href=\".\"><img border=\"0\" align=\"right\" height=\"78\" width=\"142\" src=\"img/solr.png\" alt=\"Solr\"></a>");
+    out.write("<h1 style='margin-bottom:5px;'>JDK Log Level Selector</h1>");
+    out.write("<h2 style='color:#AA0000; margin-top:0px;'>This will be removed before Solr 4.0.  See <a href='/#/logging'>logging</a></h1>");
 
     out.write("<p>Below is the complete JDK Log hierarchy with " +
             "intermediate logger/categories synthesized.  " +

Modified: lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java?rev=1297578&r1=1297577&r2=1297578&view=diff
==============================================================================
--- lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java (original)
+++ lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java Tue Mar  6 17:04:19 2012
@@ -87,7 +87,7 @@ public class JettyWebappTest extends Luc
     super.tearDown();
   }
   
-  public void testJSP() throws Exception
+  public void testAdminUI() throws Exception
   {
     // Currently not an extensive test, but it does fire up the JSP pages and make 
     // sure they compile ok
@@ -95,21 +95,5 @@ public class JettyWebappTest extends Luc
     String adminPath = "http://localhost:"+port+context+"/";
     byte[] bytes = IOUtils.toByteArray( new URL(adminPath).openStream() );
     assertNotNull( bytes ); // real error will be an exception
-
-    adminPath += "admin/";
-    bytes = IOUtils.toByteArray( new URL(adminPath).openStream() );
-    assertNotNull( bytes ); // real error will be an exception
-
-    // analysis
-    bytes = IOUtils.toByteArray( new URL(adminPath+"analysis.jsp").openStream() );
-    assertNotNull( bytes ); // real error will be an exception
-
-    // schema browser
-    bytes = IOUtils.toByteArray( new URL(adminPath+"schema.jsp").openStream() );
-    assertNotNull( bytes ); // real error will be an exception
-
-    // schema browser
-    bytes = IOUtils.toByteArray( new URL(adminPath+"threaddump.jsp").openStream() );
-    assertNotNull( bytes ); // real error will be an exception
   }
 }

Modified: lucene/dev/trunk/solr/webapp/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/webapp/build.xml?rev=1297578&r1=1297577&r2=1297578&view=diff
==============================================================================
--- lucene/dev/trunk/solr/webapp/build.xml (original)
+++ lucene/dev/trunk/solr/webapp/build.xml Tue Mar  6 17:04:19 2012
@@ -23,20 +23,8 @@
 	<property name="exclude.from.war" value="" />
   <property name="solr.war.suffix" value="" />
 	
-  <!-- Checks that all JSP files in the webapp compile successfully using Jetty's Jasper -->
   <target name="test" depends="compile-test-solr-core">
-    <property name="jsp.target" location="${dest}/jsp-temp" />
-    <taskdef classname="org.apache.jasper.JspC" name="jasper" >
-      <classpath>
-        <fileset dir="${common-solr.dir}/example/lib" includes="**/*.jar" />
-      </classpath>
-    </taskdef>
-    <delete dir="${jsp.target}" />
-    <mkdir dir="${jsp.target}" />
-    <jasper uriroot="${common-solr.dir}/webapp/web" outputDir="${jsp.target}" compile="false" verbose="1" package="j"/>
-    <javac srcdir="${jsp.target}" destdir="${jsp.target}" target="${javac.target}"
-           source="${javac.source}" debug="off" includeAntRuntime="${javac.includeAntRuntime}"
-           encoding="utf8" classpathref="test.classpath"/>
+  	<!-- no more JSP -->
   </target>
 
   <target name="dist"

Modified: lucene/dev/trunk/solr/webapp/web/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/webapp/web/WEB-INF/web.xml?rev=1297578&r1=1297577&r2=1297578&view=diff
==============================================================================
--- lucene/dev/trunk/solr/webapp/web/WEB-INF/web.xml (original)
+++ lucene/dev/trunk/solr/webapp/web/WEB-INF/web.xml Tue Mar  6 17:04:19 2012
@@ -51,14 +51,14 @@
          You will need to put this prefix in front of the SolrDispatchFilter
          url-pattern mapping too (/solr/*), and also on any paths for
          legacy Solr servlet mappings you may be using.
-         For the admin JSP's to work properly in a path-prefixed configuration,
-         the admin folder containing the JSPs needs to be under the app context root
+         For the Admin UI to work properly in a path-prefixed configuration,
+         the admin folder containing the resources needs to be under the app context root
          named to match the path-prefix.  For example:
 
             .war
                xxx
-                 admin
-                   stats.jsp
+                 js
+                   main.js
     -->
     <!--
     <init-param>
@@ -92,16 +92,27 @@
     <servlet-name>Zookeeper</servlet-name>
     <servlet-class>org.apache.solr.servlet.ZookeeperInfoServlet</servlet-class>
   </servlet>
+  
+  <servlet>
+    <servlet-name>LoadAdminUI</servlet-name>
+    <servlet-class>org.apache.solr.servlet.LoadAdminUiServlet</servlet-class>
+  </servlet>
 
+  <!-- Will be removed before 4.0 release! -->
   <servlet-mapping>
     <servlet-name>Logging</servlet-name>
-    <url-pattern>/admin/logging</url-pattern>
+    <url-pattern>/logging</url-pattern>
   </servlet-mapping>
   
   <servlet-mapping>
     <servlet-name>Zookeeper</servlet-name>
     <url-pattern>/zookeeper</url-pattern>
   </servlet-mapping>
+  
+  <servlet-mapping>
+    <servlet-name>LoadAdminUI</servlet-name>
+    <url-pattern>/admin.html</url-pattern>
+  </servlet-mapping>
 
   <mime-mapping>
     <extension>.xsl</extension>
@@ -110,8 +121,7 @@
   </mime-mapping>
 
   <welcome-file-list>
-    <welcome-file>index.jsp</welcome-file>
-    <welcome-file>index.html</welcome-file>
+    <welcome-file>admin.html</welcome-file>
   </welcome-file-list>
 
 </web-app>

Copied: lucene/dev/trunk/solr/webapp/web/admin.html (from r1297307, lucene/dev/trunk/solr/webapp/web/index.jsp)
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/webapp/web/admin.html?p2=lucene/dev/trunk/solr/webapp/web/admin.html&p1=lucene/dev/trunk/solr/webapp/web/index.jsp&r1=1297307&r2=1297578&rev=1297578&view=diff
==============================================================================
--- lucene/dev/trunk/solr/webapp/web/index.jsp (original)
+++ lucene/dev/trunk/solr/webapp/web/admin.html Tue Mar  6 17:04:19 2012
@@ -1,12 +1,22 @@
-<%@ page contentType="text/html; charset=utf-8" pageEncoding="UTF-8"%>
-<% request.setCharacterEncoding("UTF-8"); %>
-
-<%@ page import="java.util.List" %>
-<%@ page import="java.util.Collection" %>
+<html>
 
-<% org.apache.solr.core.CoreContainer cores = (org.apache.solr.core.CoreContainer)request.getAttribute("org.apache.solr.CoreContainer"); %>
+<!--
+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.
+-->
 
-<html>
 <head>
     
     <title>solr-admin</title>
@@ -18,8 +28,8 @@
     
     var app_config = {};
     
-    app_config.solr_path = '<%= request.getContextPath() %>';
-    app_config.core_admin_path = '<%= cores.getAdminPath() %>';
+    app_config.solr_path = '${contextPath}';
+    app_config.core_admin_path = '${adminPath}';
     app_config.zookeeper_path = 'zookeeper';
     app_config.schema_path = '/admin/file?file=schema.xml&contentType=text/xml;charset=utf-8';
     app_config.config_path = '/admin/file?file=solrconfig.xml&contentType=text/xml;charset=utf-8';
@@ -36,9 +46,8 @@
             <a href="./" id="solr"><span>Apache SOLR</span></a>
 
             <div id="wip-notice">
-                <p>This interface is work in progress. It works best in Chrome.</p>
-                <p><a href="admin">Use the <span>old admin interface</span> if there are problems with this one.</a></p>
-                <p><a href="https://issues.apache.org/jira/browse/SOLR-2667">Bugs/Requests/Suggestions: <span>SOLR-2667</span></a></p>
+                <p>This interface is work in progress.</p>
+                <p>Please report any <a href="https://issues.apache.org/jira/browse/SOLR-2667">Bugs/Requests/Suggestions: <span>SOLR-2667</span></a></p>
             </div>
 
             <p id="environment">&nbsp;</p>