declare admin-pages to return UTF-8, add space in content-type strings: SOLR-35

git-svn-id: https://svn.apache.org/repos/asf/incubator/solr/trunk@423562 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2006-07-19 18:48:16 +00:00
parent 929d0d332e
commit 70c8fc4b46
17 changed files with 70 additions and 58 deletions

View File

@ -18,7 +18,7 @@ import java.util.*;
*/
public class JSONResponseWriter implements QueryResponseWriter {
static String CONTENT_TYPE_JSON_UTF8="text/x-json;charset=UTF-8";
static String CONTENT_TYPE_JSON_UTF8="text/x-json; charset=UTF-8";
public void write(Writer writer, SolrQueryRequest req, SolrQueryResponse rsp) throws IOException {

View File

@ -24,9 +24,9 @@ import java.io.IOException;
* @version $Id$
*/
public interface QueryResponseWriter {
public static String CONTENT_TYPE_XML_UTF8="text/xml;charset=UTF-8";
public static String CONTENT_TYPE_TEXT_UTF8="text/plain;charset=UTF-8";
public static String CONTENT_TYPE_TEXT_ASCII="text/plain;charset=US-ASCII";
public static String CONTENT_TYPE_XML_UTF8="text/xml; charset=UTF-8";
public static String CONTENT_TYPE_TEXT_UTF8="text/plain; charset=UTF-8";
public static String CONTENT_TYPE_TEXT_ASCII="text/plain; charset=US-ASCII";
public void write(Writer writer, SolrQueryRequest request, SolrQueryResponse response) throws IOException;
public String getContentType(SolrQueryRequest request, SolrQueryResponse response);

View File

@ -1,30 +1,31 @@
<%@ page import="org.apache.solr.core.SolrConfig,
org.apache.solr.core.SolrCore,
org.apache.solr.schema.IndexSchema,
java.io.File"%>
<%@ page import="java.net.InetAddress"%>
<%@ page import="org.apache.solr.core.Config"%>
<%
SolrCore core = SolrCore.getSolrCore();
int port = request.getServerPort();
IndexSchema schema = core.getSchema();
// enabled/disabled is purely from the point of a load-balancer
// and has no effect on local server function. If there is no healthcheck
// configured, don't put any status on the admin pages.
String enabledStatus = null;
String enabledFile = SolrConfig.config.get("admin/healthcheck/text()",null);
boolean isEnabled = false;
if (enabledFile!=null) {
isEnabled = new File(enabledFile).exists();
}
String collectionName = schema!=null ? schema.getName():"unknown";
InetAddress addr = InetAddress.getLocalHost();
String hostname = addr.getCanonicalHostName();
String defaultSearch = SolrConfig.config.get("admin/defaultQuery/text()",null);
String cwd=System.getProperty("user.dir");
String solrHome= Config.getInstanceDir();
%>
<%@ page contentType="text/html; charset=utf-8" pageEncoding="UTF-8"%>
<%@ page import="org.apache.solr.core.SolrConfig,
org.apache.solr.core.SolrCore,
org.apache.solr.schema.IndexSchema,
java.io.File"%>
<%@ page import="java.net.InetAddress"%>
<%@ page import="org.apache.solr.core.Config"%>
<%
SolrCore core = SolrCore.getSolrCore();
int port = request.getServerPort();
IndexSchema schema = core.getSchema();
// enabled/disabled is purely from the point of a load-balancer
// and has no effect on local server function. If there is no healthcheck
// configured, don't put any status on the admin pages.
String enabledStatus = null;
String enabledFile = SolrConfig.config.get("admin/healthcheck/text()",null);
boolean isEnabled = false;
if (enabledFile!=null) {
isEnabled = new File(enabledFile).exists();
}
String collectionName = schema!=null ? schema.getName():"unknown";
InetAddress addr = InetAddress.getLocalHost();
String hostname = addr.getCanonicalHostName();
String defaultSearch = SolrConfig.config.get("admin/defaultQuery/text()",null);
String cwd=System.getProperty("user.dir");
String solrHome= Config.getInstanceDir();
%>

View File

@ -1,3 +1,4 @@
<%@ page contentType="text/html; charset=utf-8" pageEncoding="UTF-8"%>
<%@ page import="org.apache.solr.core.SolrCore,
org.apache.solr.schema.IndexSchema,
java.io.File,

View File

@ -1,3 +1,4 @@
<%@ page contentType="text/html; charset=utf-8" pageEncoding="UTF-8"%>
<%@ page import="org.apache.lucene.analysis.Analyzer,
org.apache.lucene.analysis.Token,
org.apache.lucene.analysis.TokenStream,

View File

@ -1,3 +1,4 @@
<%@ page contentType="text/html; charset=utf-8" pageEncoding="UTF-8"%>
<%@ page import="org.apache.solr.core.SolrCore,
org.apache.solr.schema.IndexSchema,
java.io.BufferedReader,

View File

@ -1,3 +1,4 @@
<%@ page contentType="text/html; charset=utf-8" pageEncoding="UTF-8"%>
<%@include file="header.jsp" %>
<br clear="all">

View File

@ -1,10 +1,10 @@
<%@ page contentType="text/plain; charset=utf-8" pageEncoding="UTF-8"%>
<%@ page import="org.apache.solr.core.Config,
org.apache.solr.core.SolrConfig,
java.io.InputStream,
java.io.InputStreamReader,
java.io.Reader,
java.util.StringTokenizer"%>
<%@ page contentType="text/plain;charset=UTF-8" language="java" %>
<%
String fname = request.getParameter("file");
String optional = request.getParameter("optional");

View File

@ -1,20 +1,21 @@
<%@include file="_info.jsp" %>
<script>
var host_name="<%= hostname %>"
</script>
<html>
<head>
<link rel="stylesheet" type="text/css" href="solr-admin.css">
<link rel="icon" href="favicon.ico" type="image/ico"></link>
<link rel="shortcut icon" href="favicon.ico" type="image/ico"></link>
<title>Solr admin page</title>
</head>
<body>
<a href="."><img border="0" align="right" height="61" width="142" src="solr-head.gif" alt="Solr"></a>
<h1>Solr Admin (<%= collectionName %>)
<%= enabledStatus==null ? "" : (isEnabled ? " - Enabled" : " - Disabled") %> </h1>
<%= hostname %>:<%= port %><br/>
cwd=<%= cwd %> SolrHome=<%= solrHome %>
<%@ page contentType="text/html; charset=utf-8" pageEncoding="UTF-8"%>
<%@include file="_info.jsp" %>
<script>
var host_name="<%= hostname %>"
</script>
<html>
<head>
<link rel="stylesheet" type="text/css" href="solr-admin.css">
<link rel="icon" href="favicon.ico" type="image/ico"></link>
<link rel="shortcut icon" href="favicon.ico" type="image/ico"></link>
<title>Solr admin page</title>
</head>
<body>
<a href="."><img border="0" align="right" height="61" width="142" src="solr-head.gif" alt="Solr"></a>
<h1>Solr Admin (<%= collectionName %>)
<%= enabledStatus==null ? "" : (isEnabled ? " - Enabled" : " - Disabled") %> </h1>
<%= hostname %>:<%= port %><br/>
cwd=<%= cwd %> SolrHome=<%= solrHome %>

View File

@ -1,4 +1,4 @@
<%@ page contentType="text/html; charset=utf-8" pageEncoding="UTF-8"%>
<!-- $Id$ -->
<!-- $Source: /cvs/main/searching/SolrServer/resources/admin/index.jsp,v $ -->
<!-- $Name: $ -->

View File

@ -1,3 +1,4 @@
<%@ page contentType="text/html; charset=utf-8" pageEncoding="UTF-8"%>
<%@ page import="org.apache.solr.core.SolrCore,
org.apache.solr.schema.IndexSchema,
java.io.File,

View File

@ -1,3 +1,4 @@
<%@ page contentType="text/html; charset=utf-8" pageEncoding="UTF-8"%>
<%@ page import="org.apache.solr.core.SolrConfig,
org.apache.solr.core.SolrCore,
org.apache.solr.core.SolrException"%>

View File

@ -1,3 +1,4 @@
<%@ page contentType="text/html; charset=utf-8" pageEncoding="UTF-8"%>
<%@ page import="org.apache.solr.core.SolrCore,
org.apache.solr.schema.IndexSchema"%>
<%@ page import="java.io.InputStreamReader"%>

View File

@ -1,3 +1,4 @@
<%@ page contentType="text/html; charset=utf-8" pageEncoding="UTF-8"%>
<%@ page import="org.apache.solr.core.SolrInfoMBean,
org.apache.solr.core.SolrInfoRegistry,
java.net.URL,

View File

@ -1,3 +1,4 @@
<%@ page contentType="text/html; charset=utf-8" pageEncoding="UTF-8"%>
<%@ page import="org.apache.solr.core.SolrInfoMBean,
org.apache.solr.core.SolrInfoRegistry,
org.apache.solr.util.NamedList,

View File

@ -1,3 +1,4 @@
<%@ page contentType="text/html; charset=utf-8" pageEncoding="UTF-8"%>
<%@ page import="java.lang.management.ManagementFactory,
java.lang.management.ThreadMXBean,
java.lang.management.ThreadInfo,

View File

@ -18,6 +18,7 @@ import org.apache.solr.core.SolrCore;
import org.apache.solr.core.SolrException;
import org.apache.solr.request.XMLResponseWriter;
import org.apache.solr.request.SolrQueryResponse;
import org.apache.solr.request.QueryResponseWriter;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
@ -35,7 +36,6 @@ import java.io.PrintWriter;
public class SolrUpdateServlet extends HttpServlet {
final Logger log = Logger.getLogger(SolrUpdateServlet.class.getName());
private SolrCore core;
private static String CONTENT_TYPE="text/xml;charset=UTF-8";
XMLResponseWriter xmlResponseWriter;
@ -47,7 +47,7 @@ public class SolrUpdateServlet extends HttpServlet {
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
BufferedReader requestReader = request.getReader();
response.setContentType(CONTENT_TYPE);
response.setContentType(QueryResponseWriter.CONTENT_TYPE_XML_UTF8);
PrintWriter responseWriter = response.getWriter();
core.update(requestReader, responseWriter);
}