01: package org.apache.solr.servlet;
02:
03: /**
04: * Licensed to the Apache Software Foundation (ASF) under one or more
05: * contributor license agreements. See the NOTICE file distributed with
06: * this work for additional information regarding copyright ownership.
07: * The ASF licenses this file to You under the Apache License, Version 2.0
08: * (the "License"); you may not use this file except in compliance with
09: * the License. You may obtain a copy of the License at
10: *
11: * http://www.apache.org/licenses/LICENSE-2.0
12: *
13: * Unless required by applicable law or agreed to in writing, software
14: * distributed under the License is distributed on an "AS IS" BASIS,
15: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16: * See the License for the specific language governing permissions and
17: * limitations under the License.
18: */
19:
20: import java.io.BufferedReader;
21: import java.io.IOException;
22: import java.io.PrintWriter;
23: import java.util.logging.Logger;
24:
25: import javax.servlet.ServletException;
26: import javax.servlet.http.HttpServlet;
27: import javax.servlet.http.HttpServletRequest;
28: import javax.servlet.http.HttpServletResponse;
29:
30: import org.apache.solr.core.SolrException;
31: import org.apache.solr.handler.XmlUpdateRequestHandler;
32: import org.apache.solr.request.QueryResponseWriter;
33: import org.apache.solr.request.XMLResponseWriter;
34: import org.apache.solr.util.XML;
35:
36: /**
37: * @author yonik
38: * @version $Id$
39: */
40: @Deprecated
41: public class SolrUpdateServlet extends HttpServlet {
42: final Logger log = Logger.getLogger(SolrUpdateServlet.class
43: .getName());
44:
45: XmlUpdateRequestHandler legacyUpdateHandler;
46: XMLResponseWriter xmlResponseWriter;
47:
48: public void init() throws ServletException {
49: legacyUpdateHandler = new XmlUpdateRequestHandler();
50: legacyUpdateHandler.init(null);
51:
52: log.info("SolrUpdateServlet.init() done");
53: }
54:
55: public void doPost(HttpServletRequest request,
56: HttpServletResponse response) throws ServletException,
57: IOException {
58: BufferedReader requestReader = request.getReader();
59: response
60: .setContentType(QueryResponseWriter.CONTENT_TYPE_XML_UTF8);
61:
62: PrintWriter writer = response.getWriter();
63: legacyUpdateHandler.doLegacyUpdate(requestReader, writer);
64: }
65: }
|