// Copyright 2020 Google LLC
// Licensed 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
// https://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 com.google.error_analyzer.servlets;

import com.google.error_analyzer.backend.StoreLogs;
import java.io.IOException;
import javax.servlet.*;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.http.HttpHost;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.common.xcontent.XContentType;

/*This class is for storing the logs entered by the user as 
plain text to the database*/
@WebServlet("/StorePlainTextLogServlet")
public class TextServlet extends HttpServlet {

    @Override
    public void doPost(HttpServletRequest request,
     HttpServletResponse response)throws IOException, ServletException {
        response.setContentType("text/html;");
        final String logText = "Log";
        String log = request.getParameter(logText);
        final String filename = "filename";
        String fileName = request.getParameter(filename);
        StoreLogs storeLog = new StoreLogs();
        String status = storeLog.checkAndStoreLog(fileName, log);
        response.getWriter().println(status);
        RequestDispatcher requestDispatcher = 
            request.getRequestDispatcher("/index.html");
        requestDispatcher.include(request, response);
    }
}
@@ -1324,16 +1324,162 @@
 ervlet %7B
+%0A    private final String logText = %22Log%22;%0A    private final String filename = %22filename%22;%0A    private final StoreLogs storeLog = new StoreLogs();
 %0A%0A    @O
@@ -1656,51 +1656,12 @@
 html
-;
 %22);%0A
-        final String logText = %22Log%22;%0A
     
@@ -1712,52 +1712,8 @@
 t);%0A
-        final String filename = %22filename%22;%0A
     
@@ -1770,54 +1770,8 @@
 e);%0A
-        StoreLogs storeLog = new StoreLogs();%0A
     

Add class variables