forked from mdodsworth/lucene-solr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SOLR-3202: remove JSP support and the old admin UI
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1297578 13f79535-47bb-0310-9956-ffa450edef68
- Loading branch information
Ryan McKinley
committed
Mar 6, 2012
1 parent
936fa2c
commit 0f05fed
Showing
44 changed files
with
126 additions
and
5,192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
solr/core/src/java/org/apache/solr/servlet/LoadAdminUiServlet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Oops, something went wrong.