SOLR-4311: Admin UI - Optimize Caching Behaviour

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1457099 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stefan Matheis 2013-03-15 20:36:01 +00:00
parent 8f2294f644
commit 5b6b0776ef
3 changed files with 9 additions and 2 deletions

View File

@ -129,6 +129,8 @@ Bug Fixes
* SOLR-4585: The Collections API validates numShards with < 0 but should use
<= 0. (Mark Miller)
* SOLR-4311: Admin UI - Optimize Caching Behaviour (steffkes)
Optimizations
----------------------

View File

@ -30,6 +30,7 @@ import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.solr.core.CoreContainer;
import org.apache.solr.core.SolrCore;
/**
* A simple servlet to load the Solr Admin UI
@ -53,14 +54,17 @@ public final class LoadAdminUiServlet extends HttpServlet {
Writer out = new OutputStreamWriter(response.getOutputStream(), "UTF-8");
String html = IOUtils.toString(in, "UTF-8");
Package package = SolrCore.class.getPackage();
String[] search = new String[] {
"${contextPath}",
"${adminPath}"
"${adminPath}",
"${version}"
};
String[] replace = new String[] {
StringEscapeUtils.escapeJavaScript(request.getContextPath()),
StringEscapeUtils.escapeJavaScript(cores.getAdminPath())
StringEscapeUtils.escapeJavaScript(cores.getAdminPath()),
StringEscapeUtils.escapeJavaScript(package.getSpecificationVersion())
};
out.write( StringUtils.replaceEach(html, search, replace) );

View File

@ -585,4 +585,5 @@ var solr_admin = function( app_config )
};
$.ajaxSetup( { cache: false } );
var app = new solr_admin( app_config );