/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 
 */
package org.ocelotds.web;

import org.ocelotds.Constants;
import java.io.IOException;
import javax.inject.Inject;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.ocelotds.logger.OcelotLogger;
import org.slf4j.Logger;

/**
 * Servlet to serve ocelot.js
 *
 * @author hhfrancois
 */
@WebServlet(urlPatterns = {Constants.SLASH_OCELOT_JS})
public class JSServlet extends AbstractServlet {

	private static final long serialVersionUID = 1973549844535787671L;

	@Inject
	@OcelotLogger
	private transient Logger logger;

	/**
	 * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
	 *
	 * @param request servlet request
	 * @param response servlet response
	 * @throws ServletException if a servlet-specific error occurs
	 * @throws IOException if an I/O error occurs
	 */
	@Override
	protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String minify = request.getParameter(Constants.MINIFY_PARAMETER);
		String filename = request.getServletContext().getInitParameter(Constants.OCELOT_MIN);
		if (Constants.FALSE.equalsIgnoreCase(minify)) {
			filename = request.getServletContext().getInitParameter(Constants.OCELOT);
		}
		processFile(filename, Constants.JSTYPE, request, response);
	}
}

@@ -319,24 +319,62 @@
 ct.Inject;%0D%0A
+import javax.servlet.ServletContext;%0D%0A
 import javax
@@ -1427,53 +1427,110 @@
 %0D%0A%09%09
-String filename = request.getServletContext()
+final ServletContext servletContext = request.getServletContext();%0D%0A%09%09String filename = servletContext
 .get
@@ -1632,28 +1632,17 @@
 ename = 
-request.getS
+s
 ervletCo
@@ -1646,18 +1646,16 @@
 tContext
-()
 .getInit

extract vrariable