diff --git a/solr/src/webapp/src/org/apache/solr/servlet/SolrServlet.java b/solr/src/webapp/src/org/apache/solr/servlet/SolrServlet.java deleted file mode 100644 index 759dfd3039f..00000000000 --- a/solr/src/webapp/src/org/apache/solr/servlet/SolrServlet.java +++ /dev/null @@ -1,130 +0,0 @@ -/** - * 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.IOException; -import java.io.PrintWriter; - -import org.apache.solr.common.params.CommonParams; -import org.apache.solr.request.SolrRequestInfo; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.solr.common.SolrException; -import org.apache.solr.core.SolrCore; -import org.apache.solr.core.SolrResourceLoader; -import org.apache.solr.request.SolrRequestHandler; -import org.apache.solr.response.QueryResponseWriter; -import org.apache.solr.response.SolrQueryResponse; - -/** - * @deprecated Register a standard request handler instead of using this - * servlet. Add <requestHandler name="standard" - * class="solr.StandardRequestHandler" default="true"> to - * solrconfig.xml. - */ - -@Deprecated -public class SolrServlet extends HttpServlet { - - final Logger log = LoggerFactory.getLogger(SolrServlet.class); - private boolean hasMulticore = false; - - public void init() throws ServletException { - log.info("SolrServlet.init()"); - - // Check if the "solr.xml" file exists -- if so, this is an invalid servlet - // (even if there is only one core...) - String instanceDir = SolrResourceLoader.locateInstanceDir(); - File fconf = new File(instanceDir, "solr.xml"); - hasMulticore = fconf.exists(); - - // we deliberately do not initialize a SolrCore because of SOLR-597 - // https://issues.apache.org/jira/browse/SOLR-597 - log.info("SolrServlet.init() done"); - } - - public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - doGet(request,response); - } - - public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - if( hasMulticore ) { - response.sendError( 400, "Missing solr core name in path" ); - return; - } - - final SolrCore core = SolrCore.getSolrCore(); - SolrServletRequest solrReq = new SolrServletRequest(core, request);; - SolrQueryResponse solrRsp = new SolrQueryResponse(); - try { - String qt = solrReq.getParams().get(CommonParams.QT); - SolrRequestHandler handler = core.getRequestHandler(solrReq.getParams().get(CommonParams.QT)); - if (handler==null) { - log.warn("Unknown Request Handler '" + qt +"' :" + solrReq); - throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,"Unknown Request Handler '" + qt + "'", true); - } - SolrRequestInfo.setRequestInfo(new SolrRequestInfo(solrReq, solrRsp)); - core.execute(handler, solrReq, solrRsp ); - if (solrRsp.getException() == null) { - QueryResponseWriter responseWriter = core.getQueryResponseWriter(solrReq); - response.setContentType(responseWriter.getContentType(solrReq, solrRsp)); - PrintWriter out = response.getWriter(); - responseWriter.write(out, solrReq, solrRsp); - } else { - Exception e = solrRsp.getException(); - int rc=500; - if (e instanceof SolrException) { - rc=((SolrException)e).code(); - } - sendErr(rc, SolrException.toStr(e), request, response); - } - } catch (SolrException e) { - if (!e.logged) SolrException.log(log,e); - sendErr(e.code(), SolrException.toStr(e), request, response); - } catch (Throwable e) { - SolrException.log(log,e); - sendErr(500, SolrException.toStr(e), request, response); - } finally { - // This releases the IndexReader associated with the request - solrReq.close(); - SolrRequestInfo.clearRequestInfo(); - } - } - - final void sendErr(int rc, String msg, HttpServletRequest request, HttpServletResponse response) { - try { - // hmmm, what if this was already set to text/xml? - try{ - response.setContentType(QueryResponseWriter.CONTENT_TYPE_TEXT_UTF8); - // response.setCharacterEncoding("UTF-8"); - } catch (Exception e) {} - try{response.setStatus(rc);} catch (Exception e) {} - PrintWriter writer = response.getWriter(); - writer.write(msg); - } catch (IOException e) { - SolrException.log(log,e); - } - } -} diff --git a/solr/src/webapp/src/org/apache/solr/servlet/SolrServletRequest.java b/solr/src/webapp/src/org/apache/solr/servlet/SolrServletRequest.java deleted file mode 100644 index 39d7588efa9..00000000000 --- a/solr/src/webapp/src/org/apache/solr/servlet/SolrServletRequest.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * 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 org.apache.solr.request.SolrQueryRequestBase; -import org.apache.solr.request.ServletSolrParams; -import org.apache.solr.core.SolrCore; - -import javax.servlet.http.HttpServletRequest; - -/** - * @version $Id$ - */ -class SolrServletRequest extends SolrQueryRequestBase { - public SolrServletRequest(SolrCore core, HttpServletRequest req) { - super(core, new ServletSolrParams(req)); - } -} diff --git a/solr/src/webapp/src/org/apache/solr/servlet/SolrUpdateServlet.java b/solr/src/webapp/src/org/apache/solr/servlet/SolrUpdateServlet.java deleted file mode 100644 index 51a07d9be04..00000000000 --- a/solr/src/webapp/src/org/apache/solr/servlet/SolrUpdateServlet.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.apache.solr.servlet;/** - * 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. - */ - -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.PrintWriter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.solr.core.SolrResourceLoader; -import org.apache.solr.handler.XmlUpdateRequestHandler; -import org.apache.solr.response.QueryResponseWriter; -import org.apache.solr.response.XMLResponseWriter; - -/** - * @version $Id$ - * - * @deprecated Register a request handler to /update rather then use this servlet. Add: <requestHandler name="/update" class="solr.XmlUpdateRequestHandler" > to your solrconfig.xml - */ -@Deprecated -public class SolrUpdateServlet extends HttpServlet { - final Logger log = LoggerFactory.getLogger(SolrUpdateServlet.class); - - XmlUpdateRequestHandler legacyUpdateHandler; - XMLResponseWriter xmlResponseWriter; - private boolean hasMulticore = false; - - @Override - public void init() throws ServletException - { - legacyUpdateHandler = new XmlUpdateRequestHandler(); - legacyUpdateHandler.init( null ); - - // Check if the "solr.xml" file exists -- if so, this is an invalid servlet - // (even if there is only one core...) - String instanceDir = SolrResourceLoader.locateInstanceDir(); - File fconf = new File(instanceDir, "solr.xml"); - hasMulticore = fconf.exists(); - - log.info("SolrUpdateServlet.init() done"); - } - - @Override - public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - if( hasMulticore ) { - response.sendError( 400, "Missing solr core name in path" ); - return; - } - BufferedReader requestReader = request.getReader(); - response.setContentType(QueryResponseWriter.CONTENT_TYPE_XML_UTF8); - - if( request.getQueryString() != null ) { - log.warn( - "The @Deprecated SolrUpdateServlet does not accept query parameters: "+request.getQueryString()+"\n" - +" If you are using solrj, make sure to register a request handler to /update rather then use this servlet.\n" - +" Add: to your solrconfig.xml\n\n" ); - } - PrintWriter writer = response.getWriter(); - legacyUpdateHandler.doLegacyUpdate(requestReader, writer); - } -} diff --git a/solr/src/webapp/web/WEB-INF/web.xml b/solr/src/webapp/web/WEB-INF/web.xml index b3aa9152712..29afea60a2e 100644 --- a/solr/src/webapp/web/WEB-INF/web.xml +++ b/solr/src/webapp/web/WEB-INF/web.xml @@ -83,62 +83,16 @@ /* - - - - SolrServer - Solr - Solr Server - org.apache.solr.servlet.SolrServlet - 1 - - - - SolrUpdate - SolrUpdate - Solr Update Handler - org.apache.solr.servlet.SolrUpdateServlet - 2 - - Logging org.apache.solr.servlet.LogLevelSelection - - - ping - /admin/ping.jsp - - - - SolrServer - /select/* - - - - SolrUpdate - /update/* - - Logging /admin/logging - - - ping - /admin/ping - - - - - Logging - /admin/logging.jsp - - .xsl diff --git a/solr/src/webapp/web/admin/registry.jsp b/solr/src/webapp/web/admin/registry.jsp index db721d5f8e0..44741836d99 100644 --- a/solr/src/webapp/web/admin/registry.jsp +++ b/solr/src/webapp/web/admin/registry.jsp @@ -16,7 +16,6 @@ limitations under the License. --%> <%@ page import="org.apache.solr.core.SolrInfoMBean, - org.apache.solr.core.SolrInfoRegistry, java.net.URL, java.util.Date, java.util.Map"%> diff --git a/solr/src/webapp/web/admin/stats.jsp b/solr/src/webapp/web/admin/stats.jsp index 5a8e7d6e9ca..8f8e15901f7 100644 --- a/solr/src/webapp/web/admin/stats.jsp +++ b/solr/src/webapp/web/admin/stats.jsp @@ -16,7 +16,6 @@ limitations under the License. --%> <%@ page import="org.apache.solr.core.SolrInfoMBean, - org.apache.solr.core.SolrInfoRegistry, org.apache.solr.common.util.NamedList, java.util.Date, java.util.Map"%>