Commit cfa10ffe cfa10ffe0301792a7cdebbabde178c05028db0b6 by Christian Gerdes

Skapat en servlet istället som heter OraMonREST som inte behöver

kompileras (jsp sidor kräver en jdk installerad). Tog även ner jetty
9.2.9 som funkar med jre7. 
1 parent 58fad132
/readme.txt
/OraMonREST.class
java -jar jetty-runner-9.2.9.v20150224.jar --log access.log --out systemout.log JavaMonWeb.war
pause
\ No newline at end of file
java -jar jetty-runner-9.3.7.v20160115.jar --log access.log --out systemout.log JavaMonWeb.war
pause
\ No newline at end of file
......
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import se.lil.om.Registry;
/**
* Servlet implementation class OraMonREST
*/
@WebServlet(description = "REST API for OraMon", urlPatterns = { "/OraMonREST" })
public class OraMonREST extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public OraMonREST() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("application/json");
StringBuffer sb = new StringBuffer();
if(request.getParameterMap().containsKey("connectionString")) {
// We have a connection string, find the monitor or create it and call getData() on the monitor
// Check that we have a valid connection string
String[] conStrParamArray = request.getParameter("connectionString").split(":");
if(conStrParamArray.length != 5) {
// Error, we need 3 parts in the con string
response.sendError(HttpServletResponse.SC_BAD_REQUEST, "connectionString needs to be in format host:port:sid:username:password");
return;
}
String conStr = "jdbc:oracle:thin:@" + conStrParamArray[0] + ":" + conStrParamArray[1] + ":" + conStrParamArray[2];
String userStr = conStrParamArray[3];
String passStr = conStrParamArray[4];
} else {
// No input, just return the list of monitors
sb.append("{\"count\":" + Registry.getList().size() + "}");
}
PrintWriter out = response.getWriter();
out.println(sb.toString());
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
}
/**
* @see HttpServlet#doPut(HttpServletRequest, HttpServletResponse)
*/
protected void doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
}
/**
* @see HttpServlet#doDelete(HttpServletRequest, HttpServletResponse)
*/
protected void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
}
/**
* @see HttpServlet#doHead(HttpServletRequest, HttpServletResponse)
*/
protected void doHead(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
}
}