// Path: src/main/java/com/dogeops/cantilever/logreader/HTTPLogObject.java
// public class HTTPLogObject {
// 	private String timestamp, method, request, bytes, useragent;
// 	private String requesting_resver, request_payload, url_request;
// 	private String[] headers;
// 	
// 	public HTTPLogObject(String timestamp, String method, String request,
// 			String bytes, String useragent) {
// 		this.timestamp = timestamp;
// 		this.method = method;
// 		this.request = request;
// 		this.bytes = bytes;
// 		this.useragent = useragent;
// 		
// 		buildRequestPayload();
// 	}
// 	
// 	private void buildHeaderArray() {
// 		String header_input = ConfigurationSingleton.instance
// 				.getConfigItem("replay.request.headers");
// 		String header_delimiter = ConfigurationSingleton.instance
// 				.getConfigItem("replay.request.headers.delimiter");
// 		this.headers = header_input.split(header_delimiter);
// 	}
// 	
// 	private void buildRequestPayload() {
// 		this.requesting_resver = ConfigurationSingleton.instance
// 				.getConfigItem("replay.request.servername");
// 		buildHeaderArray();
// 		buildURLRequest();
// 		Gson gson = new Gson();
// 		this.request_payload = gson.toJson(this);
// 	}
// 	
// 	private void buildURLRequest() {
// 		String http_port = ConfigurationSingleton.instance
// 				.getConfigItem("replay.request.port");
// 		String http_protocol = ConfigurationSingleton.instance.getConfigItem(
// 				"replay.request.protocol").toLowerCase();
// 
// 		if (http_port.equals("80") || http_port.equals("443")) {
// 			http_port = "";
// 		} else {
// 			http_port = ":" + http_port;
// 		}
// 		this.url_request = http_protocol + "://" + this.requesting_resver
// 				+ this.request + http_port;
// 	}
// 	
// 	public String getTimestamp() {
// 		return this.timestamp;
// 	}
// 	
// 	public String getPayload() {
// 		return this.request_payload;
// 	}
// 	
// 	public String getRequest() {
// 		return this.request;
// 	}
// 	
// 	public String[] getHeaders() {
// 		return this.headers;
// 	}
// 	
// 	public String getServerName() {
// 		return this.requesting_resver;
// 	}
// 	
// 	public String getMethod() {
// 		return this.method;
// 	}
// 	
// 	public String getUseragent() {
// 		return this.useragent;
// 	}
// 	
// 	public String getURLRequest() {
// 		return this.url_request;
// 	}
// }
// 
// Path: src/main/java/com/dogeops/cantilever/utils/ConfigurationSingleton.java
// public enum ConfigurationSingleton {
// 	instance;
// 	private static final Logger logger = Logger
// 			.getLogger(ConfigurationSingleton.class.getName());
// 
// 	private Properties props = new Properties();
// 
// 	private ConfigurationSingleton() {
// 	}
// 
// 	public void readConfigFile(String config_path) {
// 		try {
// 			InputStream input = new FileInputStream(config_path);
// 			props.load(input);
// 			input.close();
// 		} catch (IOException e) {
// 			cease(logger, e.getMessage());
// 		}
// 	}
// 
// 	public String getConfigItem(String val) {
// 		try {
// 			if (props.isEmpty()) {
// 				throw new Exception("Propery file object is empty. "
// 						+ "This likely indicates that the config singleton "
// 						+ "was not properly initialized via readConfigFile.");
// 			}
// 			if (props.getProperty(val) == null) {
// 				throw new Exception("The property " + val
// 						+ " is missing from the configurtion file.");
// 			}
// 			return props.getProperty(val);
// 		} catch (Exception e) {
// 			cease(logger, e.getMessage());
// 			return null;
// 		}
// 	}
// }


import java.util.ArrayList;
import java.util.List;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.protocol.HttpContext;
import org.apache.log4j.Logger;
import com.dogeops.cantilever.logreader.HTTPLogObject;
import com.dogeops.cantilever.utils.ConfigurationSingleton;
package com.dogeops.cantilever.truss.client.apache;

/* 
 * This is an extremely basic implementation until it is determined
 * how to differentiate and insert the POST entity using the config file
 */




public class HTTPPostRequest extends Thread {
	private static final Logger logger = Logger.getLogger(HTTPPostRequest.class
			.getName());
	
	private CloseableHttpClient httpClient;
    private HttpContext context;
    private HttpPost httppost;
// Path: src/main/java/com/dogeops/cantilever/logreader/HTTPLogObject.java
// public class HTTPLogObject {
// 	private String timestamp, method, request, bytes, useragent;
// 	private String requesting_resver, request_payload, url_request;
// 	private String[] headers;
// 	
// 	public HTTPLogObject(String timestamp, String method, String request,
// 			String bytes, String useragent) {
// 		this.timestamp = timestamp;
// 		this.method = method;
// 		this.request = request;
// 		this.bytes = bytes;
// 		this.useragent = useragent;
// 		
// 		buildRequestPayload();
// 	}
// 	
// 	private void buildHeaderArray() {
// 		String header_input = ConfigurationSingleton.instance
// 				.getConfigItem("replay.request.headers");
// 		String header_delimiter = ConfigurationSingleton.instance
// 				.getConfigItem("replay.request.headers.delimiter");
// 		this.headers = header_input.split(header_delimiter);
// 	}
// 	
// 	private void buildRequestPayload() {
// 		this.requesting_resver = ConfigurationSingleton.instance
// 				.getConfigItem("replay.request.servername");
// 		buildHeaderArray();
// 		buildURLRequest();
// 		Gson gson = new Gson();
// 		this.request_payload = gson.toJson(this);
// 	}
// 	
// 	private void buildURLRequest() {
// 		String http_port = ConfigurationSingleton.instance
// 				.getConfigItem("replay.request.port");
// 		String http_protocol = ConfigurationSingleton.instance.getConfigItem(
// 				"replay.request.protocol").toLowerCase();
// 
// 		if (http_port.equals("80") || http_port.equals("443")) {
// 			http_port = "";
// 		} else {
// 			http_port = ":" + http_port;
// 		}
// 		this.url_request = http_protocol + "://" + this.requesting_resver
// 				+ this.request + http_port;
// 	}
// 	
// 	public String getTimestamp() {
// 		return this.timestamp;
// 	}
// 	
// 	public String getPayload() {
// 		return this.request_payload;
// 	}
// 	
// 	public String getRequest() {
// 		return this.request;
// 	}
// 	
// 	public String[] getHeaders() {
// 		return this.headers;
// 	}
// 	
// 	public String getServerName() {
// 		return this.requesting_resver;
// 	}
// 	
// 	public String getMethod() {
// 		return this.method;
// 	}
// 	
// 	public String getUseragent() {
// 		return this.useragent;
// 	}
// 	
// 	public String getURLRequest() {
// 		return this.url_request;
// 	}
// }
// 
// Path: src/main/java/com/dogeops/cantilever/utils/ConfigurationSingleton.java
// public enum ConfigurationSingleton {
// 	instance;
// 	private static final Logger logger = Logger
// 			.getLogger(ConfigurationSingleton.class.getName());
// 
// 	private Properties props = new Properties();
// 
// 	private ConfigurationSingleton() {
// 	}
// 
// 	public void readConfigFile(String config_path) {
// 		try {
// 			InputStream input = new FileInputStream(config_path);
// 			props.load(input);
// 			input.close();
// 		} catch (IOException e) {
// 			cease(logger, e.getMessage());
// 		}
// 	}
// 
// 	public String getConfigItem(String val) {
// 		try {
// 			if (props.isEmpty()) {
// 				throw new Exception("Propery file object is empty. "
// 						+ "This likely indicates that the config singleton "
// 						+ "was not properly initialized via readConfigFile.");
// 			}
// 			if (props.getProperty(val) == null) {
// 				throw new Exception("The property " + val
// 						+ " is missing from the configurtion file.");
// 			}
// 			return props.getProperty(val);
// 		} catch (Exception e) {
// 			cease(logger, e.getMessage());
// 			return null;
// 		}
// 	}
// }


// Path: src/main/java/com/dogeops/cantilever/truss/client/apache/HTTPPostRequest.java
import java.util.ArrayList;
import java.util.List;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.protocol.HttpContext;
import org.apache.log4j.Logger;
import com.dogeops.cantilever.logreader.HTTPLogObject;
import com.dogeops.cantilever.utils.ConfigurationSingleton;

package com.dogeops.cantilever.truss.client.apache;

/* 
 * This is an extremely basic implementation until it is determined
 * how to differentiate and insert the POST entity using the config file
 */




public class HTTPPostRequest extends Thread {
	private static final Logger logger = Logger.getLogger(HTTPPostRequest.class
			.getName());
	
	private CloseableHttpClient httpClient;
    private HttpContext context;
    private HttpPost httppost;
    private HTTPLogObject http_log;