<commit_before>package org.motechproject.mobile.web.ivr.intellivr;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;

import org.motechproject.omp.manager.intellivr.AutoCreate;
import org.motechproject.omp.manager.intellivr.ErrorCodeType;
import org.motechproject.omp.manager.intellivr.ResponseType;
import org.motechproject.omp.manager.intellivr.StatusType;

public class IntellIVRServlet extends HttpServlet {

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		this.doPost(req, resp);
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		resp.setContentType("text/xml");
		PrintWriter out = resp.getWriter();
		
		AutoCreate ac = new AutoCreate();
		ResponseType rt = new ResponseType();
		rt.setStatus(StatusType.ERROR);
		rt.setErrorCode(ErrorCodeType.MOTECH_MALFORMED_XML);
		rt.setErrorString("test");
		ac.setResponse(rt);
	
		try {
			JAXBContext jac = JAXBContext.newInstance("org.motechproject.omp.manager.intellivr");
			Marshaller m = jac.createMarshaller();
			m.marshal(ac, out);
		} catch (JAXBException e) {
			e.printStackTrace();
			out.println("<test>jaxb error</test>");
		}
		
	}

}<commit_msg>IntellIVRServlet.java - remove GET method.  It is not supported.  Tested reading xml from the POSTed content.<commit_after>package org.motechproject.mobile.web.ivr.intellivr;

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;

import org.motechproject.omp.manager.intellivr.AutoCreate;
import org.motechproject.omp.manager.intellivr.ErrorCodeType;
import org.motechproject.omp.manager.intellivr.ResponseType;
import org.motechproject.omp.manager.intellivr.StatusType;

public class IntellIVRServlet extends HttpServlet {

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		
		InputStream in = req.getInputStream();
		int length = req.getContentLength();
		byte[] buffer = new byte[length];
		int read = in.read(buffer, 0, length);
		
		String content = new String(buffer);
		
		resp.setContentType("text/xml");
		PrintWriter out = resp.getWriter();
		
		AutoCreate ac = new AutoCreate();
		ResponseType rt = new ResponseType();
		rt.setStatus(StatusType.ERROR);
		rt.setErrorCode(ErrorCodeType.MOTECH_MALFORMED_XML);
		rt.setErrorString("");
		ac.setResponse(rt);
	
		try {
			JAXBContext jac = JAXBContext.newInstance("org.motechproject.omp.manager.intellivr");
			Marshaller m = jac.createMarshaller();
			m.marshal(ac, out);
		} catch (JAXBException e) {
			e.printStackTrace();
			out.println("<test>jaxb error</test>");
		}
		
	}

}
{'fraction_non_alphanumeric': 0.10999390615478367, 'fraction_numerical': 0.0003046922608165753, 'mean_word_length': 5.325626204238921, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 9}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7326284', 'n_tokens_mistral': 1123, 'n_tokens_neox': 1047, 'n_words': 195}