diff --git a/mirror/README.md b/mirror/README.md deleted file mode 100644 index 37f6e99..0000000 --- a/mirror/README.md +++ /dev/null @@ -1,5 +0,0 @@ -#### About -The `mirror` servlet. Prints the list of request it received. -* `./src` the code. -* `./war/wrapper` supplements needed for `.war`. -* `./war/.war` copy this to `tomcat/webapps`. \ No newline at end of file diff --git a/mirror/build.xml b/mirror/build.xml deleted file mode 100644 index 0b59974..0000000 --- a/mirror/build.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/mirror/lib/commons-io.jar b/mirror/lib/commons-io.jar deleted file mode 100644 index 00556b1..0000000 Binary files a/mirror/lib/commons-io.jar and /dev/null differ diff --git a/mirror/lib/commons-logging-1.0.4.jar b/mirror/lib/commons-logging-1.0.4.jar deleted file mode 100644 index b73a80f..0000000 Binary files a/mirror/lib/commons-logging-1.0.4.jar and /dev/null differ diff --git a/mirror/lib/javax.servlet-3.0.0.v201112011016.jar b/mirror/lib/javax.servlet-3.0.0.v201112011016.jar deleted file mode 100644 index b135409..0000000 Binary files a/mirror/lib/javax.servlet-3.0.0.v201112011016.jar and /dev/null differ diff --git a/mirror/lib/json-20190722.jar b/mirror/lib/json-20190722.jar deleted file mode 100644 index 6db21f6..0000000 Binary files a/mirror/lib/json-20190722.jar and /dev/null differ diff --git a/mirror/lib/junit-3.8.1.jar b/mirror/lib/junit-3.8.1.jar deleted file mode 100644 index 674d71e..0000000 Binary files a/mirror/lib/junit-3.8.1.jar and /dev/null differ diff --git a/mirror/lib/misphelper.jar b/mirror/lib/misphelper.jar deleted file mode 100644 index 4e9639c..0000000 Binary files a/mirror/lib/misphelper.jar and /dev/null differ diff --git a/mirror/lib/spring-1.2.6.jar b/mirror/lib/spring-1.2.6.jar deleted file mode 100644 index f14370f..0000000 Binary files a/mirror/lib/spring-1.2.6.jar and /dev/null differ diff --git a/mirror/lib/spring-mock-1.2.6.jar b/mirror/lib/spring-mock-1.2.6.jar deleted file mode 100644 index cc4d4cd..0000000 Binary files a/mirror/lib/spring-mock-1.2.6.jar and /dev/null differ diff --git a/mirror/mirror.iml b/mirror/mirror.iml deleted file mode 100644 index 1ac42cb..0000000 --- a/mirror/mirror.iml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/mirror/src/com/olexyn/mirror/Mirror.java b/mirror/src/com/olexyn/mirror/Mirror.java deleted file mode 100644 index df7fa25..0000000 --- a/mirror/src/com/olexyn/mirror/Mirror.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.olexyn.mirror; - -import com.olexyn.misp.helper.Ride; -import com.olexyn.misp.helper.WebPrint; -import org.apache.commons.io.IOUtils; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class Mirror extends HttpServlet { - - protected static final String MISP_CLIENT_URL = "http://localhost:9090/mispclient/core"; - - - private final List list = new ArrayList<>(); - - - - private void addRequest(HttpServletRequest request){ - synchronized (list) { - StringBuffer sb = new StringBuffer(); - sb.append(request.getRequestURL().toString()); - sb.append(WebPrint.SPLIT); - sb.append(request.getMethod()); - sb.append(WebPrint.SPLIT); - sb.append(request.getQueryString()); - list.add(sb.toString()); - } - } - // ####### - // - // ####### - - @Override - public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { - - addRequest(request); - - PrintWriter print = response.getWriter(); - - print.println(""); - - print.println(""); - print.println(""); - print.println(""); - print.println("title"); - print.println(""); - print.println(""); - print.println(""); - print.println(""); - synchronized (list) { - - print.println(WebPrint.requestList(list)); - } - - - - - print.println(" "); - - - } - - - @Override - public void doPost(HttpServletRequest request, HttpServletResponse response) { - - addRequest(request); - } - - - @Override - public void doPut(HttpServletRequest request, HttpServletResponse response){ - addRequest(request); - } -} - - diff --git a/mirror/web.xml b/mirror/web.xml deleted file mode 100644 index a4e2df5..0000000 --- a/mirror/web.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - Mirror - - This is a simple web application with a source code organization - based on the recommendations of the Application Developer's Guide. - - - - Mirror - com.olexyn.mirror.Mirror - - - - Mirror - /core - - - diff --git a/mirror/web/hello.jsp b/mirror/web/hello.jsp deleted file mode 100644 index 9596088..0000000 --- a/mirror/web/hello.jsp +++ /dev/null @@ -1,23 +0,0 @@ - - -Sample Application JSP Page - - - - - - - - -
- - -

Sample Application JSP Page

-This is the output of a JSP page that is part of the Hello, World -application. -
- -<%= new String("Hello!") %> - - - diff --git a/mirror/web/images/tomcat.gif b/mirror/web/images/tomcat.gif deleted file mode 100644 index 32f7d80..0000000 Binary files a/mirror/web/images/tomcat.gif and /dev/null differ diff --git a/mirror/web/index.html b/mirror/web/index.html deleted file mode 100644 index d82bd2a..0000000 --- a/mirror/web/index.html +++ /dev/null @@ -1,25 +0,0 @@ - - -Mirror - - - - - - - - -
- - -

Mirror

-
- - - - - diff --git a/misp-fwd/README.md b/misp-fwd/README.md deleted file mode 100644 index da391f5..0000000 --- a/misp-fwd/README.md +++ /dev/null @@ -1,5 +0,0 @@ -#### About -The `mispbridge` servlet. -* `./src` the code. -* `./war/wrapper` supplements needed for `.war`. -* `./war/.war` copy this to `tomcat/webapps`. \ No newline at end of file diff --git a/misp-fwd/install-locally.sh b/misp-fwd/install-locally.sh deleted file mode 100755 index 8282387..0000000 --- a/misp-fwd/install-locally.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -version="0.1" -file="target/misp-fwd-${version}.war" -groupId="com.olexyn.misp.fwd" -artifactId="misp-fwd" - - - -mvn package -mvn install:install-file -Dfile=${file} -DgroupId=${groupId} -DartifactId=${artifactId} -Dversion=${version} -Dpackaging=war -DgeneratePom=true diff --git a/misp-fwd/misp-fwd.iml b/misp-fwd/misp-fwd.iml deleted file mode 100644 index ab636bf..0000000 --- a/misp-fwd/misp-fwd.iml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/misp-fwd/pom.xml b/misp-fwd/pom.xml deleted file mode 100644 index 1611c74..0000000 --- a/misp-fwd/pom.xml +++ /dev/null @@ -1,97 +0,0 @@ - - - - 4.0.0 - - com.olexyn.misp.fwd - misp-fwd - 0.1 - war - - misp-fwd Maven Webapp - - http://www.example.com - - - UTF-8 - - - - - - junit - junit - 4.11 - test - - - com.olexyn.misp.helper - misp-helper - 0.1 - compile - - - commons-io - commons-io - 2.6 - compile - - - org.eclipse.jetty.orbit - javax.servlet - 3.0.0.v201112011016 - compile - - - org.json - json - 20190722 - compile - - - - - - - - - - maven-clean-plugin - 3.1.0 - - - - maven-resources-plugin - 3.0.2 - - - maven-compiler-plugin - 3.8.0 - - - 11 - 11 - true - - - - maven-surefire-plugin - 2.22.1 - - - maven-war-plugin - 3.2.2 - - - maven-install-plugin - 2.5.2 - - - maven-deploy-plugin - 2.8.2 - - - - - diff --git a/misp-fwd/src/main/java/com/olexyn/misp/fwd/FwdProxy.java b/misp-fwd/src/main/java/com/olexyn/misp/fwd/FwdProxy.java deleted file mode 100644 index 07d0b01..0000000 --- a/misp-fwd/src/main/java/com/olexyn/misp/fwd/FwdProxy.java +++ /dev/null @@ -1,217 +0,0 @@ -package com.olexyn.misp.fwd; - -import com.olexyn.misp.helper.JsonHelper; -import com.olexyn.misp.helper.Ride; -import org.apache.commons.io.IOUtils; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.ObjectOutputStream; -import java.io.PrintWriter; -import java.util.HashMap; -import java.util.Map; - -public class FwdProxy extends HttpServlet { - - protected static final String MISP_CLIENT_URL = "http://localhost:9090/mispclient/core"; - - public final Map available = new HashMap<>(); - public final Map booked = new HashMap<>(); - public final Map loaded = new HashMap<>(); - - // ####### - // - // ####### - - @Override - public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { - - - final String payload = IOUtils.toString(request.getReader()); - final boolean isJson = JsonHelper.isJson(payload); - boolean hasID = false; - boolean hasRequest = false; - boolean hasData = false; - - if (isJson) { - final Ride ridePayload = new Ride(payload); - hasID = ridePayload.getID() != null; - hasRequest = ridePayload.getRequest() != null; - hasData = ridePayload.getData() != null; - } - - - if (isJson && hasID && hasRequest && hasData) { - Thread handleGetRideRequestDataThread = new Thread(() -> { - try { - handleGetRideRequestData(request, response); - } catch (IOException | InterruptedException e) { e.printStackTrace(); } - }); - handleGetRideRequestDataThread.setName("handleGetRideRequestDataThread"); - handleGetRideRequestDataThread.start(); - - } else { - Thread handleGetRequestThread = new Thread(() -> { - try { - handleGetRequest(request, response); - } catch (IOException | InterruptedException e) {e.printStackTrace(); } - }); - handleGetRequestThread.setName("handleGetRequestThread"); - handleGetRequestThread.start(); - } - - } - - - /** - * handle GET (Link) - * remove Ride from AvailableRides - * add Ride to ReservedRides - * send OK (Ride) to mispclient - * send OK (Ride) to public - */ - protected void handleGetRequest(HttpServletRequest request, HttpServletResponse response) throws IOException, InterruptedException { - final Ride ride; - - - - //final ServletInputStream in = request.getInputStream(); - final String parsedRequest = null; //new String(in.readAllBytes()); - byte[] foo =null; - try{ - ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); - ObjectOutputStream objOut = new ObjectOutputStream(byteOut); - objOut.writeObject(request); - int br =0; - foo = byteOut.toByteArray(); - objOut.close(); - byteOut.close(); - br=1; - - }catch (IOException e){ - int br =0; - } - int br =0; - - - synchronized (available) { - - while (available.size() < 1) { - available.notify(); - available.wait(); - } - // ride exists only locally, thus safe - ride = available.entrySet().iterator().next().getValue(); - // ride exists only in "available", access through which is sync, thus safe - available.remove(ride.getID()); - // needed because POST (Ride) wait()s - available.notify(); - } - - synchronized (booked) { - // ride exists only locally, thus safe - booked.put(ride.getID(), ride); - // ride exists only in "booked", access through which is sync, thus safe - ride.setRequest(parsedRequest); - // POST (Ride) wait()s - booked.notify(); - } - - synchronized (loaded) { - - while (!loaded.containsKey(ride.getID())) { - loaded.notify(); - loaded.wait(); - } - - - // CARE this is tricky - // what if ride exists in another map, e.g. "available' - // in that case illegal access is possible - // be carefull to removing ride from all other references, when adding it to "loaded". - ride.setData(loaded.remove(ride.getID()).getData()); - } - - response.setStatus(200); - final PrintWriter writer = response.getWriter(); - writer.write(ride.getData()); - writer.flush(); - writer.close(); - } - - - /** - * handle GET (Ride)(Data) - * if Ride in ForwardedRequest - * remove Ride from ForwardedRequest - * add Ride to NewData - * send OK (Ride)(Data) - * remove Ride from NewData - * add Ride to ForwardedData - * send OK (EOL) - * remove Ride from ForwardedData - * add Ride to EOL - */ - protected void handleGetRideRequestData(HttpServletRequest request, HttpServletResponse response) throws IOException, InterruptedException { - final String jsonPayload = IOUtils.toString(request.getReader()); - final Ride ride = new Ride(jsonPayload); - - synchronized (booked) { - booked.remove(ride.getID()); - } - - synchronized (loaded) { - loaded.put(ride.getID(), ride); - loaded.notify(); - } - } - - // ####### - // - // ####### - - @Override - public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { - Thread handlePostRideThread = new Thread(() -> { - try {handlePostRide(request, response); } catch (IOException | InterruptedException e) { e.printStackTrace(); } - }); - handlePostRideThread.setName("handlePostRideThread"); - handlePostRideThread.start(); - } - - - /** - * handle POST (Ride) - * add Ride to AvailableRides - */ - protected void handlePostRide(HttpServletRequest request, HttpServletResponse response) throws IOException, InterruptedException { - String jsonPayload = IOUtils.toString(request.getReader()); - final Ride ride = new Ride(jsonPayload); - - synchronized (available) { - available.put(ride.getID(), ride); - available.notify(); - } - - // ID is final/threadsafe - while (!(booked.containsKey(ride.getID()))) { - - } - - synchronized (booked) { - //booked.notify(); - //booked.wait(); - ride.setRequest(booked.get(ride.getID()).getRequest()); - } - - response.setStatus(200); - PrintWriter writer = response.getWriter(); - writer.write(ride.json()); - writer.flush(); - writer.close(); - } -} \ No newline at end of file diff --git a/misp-fwd/src/main/webapp/WEB-INF/web.xml b/misp-fwd/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 26f5142..0000000 --- a/misp-fwd/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - misp-fwd - - - misp-fwd - com.olexyn.misp.fwd.FwdProxy - - - - misp-fwd - /core - - - diff --git a/misp-fwd/src/main/webapp/images/io42630.png b/misp-fwd/src/main/webapp/images/io42630.png deleted file mode 100644 index 01d99bf..0000000 Binary files a/misp-fwd/src/main/webapp/images/io42630.png and /dev/null differ diff --git a/misp-fwd/src/main/webapp/index.jsp b/misp-fwd/src/main/webapp/index.jsp deleted file mode 100644 index 24fd5b1..0000000 --- a/misp-fwd/src/main/webapp/index.jsp +++ /dev/null @@ -1,20 +0,0 @@ - - -misp-fwd - - - - - - - - - - -
- -
-

misp-fwd

-
- - diff --git a/misp-fwd/target/classes/com/olexyn/misp/fwd/BridgeServlet.class b/misp-fwd/target/classes/com/olexyn/misp/fwd/BridgeServlet.class deleted file mode 100644 index 4dcb108..0000000 Binary files a/misp-fwd/target/classes/com/olexyn/misp/fwd/BridgeServlet.class and /dev/null differ diff --git a/misp-fwd/target/maven-archiver/pom.properties b/misp-fwd/target/maven-archiver/pom.properties deleted file mode 100644 index 73c31fc..0000000 --- a/misp-fwd/target/maven-archiver/pom.properties +++ /dev/null @@ -1,4 +0,0 @@ -#Created by Apache Maven 3.6.3 -groupId=com.olexyn.misp.fwd -artifactId=misp-fwd -version=0.1 diff --git a/misp-fwd/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/misp-fwd/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst deleted file mode 100644 index 43dc1cb..0000000 --- a/misp-fwd/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +++ /dev/null @@ -1 +0,0 @@ -com/olexyn/misp/fwd/BridgeServlet.class diff --git a/misp-fwd/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/misp-fwd/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst deleted file mode 100644 index d89a267..0000000 --- a/misp-fwd/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ /dev/null @@ -1 +0,0 @@ -/home/user/ws/idea/misp/misp-fwd/src/main/java/com/olexyn/misp/fwd/BridgeServlet.java diff --git a/misp-fwd/target/misp-fwd-0.1.war b/misp-fwd/target/misp-fwd-0.1.war deleted file mode 100644 index 098f168..0000000 Binary files a/misp-fwd/target/misp-fwd-0.1.war and /dev/null differ diff --git a/misp-fwd/target/misp-fwd-0.1/WEB-INF/classes/com/olexyn/misp/fwd/BridgeServlet.class b/misp-fwd/target/misp-fwd-0.1/WEB-INF/classes/com/olexyn/misp/fwd/BridgeServlet.class deleted file mode 100644 index 4dcb108..0000000 Binary files a/misp-fwd/target/misp-fwd-0.1/WEB-INF/classes/com/olexyn/misp/fwd/BridgeServlet.class and /dev/null differ diff --git a/misp-fwd/target/misp-fwd-0.1/WEB-INF/lib/commons-io-2.6.jar b/misp-fwd/target/misp-fwd-0.1/WEB-INF/lib/commons-io-2.6.jar deleted file mode 100644 index 00556b1..0000000 Binary files a/misp-fwd/target/misp-fwd-0.1/WEB-INF/lib/commons-io-2.6.jar and /dev/null differ diff --git a/misp-fwd/target/misp-fwd-0.1/WEB-INF/lib/javax.servlet-3.0.0.v201112011016.jar b/misp-fwd/target/misp-fwd-0.1/WEB-INF/lib/javax.servlet-3.0.0.v201112011016.jar deleted file mode 100644 index b135409..0000000 Binary files a/misp-fwd/target/misp-fwd-0.1/WEB-INF/lib/javax.servlet-3.0.0.v201112011016.jar and /dev/null differ diff --git a/misp-fwd/target/misp-fwd-0.1/WEB-INF/lib/json-20190722.jar b/misp-fwd/target/misp-fwd-0.1/WEB-INF/lib/json-20190722.jar deleted file mode 100644 index 6db21f6..0000000 Binary files a/misp-fwd/target/misp-fwd-0.1/WEB-INF/lib/json-20190722.jar and /dev/null differ diff --git a/misp-fwd/target/misp-fwd-0.1/WEB-INF/lib/misp-helper-0.1.jar b/misp-fwd/target/misp-fwd-0.1/WEB-INF/lib/misp-helper-0.1.jar deleted file mode 100644 index 74bca5b..0000000 Binary files a/misp-fwd/target/misp-fwd-0.1/WEB-INF/lib/misp-helper-0.1.jar and /dev/null differ diff --git a/misp-fwd/target/misp-fwd-0.1/WEB-INF/web.xml b/misp-fwd/target/misp-fwd-0.1/WEB-INF/web.xml deleted file mode 100644 index 9f88c1f..0000000 --- a/misp-fwd/target/misp-fwd-0.1/WEB-INF/web.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - Archetype Created Web Application - diff --git a/misp-fwd/target/misp-fwd-0.1/index.jsp b/misp-fwd/target/misp-fwd-0.1/index.jsp deleted file mode 100644 index c38169b..0000000 --- a/misp-fwd/target/misp-fwd-0.1/index.jsp +++ /dev/null @@ -1,5 +0,0 @@ - - -

Hello World!

- - diff --git a/misp-helper/install-locally.sh b/misp-helper/install-locally.sh deleted file mode 100755 index 0fe410e..0000000 --- a/misp-helper/install-locally.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -version="0.1" -file="target/misp-helper-${version}.jar" -groupId="com.olexyn.misp.helper" -artifactId="misp-helper" - - - -mvn package -mvn install:install-file -Dfile=${file} -DgroupId=${groupId} -DartifactId=${artifactId} -Dversion=${version} -Dpackaging=jar -DgeneratePom=true diff --git a/misp-helper/misp-helper.iml b/misp-helper/misp-helper.iml deleted file mode 100644 index a5ea870..0000000 --- a/misp-helper/misp-helper.iml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/misp-helper/pom.xml b/misp-helper/pom.xml deleted file mode 100644 index a23a86e..0000000 --- a/misp-helper/pom.xml +++ /dev/null @@ -1,87 +0,0 @@ - - - - 4.0.0 - - com.olexyn.misp.helper - misp-helper - 0.1 - - misp-helper - A simple misp-helper. - - http://www.example.com - - - UTF-8 - 1.11 - 1.11 - - - - - junit - junit - 3.8.1 - - - org.json - json - 20190722 - - - - - - - - - maven-clean-plugin - 3.1.0 - - - maven-site-plugin - 3.7.1 - - - maven-project-info-reports-plugin - 3.0.0 - - - - maven-resources-plugin - 3.0.2 - - - maven-compiler-plugin - 3.8.0 - - - maven-surefire-plugin - 2.22.1 - - - maven-jar-plugin - 3.0.2 - - - maven-install-plugin - 2.5.2 - - - maven-deploy-plugin - 2.8.2 - - - - - - - - - maven-project-info-reports-plugin - - - - diff --git a/misp-helper/src/main/java/com/olexyn/misp/helper/JsonHelper.java b/misp-helper/src/main/java/com/olexyn/misp/helper/JsonHelper.java deleted file mode 100644 index d8a9b4c..0000000 --- a/misp-helper/src/main/java/com/olexyn/misp/helper/JsonHelper.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.olexyn.misp.helper; - -import org.json.JSONException; -import org.json.JSONObject; - -public class JsonHelper { - - - - - public static boolean isJson(String string){ - - try{ - new JSONObject(string); - }catch (JSONException | NullPointerException e){ - return false; - } - - return true; - } -} diff --git a/misp-helper/src/main/java/com/olexyn/misp/helper/Ride.java b/misp-helper/src/main/java/com/olexyn/misp/helper/Ride.java deleted file mode 100644 index 4f693b7..0000000 --- a/misp-helper/src/main/java/com/olexyn/misp/helper/Ride.java +++ /dev/null @@ -1,139 +0,0 @@ -package com.olexyn.misp.helper; - -import org.json.JSONException; -import org.json.JSONObject; - -import java.util.Objects; - -public class Ride { - - private static long count = 0L; - - final private Long id; - private String request; - private String data; - - // FUTURE it might be possible to use a ride for many requests. - // private List requests = new ArrayList<>(); - // private Map data = new HashMap<>(); - - - public Ride() { - id = count++; - } - - public Ride(String jsonString) { - - JSONObject obj = new JSONObject(); - try { - obj = new JSONObject(jsonString); - }catch (JSONException e){ - int br = 0; - } - - - long _id; - - try { - _id = obj.getLong("id"); - }catch (JSONException e){ - _id = count++; - } - id = _id; - try{ - request = obj.getString("request"); - } catch (JSONException e){ - request = null; - } - try{ - data = obj.getString("data"); - }catch (JSONException e){ - data = null; - } - - - } - - - public Ride(JSONObject obj){ - long _id; - - try { - _id = obj.getLong("id"); - }catch (JSONException e){ - _id = count++; - } - id = _id; - try{ - request = obj.getString("request"); - } catch (JSONException e){ - request = null; - } - try{ - data = obj.getString("data"); - }catch (JSONException e){ - data = null; - } - } - - - - - - public void setRequest(String request) { - this.request = request; - } - - public void setData(String data) { - this.data = data; - } - - - - - public String getRequest() { - return this.request; - } - - public String getData() { - return this.data; - } - - public Long getID() { - return this.id; - } - - - - private String brace(String foo) { - return "\"" + foo + "\""; - } - - private String unbrace(String foo) { return foo.replace("\"", ""); } - - public String json() { - JSONObject obj = new JSONObject(); - obj.put("id", id); - obj.put("request", request); - obj.put("data",data); - return obj.toString(); - } - - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - Ride ride = (Ride) o; - return Objects.equals(id, ride.id) && Objects.equals(request, ride.request) && Objects.equals(data, ride.data); - } - - @Override - public int hashCode() { - return Objects.hash(id, request, data); - } - - -} - - diff --git a/misp-helper/src/main/java/com/olexyn/misp/helper/WebPrint.java b/misp-helper/src/main/java/com/olexyn/misp/helper/WebPrint.java deleted file mode 100644 index c6616a2..0000000 --- a/misp-helper/src/main/java/com/olexyn/misp/helper/WebPrint.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.olexyn.misp.helper; - -import java.util.List; - -public class WebPrint { - - final static public String SPLIT = "io32413445353"; - - public static String list(List list, String type) { - StringBuilder sb = new StringBuilder(); - sb.append(""); - sb.append(""); - sb.append(""); - sb.append(""); - - for (String entry : list) { - sb.append(""); - } - - return sb.toString(); - } - - - public static String requestList(List list) { - - StringBuilder sb = new StringBuilder(); - sb.append("
"); - sb.append("List: "); - sb.append(type); - sb.append("
"); - sb.append(entry); - sb.append("
"); - sb.append(""); - sb.append(""); - sb.append(""); - sb.append(""); - sb.append(""); - - for (String entry : list) { - String[] split = entry.split(SPLIT); - sb.append(""); - sb.append(""); - sb.append(""); - sb.append(""); - sb.append(""); - } - - return sb.toString(); - } - - - - -} diff --git a/misp-helper/src/main/main.iml b/misp-helper/src/main/main.iml deleted file mode 100644 index 908ad4f..0000000 --- a/misp-helper/src/main/main.iml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/misp-helper/src/site/site.xml b/misp-helper/src/site/site.xml deleted file mode 100644 index dcd7d4f..0000000 --- a/misp-helper/src/site/site.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - misp-helper - https://maven.apache.org/images/apache-maven-project.png - https://www.apache.org/ - - - - https://maven.apache.org/images/maven-logo-black-on-white.png - https://maven.apache.org/ - - - - org.apache.maven.skins - maven-fluido-skin - 1.7 - - - - - - - \ No newline at end of file diff --git a/misp-helper/src/test/java/com/olexyn/misp/helper/AppTest.java b/misp-helper/src/test/java/com/olexyn/misp/helper/AppTest.java deleted file mode 100644 index e7d8a71..0000000 --- a/misp-helper/src/test/java/com/olexyn/misp/helper/AppTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.olexyn.misp.helper; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -/** - * Unit test for simple App. - */ -public class AppTest - extends TestCase -{ - /** - * Create the test case - * - * @param testName name of the test case - */ - public AppTest( String testName ) - { - super( testName ); - } - - /** - * @return the suite of tests being tested - */ - public static Test suite() - { - return new TestSuite( AppTest.class ); - } - - /** - * Rigourous Test :-) - */ - public void testApp() - { - assertTrue( true ); - } -} diff --git a/misp-helper/src/test/test.iml b/misp-helper/src/test/test.iml deleted file mode 100644 index a0e49a3..0000000 --- a/misp-helper/src/test/test.iml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/misp-helper/target/classes/com/olexyn/misp/helper/JsonHelper.class b/misp-helper/target/classes/com/olexyn/misp/helper/JsonHelper.class deleted file mode 100644 index 6651caf..0000000 Binary files a/misp-helper/target/classes/com/olexyn/misp/helper/JsonHelper.class and /dev/null differ diff --git a/misp-helper/target/classes/com/olexyn/misp/helper/Ride.class b/misp-helper/target/classes/com/olexyn/misp/helper/Ride.class deleted file mode 100644 index e0ae665..0000000 Binary files a/misp-helper/target/classes/com/olexyn/misp/helper/Ride.class and /dev/null differ diff --git a/misp-helper/target/classes/com/olexyn/misp/helper/WebPrint.class b/misp-helper/target/classes/com/olexyn/misp/helper/WebPrint.class deleted file mode 100644 index a814146..0000000 Binary files a/misp-helper/target/classes/com/olexyn/misp/helper/WebPrint.class and /dev/null differ diff --git a/misp-helper/target/maven-archiver/pom.properties b/misp-helper/target/maven-archiver/pom.properties deleted file mode 100644 index c64fdc1..0000000 --- a/misp-helper/target/maven-archiver/pom.properties +++ /dev/null @@ -1,4 +0,0 @@ -#Created by Apache Maven 3.6.3 -version=0.1 -groupId=com.olexyn.misp.helper -artifactId=misp-helper diff --git a/misp-helper/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/misp-helper/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst deleted file mode 100644 index 292821a..0000000 --- a/misp-helper/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +++ /dev/null @@ -1,3 +0,0 @@ -com/olexyn/misp/helper/JsonHelper.class -com/olexyn/misp/helper/Ride.class -com/olexyn/misp/helper/WebPrint.class diff --git a/misp-helper/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/misp-helper/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst deleted file mode 100644 index 48af24a..0000000 --- a/misp-helper/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ /dev/null @@ -1,3 +0,0 @@ -/home/user/ws/idea/misp/misp-helper/src/main/java/com/olexyn/misp/helper/Ride.java -/home/user/ws/idea/misp/misp-helper/src/main/java/com/olexyn/misp/helper/JsonHelper.java -/home/user/ws/idea/misp/misp-helper/src/main/java/com/olexyn/misp/helper/WebPrint.java diff --git a/misp-helper/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/misp-helper/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst deleted file mode 100644 index 0e43ac5..0000000 --- a/misp-helper/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst +++ /dev/null @@ -1 +0,0 @@ -com/olexyn/misp/helper/AppTest.class diff --git a/misp-helper/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/misp-helper/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst deleted file mode 100644 index 32ed4c6..0000000 --- a/misp-helper/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst +++ /dev/null @@ -1 +0,0 @@ -/home/user/ws/idea/misp/misp-helper/src/test/java/com/olexyn/misp/helper/AppTest.java diff --git a/misp-helper/target/misp-helper-0.1.jar b/misp-helper/target/misp-helper-0.1.jar deleted file mode 100644 index 74bca5b..0000000 Binary files a/misp-helper/target/misp-helper-0.1.jar and /dev/null differ diff --git a/misp-helper/target/surefire-reports/TEST-com.olexyn.misp.helper.AppTest.xml b/misp-helper/target/surefire-reports/TEST-com.olexyn.misp.helper.AppTest.xml deleted file mode 100644 index 91fe936..0000000 --- a/misp-helper/target/surefire-reports/TEST-com.olexyn.misp.helper.AppTest.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/misp-helper/target/surefire-reports/com.olexyn.misp.helper.AppTest.txt b/misp-helper/target/surefire-reports/com.olexyn.misp.helper.AppTest.txt deleted file mode 100644 index 188d0b3..0000000 --- a/misp-helper/target/surefire-reports/com.olexyn.misp.helper.AppTest.txt +++ /dev/null @@ -1,4 +0,0 @@ -------------------------------------------------------------------------------- -Test set: com.olexyn.misp.helper.AppTest -------------------------------------------------------------------------------- -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.004 s - in com.olexyn.misp.helper.AppTest diff --git a/misp-helper/target/test-classes/com/olexyn/misp/helper/AppTest.class b/misp-helper/target/test-classes/com/olexyn/misp/helper/AppTest.class deleted file mode 100644 index 40f405d..0000000 Binary files a/misp-helper/target/test-classes/com/olexyn/misp/helper/AppTest.class and /dev/null differ diff --git a/misp-rev/install-locally.sh b/misp-rev/install-locally.sh deleted file mode 100755 index 9504c27..0000000 --- a/misp-rev/install-locally.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -version="0.1" -file="target/misp-rev-${version}.war" -groupId="com.olexyn.misp.rev" -artifactId="misp-rev" - - - -mvn package -mvn install:install-file -Dfile=${file} -DgroupId=${groupId} -DartifactId=${artifactId} -Dversion=${version} -Dpackaging=war -DgeneratePom=true diff --git a/misp-rev/misp-rev.iml b/misp-rev/misp-rev.iml deleted file mode 100644 index c73dbed..0000000 --- a/misp-rev/misp-rev.iml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/misp-rev/pom.xml b/misp-rev/pom.xml deleted file mode 100644 index eff9fc0..0000000 --- a/misp-rev/pom.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - - 4.0.0 - - com.olexyn.misp.rev - misp-rev - 0.1 - war - - misp-rev Maven Webapp - - http://www.example.com - - - UTF-8 - 1.7 - 1.7 - - - - - junit - junit - 4.11 - test - - - com.olexyn.misp.helper - misp-helper - 0.1 - compile - - - commons-io - commons-io - 2.6 - compile - - - org.eclipse.jetty.orbit - javax.servlet - 3.0.0.v201112011016 - compile - - - org.json - json - 20190722 - compile - - - - - - - - maven-clean-plugin - 3.1.0 - - - - maven-resources-plugin - 3.0.2 - - - maven-compiler-plugin - 3.8.0 - - - maven-surefire-plugin - 2.22.1 - - - maven-war-plugin - 3.2.2 - - - maven-install-plugin - 2.5.2 - - - maven-deploy-plugin - 2.8.2 - - - - - diff --git a/misp-rev/src/main/java/com/olexyn/misp/rev/ConnectionHelper.java b/misp-rev/src/main/java/com/olexyn/misp/rev/ConnectionHelper.java deleted file mode 100644 index f66d3f8..0000000 --- a/misp-rev/src/main/java/com/olexyn/misp/rev/ConnectionHelper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.olexyn.misp.rev; - -import com.olexyn.misp.helper.Ride; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.HttpURLConnection; -import java.net.URL; -import org.json.JSONObject; - -public class ConnectionHelper { - - - -} diff --git a/misp-rev/src/main/java/com/olexyn/misp/rev/Main.java b/misp-rev/src/main/java/com/olexyn/misp/rev/Main.java deleted file mode 100644 index 22843e6..0000000 --- a/misp-rev/src/main/java/com/olexyn/misp/rev/Main.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.olexyn.misp.rev; - -public class Main { - - - - public static void main(String... args){ - new RevProxy(); - } - - -} diff --git a/misp-rev/src/main/java/com/olexyn/misp/rev/RevProxy.java b/misp-rev/src/main/java/com/olexyn/misp/rev/RevProxy.java deleted file mode 100644 index c171c00..0000000 --- a/misp-rev/src/main/java/com/olexyn/misp/rev/RevProxy.java +++ /dev/null @@ -1,169 +0,0 @@ -package com.olexyn.misp.rev; - - -import com.olexyn.misp.helper.Ride; - -import java.io.BufferedReader; -import java.io.DataOutputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.HttpURLConnection; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; - - -public class RevProxy { - - protected static final String MISP_BRIDGE_URL = "http://localhost:9090/mispbridge/core"; - protected static final String APP_URL = "http://localhost:9090/mirror/core"; - - public static final int AVAILABLE_RIDES_OVERHEAD_TRIGGER = 4; - public static final int AVAILABLE_RIDES_OVERHEAD = 8; - - - public final Map available = new HashMap<>(); - public final Map booked = new HashMap<>(); - public final Map loaded = new HashMap<>(); - - - public RevProxy() { - - Thread postRideThread = new Thread(new PostRideRunnable(this)); - postRideThread.setName("postRideThread"); - postRideThread.start(); - - Thread getRequestThread = new Thread(new GetRequestRunnable(this)); - getRequestThread.setName("getRequestThread"); - getRequestThread.start(); - - Thread getRideRequestDataThread = new Thread(new GetRideRequestDataRunnable(this)); - getRideRequestDataThread.setName("getRideRequestDataThread"); - getRideRequestDataThread.start(); - } - - - void sendPostRide() throws IOException { - - final Ride ride = new Ride(); - - synchronized (available) { available.put(ride.getID(), ride); } - - final String result = send("POST", MISP_BRIDGE_URL, ride.json()); - - synchronized (available) { - available.remove(ride.getID()); - ride.setRequest(new Ride(result).getRequest()); - } - - synchronized (booked) { booked.put(ride.getID(), ride); } - } - - - void sendGetRequest(Ride ride) throws IOException { - - synchronized (booked) {booked.remove(ride.getID()); } - - final String result = send("GET", APP_URL, ride.getRequest()); - ride.setData(result); - - synchronized (loaded) {loaded.put(ride.getID(), ride); } - } - - - void sendGetRideRequestData(Ride ride) throws IOException { - - send("GET", MISP_BRIDGE_URL, ride.json()); - - synchronized (loaded) {loaded.remove(ride.getID()); } - } - - - private static String send(String method, String urlString, String body) throws IOException { - - URL url = new URL(urlString); - HttpURLConnection connection = (HttpURLConnection) url.openConnection(); - connection.setRequestMethod(method); - - connection.setDoOutput(true); - DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream()); - outputStream.writeBytes(body); - outputStream.flush(); - outputStream.close(); - - BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); - String out; - StringBuilder sb = new StringBuilder(); - while ((out = in.readLine()) != null) { sb.append(out); } - in.close(); - return sb.toString(); - } - - -} - - -class PostRideRunnable implements Runnable { - - final private RevProxy adapter; - - public PostRideRunnable(RevProxy adapter) { - this.adapter = adapter; - } - - @Override - public void run() { - while (true) { - synchronized (adapter.available) { - if (adapter.available.size() < RevProxy.AVAILABLE_RIDES_OVERHEAD_TRIGGER) { - for (int i = 0; i < RevProxy.AVAILABLE_RIDES_OVERHEAD; i++) { - try {adapter.sendPostRide();} catch (IOException ignored) {} - } - } - } - } - } -} - - -class GetRequestRunnable implements Runnable { - - final private RevProxy adapter; - - public GetRequestRunnable(RevProxy adapter) { - this.adapter = adapter; - } - - @Override - public void run() { - while (true) { - synchronized (adapter.booked) { - if (adapter.booked.size() > 0) { - final Ride ride = adapter.booked.entrySet().iterator().next().getValue(); - try { adapter.sendGetRequest(ride); } catch (IOException ignored) {} - } - } - } - } -} - -class GetRideRequestDataRunnable implements Runnable { - - final private RevProxy adapter; - - public GetRideRequestDataRunnable(RevProxy adapter) { - this.adapter = adapter; - } - - @Override - public void run() { - while (true) { - synchronized (adapter.loaded) { - if (adapter.loaded.size() > 0) { - final Ride ride = adapter.loaded.entrySet().iterator().next().getValue(); - try { adapter.sendGetRideRequestData(ride); } catch (IOException ignored) {} - } - } - } - } -} \ No newline at end of file diff --git a/misp-rev/src/main/webapp/WEB-INF/web.xml b/misp-rev/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 717dad2..0000000 --- a/misp-rev/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - misp-fwd - - - misp-rev - com.olexyn.misp.rev.RevProxy - - - - misp-rev - /core - - - diff --git a/misp-rev/src/main/webapp/images/io42630.png b/misp-rev/src/main/webapp/images/io42630.png deleted file mode 100644 index 01d99bf..0000000 Binary files a/misp-rev/src/main/webapp/images/io42630.png and /dev/null differ diff --git a/misp-rev/src/main/webapp/index.jsp b/misp-rev/src/main/webapp/index.jsp deleted file mode 100644 index d53407d..0000000 --- a/misp-rev/src/main/webapp/index.jsp +++ /dev/null @@ -1,20 +0,0 @@ - - -misp-rev - - - -
"); - sb.append("URL"); - sb.append(""); - sb.append("Method"); - sb.append(""); - sb.append("Query"); - sb.append("
"); - sb.append(split[0]); - sb.append(""); - sb.append(split[1]); - sb.append(""); - sb.append(split[2]); - sb.append("
- - - - - - -
- -
-

misp-rev

-
- - diff --git a/misp-rev/target/classes/com/olexyn/misp/rev/ConnectionHelper.class b/misp-rev/target/classes/com/olexyn/misp/rev/ConnectionHelper.class deleted file mode 100644 index 5556589..0000000 Binary files a/misp-rev/target/classes/com/olexyn/misp/rev/ConnectionHelper.class and /dev/null differ diff --git a/misp-rev/target/classes/com/olexyn/misp/rev/GetRequestRunnable.class b/misp-rev/target/classes/com/olexyn/misp/rev/GetRequestRunnable.class deleted file mode 100644 index cd40cdb..0000000 Binary files a/misp-rev/target/classes/com/olexyn/misp/rev/GetRequestRunnable.class and /dev/null differ diff --git a/misp-rev/target/classes/com/olexyn/misp/rev/GetRideRequestDataRunnable.class b/misp-rev/target/classes/com/olexyn/misp/rev/GetRideRequestDataRunnable.class deleted file mode 100644 index 514e3a3..0000000 Binary files a/misp-rev/target/classes/com/olexyn/misp/rev/GetRideRequestDataRunnable.class and /dev/null differ diff --git a/misp-rev/target/classes/com/olexyn/misp/rev/Main.class b/misp-rev/target/classes/com/olexyn/misp/rev/Main.class deleted file mode 100644 index d3a13dd..0000000 Binary files a/misp-rev/target/classes/com/olexyn/misp/rev/Main.class and /dev/null differ diff --git a/misp-rev/target/classes/com/olexyn/misp/rev/PostRideRunnable.class b/misp-rev/target/classes/com/olexyn/misp/rev/PostRideRunnable.class deleted file mode 100644 index 31d86b1..0000000 Binary files a/misp-rev/target/classes/com/olexyn/misp/rev/PostRideRunnable.class and /dev/null differ diff --git a/misp-rev/target/classes/com/olexyn/misp/rev/RevProxy.class b/misp-rev/target/classes/com/olexyn/misp/rev/RevProxy.class deleted file mode 100644 index 6f69c61..0000000 Binary files a/misp-rev/target/classes/com/olexyn/misp/rev/RevProxy.class and /dev/null differ diff --git a/misp-rev/target/maven-archiver/pom.properties b/misp-rev/target/maven-archiver/pom.properties deleted file mode 100644 index 543cc2b..0000000 --- a/misp-rev/target/maven-archiver/pom.properties +++ /dev/null @@ -1,4 +0,0 @@ -#Created by Apache Maven 3.6.3 -groupId=com.olexyn.misp.rev -artifactId=misp-rev -version=0.1 diff --git a/misp-rev/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/misp-rev/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst deleted file mode 100644 index 56a1969..0000000 --- a/misp-rev/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +++ /dev/null @@ -1,6 +0,0 @@ -com/olexyn/misp/rev/PostRideRunnable.class -com/olexyn/misp/rev/GetRideRequestDataRunnable.class -com/olexyn/misp/rev/Main.class -com/olexyn/misp/rev/ConnectionHelper.class -com/olexyn/misp/rev/GetRequestRunnable.class -com/olexyn/misp/rev/RevProxy.class diff --git a/misp-rev/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/misp-rev/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst deleted file mode 100644 index c15be10..0000000 --- a/misp-rev/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ /dev/null @@ -1,3 +0,0 @@ -/home/user/ws/idea/misp/misp-rev/src/main/java/com/olexyn/misp/rev/Main.java -/home/user/ws/idea/misp/misp-rev/src/main/java/com/olexyn/misp/rev/RevProxy.java -/home/user/ws/idea/misp/misp-rev/src/main/java/com/olexyn/misp/rev/ConnectionHelper.java diff --git a/misp-rev/target/misp-rev-0.1.war b/misp-rev/target/misp-rev-0.1.war deleted file mode 100644 index 74148ef..0000000 Binary files a/misp-rev/target/misp-rev-0.1.war and /dev/null differ diff --git a/misp-rev/target/misp-rev-0.1/WEB-INF/classes/com/olexyn/misp/rev/ConnectionHelper.class b/misp-rev/target/misp-rev-0.1/WEB-INF/classes/com/olexyn/misp/rev/ConnectionHelper.class deleted file mode 100644 index 5556589..0000000 Binary files a/misp-rev/target/misp-rev-0.1/WEB-INF/classes/com/olexyn/misp/rev/ConnectionHelper.class and /dev/null differ diff --git a/misp-rev/target/misp-rev-0.1/WEB-INF/classes/com/olexyn/misp/rev/GetRequestRunnable.class b/misp-rev/target/misp-rev-0.1/WEB-INF/classes/com/olexyn/misp/rev/GetRequestRunnable.class deleted file mode 100644 index cd40cdb..0000000 Binary files a/misp-rev/target/misp-rev-0.1/WEB-INF/classes/com/olexyn/misp/rev/GetRequestRunnable.class and /dev/null differ diff --git a/misp-rev/target/misp-rev-0.1/WEB-INF/classes/com/olexyn/misp/rev/GetRideRequestDataRunnable.class b/misp-rev/target/misp-rev-0.1/WEB-INF/classes/com/olexyn/misp/rev/GetRideRequestDataRunnable.class deleted file mode 100644 index 514e3a3..0000000 Binary files a/misp-rev/target/misp-rev-0.1/WEB-INF/classes/com/olexyn/misp/rev/GetRideRequestDataRunnable.class and /dev/null differ diff --git a/misp-rev/target/misp-rev-0.1/WEB-INF/classes/com/olexyn/misp/rev/Main.class b/misp-rev/target/misp-rev-0.1/WEB-INF/classes/com/olexyn/misp/rev/Main.class deleted file mode 100644 index d3a13dd..0000000 Binary files a/misp-rev/target/misp-rev-0.1/WEB-INF/classes/com/olexyn/misp/rev/Main.class and /dev/null differ diff --git a/misp-rev/target/misp-rev-0.1/WEB-INF/classes/com/olexyn/misp/rev/PostRideRunnable.class b/misp-rev/target/misp-rev-0.1/WEB-INF/classes/com/olexyn/misp/rev/PostRideRunnable.class deleted file mode 100644 index 31d86b1..0000000 Binary files a/misp-rev/target/misp-rev-0.1/WEB-INF/classes/com/olexyn/misp/rev/PostRideRunnable.class and /dev/null differ diff --git a/misp-rev/target/misp-rev-0.1/WEB-INF/classes/com/olexyn/misp/rev/RevProxy.class b/misp-rev/target/misp-rev-0.1/WEB-INF/classes/com/olexyn/misp/rev/RevProxy.class deleted file mode 100644 index 6f69c61..0000000 Binary files a/misp-rev/target/misp-rev-0.1/WEB-INF/classes/com/olexyn/misp/rev/RevProxy.class and /dev/null differ diff --git a/misp-rev/target/misp-rev-0.1/WEB-INF/lib/commons-io-2.6.jar b/misp-rev/target/misp-rev-0.1/WEB-INF/lib/commons-io-2.6.jar deleted file mode 100644 index 00556b1..0000000 Binary files a/misp-rev/target/misp-rev-0.1/WEB-INF/lib/commons-io-2.6.jar and /dev/null differ diff --git a/misp-rev/target/misp-rev-0.1/WEB-INF/lib/javax.servlet-3.0.0.v201112011016.jar b/misp-rev/target/misp-rev-0.1/WEB-INF/lib/javax.servlet-3.0.0.v201112011016.jar deleted file mode 100644 index b135409..0000000 Binary files a/misp-rev/target/misp-rev-0.1/WEB-INF/lib/javax.servlet-3.0.0.v201112011016.jar and /dev/null differ diff --git a/misp-rev/target/misp-rev-0.1/WEB-INF/lib/json-20190722.jar b/misp-rev/target/misp-rev-0.1/WEB-INF/lib/json-20190722.jar deleted file mode 100644 index 6db21f6..0000000 Binary files a/misp-rev/target/misp-rev-0.1/WEB-INF/lib/json-20190722.jar and /dev/null differ diff --git a/misp-rev/target/misp-rev-0.1/WEB-INF/lib/misp-helper-0.1.jar b/misp-rev/target/misp-rev-0.1/WEB-INF/lib/misp-helper-0.1.jar deleted file mode 100644 index 74bca5b..0000000 Binary files a/misp-rev/target/misp-rev-0.1/WEB-INF/lib/misp-helper-0.1.jar and /dev/null differ diff --git a/misp-rev/target/misp-rev-0.1/WEB-INF/web.xml b/misp-rev/target/misp-rev-0.1/WEB-INF/web.xml deleted file mode 100644 index 717dad2..0000000 --- a/misp-rev/target/misp-rev-0.1/WEB-INF/web.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - misp-fwd - - - misp-rev - com.olexyn.misp.rev.RevProxy - - - - misp-rev - /core - - - diff --git a/misp-rev/target/misp-rev-0.1/images/io42630.png b/misp-rev/target/misp-rev-0.1/images/io42630.png deleted file mode 100644 index 01d99bf..0000000 Binary files a/misp-rev/target/misp-rev-0.1/images/io42630.png and /dev/null differ diff --git a/misp-rev/target/misp-rev-0.1/index.jsp b/misp-rev/target/misp-rev-0.1/index.jsp deleted file mode 100644 index d53407d..0000000 --- a/misp-rev/target/misp-rev-0.1/index.jsp +++ /dev/null @@ -1,20 +0,0 @@ - - -misp-rev - - - - - - - - - - -
- -
-

misp-rev

-
- - diff --git a/mispadapter/mispadapter.iml b/mispadapter/mispadapter.iml deleted file mode 100644 index cf570e0..0000000 --- a/mispadapter/mispadapter.iml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/mispbridge/war/mispbridge.war b/mispbridge/war/mispbridge.war deleted file mode 100644 index 63a95ab..0000000 Binary files a/mispbridge/war/mispbridge.war and /dev/null differ diff --git a/mispbridge/war/wrapper/META-INF/MANIFEST.MF b/mispbridge/war/wrapper/META-INF/MANIFEST.MF deleted file mode 100644 index 4ee800d..0000000 --- a/mispbridge/war/wrapper/META-INF/MANIFEST.MF +++ /dev/null @@ -1,4 +0,0 @@ -Manifest-Version: 1.0 -Ant-Version: Apache Ant 1.6.5 -Created-By: 1.5.0_06-b05 (Sun Microsystems Inc.) - diff --git a/mispbridge/war/wrapper/META-INF/war-tracker b/mispbridge/war/wrapper/META-INF/war-tracker deleted file mode 100644 index e69de29..0000000 diff --git a/mispbridge/war/wrapper/WEB-INF/classes/com/olexyn/misp/bridge/BridgeServlet.class b/mispbridge/war/wrapper/WEB-INF/classes/com/olexyn/misp/bridge/BridgeServlet.class deleted file mode 100644 index 5d5ba21..0000000 Binary files a/mispbridge/war/wrapper/WEB-INF/classes/com/olexyn/misp/bridge/BridgeServlet.class and /dev/null differ diff --git a/mispbridge/war/wrapper/WEB-INF/classes/com/olexyn/misp/bridge/Debug.class b/mispbridge/war/wrapper/WEB-INF/classes/com/olexyn/misp/bridge/Debug.class deleted file mode 100644 index 5720d85..0000000 Binary files a/mispbridge/war/wrapper/WEB-INF/classes/com/olexyn/misp/bridge/Debug.class and /dev/null differ diff --git a/mispbridge/war/wrapper/WEB-INF/lib/commons-io.jar b/mispbridge/war/wrapper/WEB-INF/lib/commons-io.jar deleted file mode 100644 index 00556b1..0000000 Binary files a/mispbridge/war/wrapper/WEB-INF/lib/commons-io.jar and /dev/null differ diff --git a/mispbridge/war/wrapper/WEB-INF/lib/commons-logging-1.0.4.jar b/mispbridge/war/wrapper/WEB-INF/lib/commons-logging-1.0.4.jar deleted file mode 100644 index b73a80f..0000000 Binary files a/mispbridge/war/wrapper/WEB-INF/lib/commons-logging-1.0.4.jar and /dev/null differ diff --git a/mispbridge/war/wrapper/WEB-INF/lib/javax.servlet-3.0.0.v201112011016.jar b/mispbridge/war/wrapper/WEB-INF/lib/javax.servlet-3.0.0.v201112011016.jar deleted file mode 100644 index b135409..0000000 Binary files a/mispbridge/war/wrapper/WEB-INF/lib/javax.servlet-3.0.0.v201112011016.jar and /dev/null differ diff --git a/mispbridge/war/wrapper/WEB-INF/lib/json-20190722.jar b/mispbridge/war/wrapper/WEB-INF/lib/json-20190722.jar deleted file mode 100644 index 6db21f6..0000000 Binary files a/mispbridge/war/wrapper/WEB-INF/lib/json-20190722.jar and /dev/null differ diff --git a/mispbridge/war/wrapper/WEB-INF/lib/junit-3.8.1.jar b/mispbridge/war/wrapper/WEB-INF/lib/junit-3.8.1.jar deleted file mode 100644 index 674d71e..0000000 Binary files a/mispbridge/war/wrapper/WEB-INF/lib/junit-3.8.1.jar and /dev/null differ diff --git a/mispbridge/war/wrapper/WEB-INF/lib/misphelper.jar b/mispbridge/war/wrapper/WEB-INF/lib/misphelper.jar deleted file mode 100644 index e819660..0000000 Binary files a/mispbridge/war/wrapper/WEB-INF/lib/misphelper.jar and /dev/null differ diff --git a/mispbridge/war/wrapper/WEB-INF/lib/spring-1.2.6.jar b/mispbridge/war/wrapper/WEB-INF/lib/spring-1.2.6.jar deleted file mode 100644 index f14370f..0000000 Binary files a/mispbridge/war/wrapper/WEB-INF/lib/spring-1.2.6.jar and /dev/null differ diff --git a/mispbridge/war/wrapper/WEB-INF/lib/spring-mock-1.2.6.jar b/mispbridge/war/wrapper/WEB-INF/lib/spring-mock-1.2.6.jar deleted file mode 100644 index cc4d4cd..0000000 Binary files a/mispbridge/war/wrapper/WEB-INF/lib/spring-mock-1.2.6.jar and /dev/null differ diff --git a/mispbridge/war/wrapper/WEB-INF/web.xml b/mispbridge/war/wrapper/WEB-INF/web.xml deleted file mode 100644 index aa40bc5..0000000 --- a/mispbridge/war/wrapper/WEB-INF/web.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - BridgeServlet, World Application - - This is a simple web application with a source code organization - based on the recommendations of the Application Developer's Guide. - - - - BridgeServlet - com.olexyn.misp.bridge.BridgeServlet - - - - BridgeServlet - /core - - - diff --git a/mispbridge/war/wrapper/hello.jsp b/mispbridge/war/wrapper/hello.jsp deleted file mode 100644 index 9596088..0000000 --- a/mispbridge/war/wrapper/hello.jsp +++ /dev/null @@ -1,23 +0,0 @@ - - -Sample Application JSP Page - - - - - - - - -
- - -

Sample Application JSP Page

-This is the output of a JSP page that is part of the Hello, World -application. -
- -<%= new String("Hello!") %> - - - diff --git a/mispbridge/war/wrapper/images/tomcat.gif b/mispbridge/war/wrapper/images/tomcat.gif deleted file mode 100644 index 32f7d80..0000000 Binary files a/mispbridge/war/wrapper/images/tomcat.gif and /dev/null differ diff --git a/mispbridge/war/wrapper/index.html b/mispbridge/war/wrapper/index.html deleted file mode 100644 index 547492b..0000000 --- a/mispbridge/war/wrapper/index.html +++ /dev/null @@ -1,25 +0,0 @@ - - -BridgeServlet - - - - - - - - -
- - -

BridgeServlet

-
- -
    -

    This Servlet currently provides the following features: - -

  • Tunnel to hosted Application. -
- - - diff --git a/mispclient/README.md b/mispclient/README.md deleted file mode 100644 index c185fdd..0000000 --- a/mispclient/README.md +++ /dev/null @@ -1,5 +0,0 @@ -#### About -The `mispclient` servlet. -* `./src` the code. -* `./war/wrapper` supplements needed for `.war`. -* `./war/.war` copy this to `tomcat/webapps`. \ No newline at end of file diff --git a/mispclient/src/com/olexyn/misp/client/ClientServlet.java b/mispclient/src/com/olexyn/misp/client/ClientServlet.java deleted file mode 100644 index bef34ac..0000000 --- a/mispclient/src/com/olexyn/misp/client/ClientServlet.java +++ /dev/null @@ -1,208 +0,0 @@ -package com.olexyn.misp.client; - -import com.olexyn.misp.helper.Ride; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.DataOutputStream; -import java.io.IOException; -import java.io.PrintWriter; -import java.net.HttpURLConnection; -import java.util.HashMap; -import java.util.Map; - - -public class ClientServlet extends HttpServlet { - - protected static final String MISP_BRIDGE_URL = "http://localhost:9090/mispbridge/core"; - protected static final String APP_URL = "http://localhost:9090/mispclient"; - - public static final int AVAILABLE_RIDES_OVERHEAD_TRIGGER = 2; - public static final int AVAILABLE_RIDES_OVERHEAD = 4; - - - public final Map available = new HashMap<>(); - public final Map booked = new HashMap<>(); - public final Map loaded = new HashMap<>(); - - - public ClientServlet() { - - // Thread : while AvailableRides < 256 , add Ride to AvailableRides , send POST (Ride) [DONE] - Thread postRideThread = new Thread(new PostRideRunnable(this)); - postRideThread.setName("postRideThread"); - postRideThread.start(); - } - - /** - * Debugging - */ - @Override - public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { - PrintWriter print = response.getWriter(); - - print.println(""); - - print.println(""); - print.println(""); - print.println(""); - print.println("title"); - print.println(""); - print.println(""); - print.println(""); - print.println(""); - print.println(Debug.mapTables(this)); - - print.println(" "); - - - } - - /** - * Generated by Loop. - * Prepare payload for the request. - * Process the parsed response. - */ - final void sendPostRide() throws IOException, ServletException, InterruptedException { - - final Ride ride = new Ride(); - - synchronized (available) { - available.put(ride.getID(), ride); - } - - final Ride parsedRide = doSendPostRide(ride); - - synchronized (available) { - available.remove(ride.getID()); - ride.setRequest(parsedRide.getRequest()); - } - - synchronized (booked) { - booked.put(ride.getID(), ride); - } - sendGetRequest(ride); - } - - - /** - * Send POST (Ride). - * Parse response. - */ - protected Ride doSendPostRide(Ride ride) throws IOException, ServletException, InterruptedException { - // send POST (Ride) - final HttpURLConnection connection = ConnectionHelper.make("POST", MISP_BRIDGE_URL); - - connection.setDoOutput(true); - DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream()); - outputStream.writeBytes(ride.json()); - outputStream.flush(); - outputStream.close(); - - Ride rideXa= ConnectionHelper.parseRide(connection); - rideXa.setRequest("ff"); - return rideXa; - } - - - /** - * Prepare payload for the request. - * Process the parsed response. - */ - final void sendGetRequest(Ride ride) throws IOException, ServletException, InterruptedException { - - - ride.setData(doSendGetRequest(ride.getRequest())); - - synchronized (booked) { - booked.remove(ride.getID()); - } - synchronized (loaded) { - loaded.put(ride.getID(), ride); - } - - sendGetRideRequestData(ride); - } - - - /** - * Send GET (Request) to App. - * Parse response. - */ - protected String doSendGetRequest(String request) throws IOException, InterruptedException { - - // send GET (Ride) - final HttpURLConnection connection = ConnectionHelper.make("GET", APP_URL); - - connection.setDoOutput(true); - DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream()); - outputStream.writeBytes(request); - outputStream.flush(); - outputStream.close(); - - return ConnectionHelper.parseString(connection); - } - - - /** - * Prepare payload for the request. - * Process the parsed response. - */ - final protected void sendGetRideRequestData(Ride ride) throws IOException, InterruptedException { - doSendGetRideRequest(ride); - synchronized (loaded) { - loaded.remove(ride.getID()); - } - } - - - /** - * Send GET (Ride)(Request)(Data). - * Parse response. - */ - protected void doSendGetRideRequest(Ride ride) throws IOException, InterruptedException { - - HttpURLConnection connection = ConnectionHelper.make("GET", MISP_BRIDGE_URL); - - connection.setDoOutput(true); - DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream()); - outputStream.writeBytes(ride.json()); - outputStream.flush(); - outputStream.close(); - } -} - - -/** - * While AvailableRides < 256 , - * add Ride to AvailableRides , - * send POST (Ride). - */ -class PostRideRunnable implements Runnable { - - ClientServlet clientServlet; - - public PostRideRunnable(ClientServlet clientServlet) { - this.clientServlet = clientServlet; - } - - @Override - public void run() { - while (true) { - if (clientServlet.available.size() < ClientServlet.AVAILABLE_RIDES_OVERHEAD_TRIGGER) { - for (int i = 0; i < ClientServlet.AVAILABLE_RIDES_OVERHEAD; i++) { - try {clientServlet.sendPostRide();} catch (IOException | ServletException | InterruptedException e) { e.printStackTrace(); } - try { - Thread.sleep(100); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - } - } - } -} - - diff --git a/mispclient/src/com/olexyn/misp/client/Debug.java b/mispclient/src/com/olexyn/misp/client/Debug.java deleted file mode 100644 index 20b743d..0000000 --- a/mispclient/src/com/olexyn/misp/client/Debug.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.olexyn.misp.client; - -import com.olexyn.misp.helper.Ride; - -import java.util.Map; - -public class Debug { - - - public static String mapTables(ClientServlet clientServlet){ - - - StringBuilder sb = new StringBuilder(); - sb.append("

WebPrint:

"); - sb.append(mapTable(clientServlet.available, "available")); - sb.append(mapTable(clientServlet.booked, "booked")); - sb.append(mapTable(clientServlet.loaded, "loaded")); - return sb.toString(); - } - - - private static String mapTable(Map foo, String type){ - StringBuilder sb = new StringBuilder(); - sb.append("

"+type+"

"); - sb.append(""); - sb.append(""); - sb.append(""); - sb.append(""); - sb.append(""); - sb.append(""); - synchronized (foo){ - for(Map.Entry entry : foo.entrySet()){ - sb.append(""); - sb.append(""); - sb.append(""); - sb.append(""); - sb.append(""); - } - } - sb.append("
"); - sb.append("ID"); - sb.append(""); - sb.append("Request"); - sb.append(""); - sb.append("Data"); - sb.append("
"); - sb.append(entry.getValue().getID()); - sb.append(""); - sb.append(entry.getValue().getRequest()); - sb.append(""); - sb.append(entry.getValue().getData()); - sb.append("
"); - return sb.toString(); - } -} diff --git a/mispclient/war/mispclient.war b/mispclient/war/mispclient.war deleted file mode 100644 index 6babad4..0000000 Binary files a/mispclient/war/mispclient.war and /dev/null differ diff --git a/mispclient/war/wrapper/META-INF/MANIFEST.MF b/mispclient/war/wrapper/META-INF/MANIFEST.MF deleted file mode 100644 index 4ee800d..0000000 --- a/mispclient/war/wrapper/META-INF/MANIFEST.MF +++ /dev/null @@ -1,4 +0,0 @@ -Manifest-Version: 1.0 -Ant-Version: Apache Ant 1.6.5 -Created-By: 1.5.0_06-b05 (Sun Microsystems Inc.) - diff --git a/mispclient/war/wrapper/META-INF/war-tracker b/mispclient/war/wrapper/META-INF/war-tracker deleted file mode 100644 index e69de29..0000000 diff --git a/mispclient/war/wrapper/WEB-INF/classes/com/olexyn/misp/client/ClientServlet.class b/mispclient/war/wrapper/WEB-INF/classes/com/olexyn/misp/client/ClientServlet.class deleted file mode 100644 index d010879..0000000 Binary files a/mispclient/war/wrapper/WEB-INF/classes/com/olexyn/misp/client/ClientServlet.class and /dev/null differ diff --git a/mispclient/war/wrapper/WEB-INF/classes/com/olexyn/misp/client/ConnectionHelper.class b/mispclient/war/wrapper/WEB-INF/classes/com/olexyn/misp/client/ConnectionHelper.class deleted file mode 100644 index b9c4609..0000000 Binary files a/mispclient/war/wrapper/WEB-INF/classes/com/olexyn/misp/client/ConnectionHelper.class and /dev/null differ diff --git a/mispclient/war/wrapper/WEB-INF/classes/com/olexyn/misp/client/Debug.class b/mispclient/war/wrapper/WEB-INF/classes/com/olexyn/misp/client/Debug.class deleted file mode 100644 index 37c5e27..0000000 Binary files a/mispclient/war/wrapper/WEB-INF/classes/com/olexyn/misp/client/Debug.class and /dev/null differ diff --git a/mispclient/war/wrapper/WEB-INF/classes/com/olexyn/misp/client/PostRideRunnable.class b/mispclient/war/wrapper/WEB-INF/classes/com/olexyn/misp/client/PostRideRunnable.class deleted file mode 100644 index a483732..0000000 Binary files a/mispclient/war/wrapper/WEB-INF/classes/com/olexyn/misp/client/PostRideRunnable.class and /dev/null differ diff --git a/mispclient/war/wrapper/WEB-INF/lib/commons-io.jar b/mispclient/war/wrapper/WEB-INF/lib/commons-io.jar deleted file mode 100644 index 00556b1..0000000 Binary files a/mispclient/war/wrapper/WEB-INF/lib/commons-io.jar and /dev/null differ diff --git a/mispclient/war/wrapper/WEB-INF/lib/commons-logging-1.0.4.jar b/mispclient/war/wrapper/WEB-INF/lib/commons-logging-1.0.4.jar deleted file mode 100644 index b73a80f..0000000 Binary files a/mispclient/war/wrapper/WEB-INF/lib/commons-logging-1.0.4.jar and /dev/null differ diff --git a/mispclient/war/wrapper/WEB-INF/lib/javax.servlet-3.0.0.v201112011016.jar b/mispclient/war/wrapper/WEB-INF/lib/javax.servlet-3.0.0.v201112011016.jar deleted file mode 100644 index b135409..0000000 Binary files a/mispclient/war/wrapper/WEB-INF/lib/javax.servlet-3.0.0.v201112011016.jar and /dev/null differ diff --git a/mispclient/war/wrapper/WEB-INF/lib/json-20190722.jar b/mispclient/war/wrapper/WEB-INF/lib/json-20190722.jar deleted file mode 100644 index 6db21f6..0000000 Binary files a/mispclient/war/wrapper/WEB-INF/lib/json-20190722.jar and /dev/null differ diff --git a/mispclient/war/wrapper/WEB-INF/lib/junit-3.8.1.jar b/mispclient/war/wrapper/WEB-INF/lib/junit-3.8.1.jar deleted file mode 100644 index 674d71e..0000000 Binary files a/mispclient/war/wrapper/WEB-INF/lib/junit-3.8.1.jar and /dev/null differ diff --git a/mispclient/war/wrapper/WEB-INF/lib/misphelper.jar b/mispclient/war/wrapper/WEB-INF/lib/misphelper.jar deleted file mode 100644 index 4ba063b..0000000 Binary files a/mispclient/war/wrapper/WEB-INF/lib/misphelper.jar and /dev/null differ diff --git a/mispclient/war/wrapper/WEB-INF/lib/spring-1.2.6.jar b/mispclient/war/wrapper/WEB-INF/lib/spring-1.2.6.jar deleted file mode 100644 index f14370f..0000000 Binary files a/mispclient/war/wrapper/WEB-INF/lib/spring-1.2.6.jar and /dev/null differ diff --git a/mispclient/war/wrapper/WEB-INF/lib/spring-mock-1.2.6.jar b/mispclient/war/wrapper/WEB-INF/lib/spring-mock-1.2.6.jar deleted file mode 100644 index cc4d4cd..0000000 Binary files a/mispclient/war/wrapper/WEB-INF/lib/spring-mock-1.2.6.jar and /dev/null differ diff --git a/mispclient/war/wrapper/WEB-INF/web.xml b/mispclient/war/wrapper/WEB-INF/web.xml deleted file mode 100644 index fb77f55..0000000 --- a/mispclient/war/wrapper/WEB-INF/web.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - BridgeServlet, World Application - - This is a simple web application with a source code organization - based on the recommendations of the Application Developer's Guide. - - - - ClientServlet - com.olexyn.misp.client.ClientServlet - - - - ClientServlet - /core - - - diff --git a/mispclient/war/wrapper/hello.jsp b/mispclient/war/wrapper/hello.jsp deleted file mode 100644 index 9596088..0000000 --- a/mispclient/war/wrapper/hello.jsp +++ /dev/null @@ -1,23 +0,0 @@ - - -Sample Application JSP Page - - - - - - - - -
- - -

Sample Application JSP Page

-This is the output of a JSP page that is part of the Hello, World -application. -
- -<%= new String("Hello!") %> - - - diff --git a/mispclient/war/wrapper/images/tomcat.gif b/mispclient/war/wrapper/images/tomcat.gif deleted file mode 100644 index 32f7d80..0000000 Binary files a/mispclient/war/wrapper/images/tomcat.gif and /dev/null differ diff --git a/mispclient/war/wrapper/index.html b/mispclient/war/wrapper/index.html deleted file mode 100644 index 3612f57..0000000 --- a/mispclient/war/wrapper/index.html +++ /dev/null @@ -1,23 +0,0 @@ - - -ClientServlet - - - - - - - - -
- - -

ClientServlet

- -
-
    -

    This Servlet currently provides no user accessible features. - -

- - diff --git a/misphelper/aub-app/pom.xml b/misphelper/aub-app/pom.xml deleted file mode 100644 index 1281c75..0000000 --- a/misphelper/aub-app/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - 4.0.0 - - com.olexyn.app.sub - aub-app - 1.0-SNAPSHOT - war - - aub-app Maven Webapp - - http://www.example.com - - - UTF-8 - 1.7 - 1.7 - - - - - junit - junit - 4.11 - test - - - - - aub-app - - - - maven-clean-plugin - 3.1.0 - - - - maven-resources-plugin - 3.0.2 - - - maven-compiler-plugin - 3.8.0 - - - maven-surefire-plugin - 2.22.1 - - - maven-war-plugin - 3.2.2 - - - maven-install-plugin - 2.5.2 - - - maven-deploy-plugin - 2.8.2 - - - - - diff --git a/misphelper/build.xml b/misphelper/build.xml deleted file mode 100644 index 6115e80..0000000 --- a/misphelper/build.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/misphelper/pom.xml b/misphelper/pom.xml deleted file mode 100644 index 4f2b184..0000000 --- a/misphelper/pom.xml +++ /dev/null @@ -1,22 +0,0 @@ - - 4.0.0 - - com.olexyn.misp.helper - misphelper - 1.0-SNAPSHOT - - - 1.7 - 1.7 - - - - - org.json - json - 20190722 - compile - - - diff --git a/misphelper/src/main/java/com/olexyn/misp/helper/JsonHelper.java b/misphelper/src/main/java/com/olexyn/misp/helper/JsonHelper.java deleted file mode 100644 index d8a9b4c..0000000 --- a/misphelper/src/main/java/com/olexyn/misp/helper/JsonHelper.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.olexyn.misp.helper; - -import org.json.JSONException; -import org.json.JSONObject; - -public class JsonHelper { - - - - - public static boolean isJson(String string){ - - try{ - new JSONObject(string); - }catch (JSONException | NullPointerException e){ - return false; - } - - return true; - } -} diff --git a/misphelper/src/main/java/com/olexyn/misp/helper/Ride.java b/misphelper/src/main/java/com/olexyn/misp/helper/Ride.java deleted file mode 100644 index 4f693b7..0000000 --- a/misphelper/src/main/java/com/olexyn/misp/helper/Ride.java +++ /dev/null @@ -1,139 +0,0 @@ -package com.olexyn.misp.helper; - -import org.json.JSONException; -import org.json.JSONObject; - -import java.util.Objects; - -public class Ride { - - private static long count = 0L; - - final private Long id; - private String request; - private String data; - - // FUTURE it might be possible to use a ride for many requests. - // private List requests = new ArrayList<>(); - // private Map data = new HashMap<>(); - - - public Ride() { - id = count++; - } - - public Ride(String jsonString) { - - JSONObject obj = new JSONObject(); - try { - obj = new JSONObject(jsonString); - }catch (JSONException e){ - int br = 0; - } - - - long _id; - - try { - _id = obj.getLong("id"); - }catch (JSONException e){ - _id = count++; - } - id = _id; - try{ - request = obj.getString("request"); - } catch (JSONException e){ - request = null; - } - try{ - data = obj.getString("data"); - }catch (JSONException e){ - data = null; - } - - - } - - - public Ride(JSONObject obj){ - long _id; - - try { - _id = obj.getLong("id"); - }catch (JSONException e){ - _id = count++; - } - id = _id; - try{ - request = obj.getString("request"); - } catch (JSONException e){ - request = null; - } - try{ - data = obj.getString("data"); - }catch (JSONException e){ - data = null; - } - } - - - - - - public void setRequest(String request) { - this.request = request; - } - - public void setData(String data) { - this.data = data; - } - - - - - public String getRequest() { - return this.request; - } - - public String getData() { - return this.data; - } - - public Long getID() { - return this.id; - } - - - - private String brace(String foo) { - return "\"" + foo + "\""; - } - - private String unbrace(String foo) { return foo.replace("\"", ""); } - - public String json() { - JSONObject obj = new JSONObject(); - obj.put("id", id); - obj.put("request", request); - obj.put("data",data); - return obj.toString(); - } - - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - Ride ride = (Ride) o; - return Objects.equals(id, ride.id) && Objects.equals(request, ride.request) && Objects.equals(data, ride.data); - } - - @Override - public int hashCode() { - return Objects.hash(id, request, data); - } - - -} - - diff --git a/misphelper/src/main/java/com/olexyn/misp/helper/WebPrint.java b/misphelper/src/main/java/com/olexyn/misp/helper/WebPrint.java deleted file mode 100644 index c6616a2..0000000 --- a/misphelper/src/main/java/com/olexyn/misp/helper/WebPrint.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.olexyn.misp.helper; - -import java.util.List; - -public class WebPrint { - - final static public String SPLIT = "io32413445353"; - - public static String list(List list, String type) { - StringBuilder sb = new StringBuilder(); - sb.append(""); - sb.append(""); - sb.append(""); - sb.append(""); - - for (String entry : list) { - sb.append(""); - } - - return sb.toString(); - } - - - public static String requestList(List list) { - - StringBuilder sb = new StringBuilder(); - sb.append("
"); - sb.append("List: "); - sb.append(type); - sb.append("
"); - sb.append(entry); - sb.append("
"); - sb.append(""); - sb.append(""); - sb.append(""); - sb.append(""); - sb.append(""); - - for (String entry : list) { - String[] split = entry.split(SPLIT); - sb.append(""); - sb.append(""); - sb.append(""); - sb.append(""); - sb.append(""); - } - - return sb.toString(); - } - - - - -} diff --git a/misphelper/target/classes/com/olexyn/misp/helper/JsonHelper.class b/misphelper/target/classes/com/olexyn/misp/helper/JsonHelper.class deleted file mode 100644 index 6651caf..0000000 Binary files a/misphelper/target/classes/com/olexyn/misp/helper/JsonHelper.class and /dev/null differ diff --git a/misphelper/target/classes/com/olexyn/misp/helper/Ride.class b/misphelper/target/classes/com/olexyn/misp/helper/Ride.class deleted file mode 100644 index e0ae665..0000000 Binary files a/misphelper/target/classes/com/olexyn/misp/helper/Ride.class and /dev/null differ diff --git a/misphelper/target/classes/com/olexyn/misp/helper/WebPrint.class b/misphelper/target/classes/com/olexyn/misp/helper/WebPrint.class deleted file mode 100644 index a814146..0000000 Binary files a/misphelper/target/classes/com/olexyn/misp/helper/WebPrint.class and /dev/null differ diff --git a/misphelper/target/maven-archiver/pom.properties b/misphelper/target/maven-archiver/pom.properties deleted file mode 100644 index 9498243..0000000 --- a/misphelper/target/maven-archiver/pom.properties +++ /dev/null @@ -1,5 +0,0 @@ -#Generated by Maven -#Fri Apr 24 00:43:07 CEST 2020 -version=1.0-SNAPSHOT -groupId=com.olexyn.misp.helper -artifactId=misphelper diff --git a/misphelper/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/misphelper/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst deleted file mode 100644 index 292821a..0000000 --- a/misphelper/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +++ /dev/null @@ -1,3 +0,0 @@ -com/olexyn/misp/helper/JsonHelper.class -com/olexyn/misp/helper/Ride.class -com/olexyn/misp/helper/WebPrint.class diff --git a/misphelper/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/misphelper/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst deleted file mode 100644 index 6e7825e..0000000 --- a/misphelper/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ /dev/null @@ -1,3 +0,0 @@ -/home/user/ws/idea/misp/misphelper/src/main/java/com/olexyn/misp/helper/WebPrint.java -/home/user/ws/idea/misp/misphelper/src/main/java/com/olexyn/misp/helper/JsonHelper.java -/home/user/ws/idea/misp/misphelper/src/main/java/com/olexyn/misp/helper/Ride.java diff --git a/misphelper/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/misphelper/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst deleted file mode 100644 index e69de29..0000000 diff --git a/misphelper/target/misphelper-1.0-SNAPSHOT.jar b/misphelper/target/misphelper-1.0-SNAPSHOT.jar deleted file mode 100644 index 3221900..0000000 Binary files a/misphelper/target/misphelper-1.0-SNAPSHOT.jar and /dev/null differ diff --git a/mispmock/README.md b/mispmock/README.md deleted file mode 100644 index 742e46c..0000000 --- a/mispmock/README.md +++ /dev/null @@ -1,16 +0,0 @@ -#### About -* Mockup for easy debugging. - * Mock *requests* and *responses*. - * Teleport them between *actors*. -* There are 4 actors which are mocked: - * `AppMock` : the App hosted on *localhost*. - * `ClientMock` : the *mispclient* Servlet. - * `BridgeMock` : the *mispbridge* Servlet. - * `UserMock` : the user agent accessing the *mispbridge* from the internet. -* `MockSet` knows all 4 actors, all the 4 actors know `MockSet`. - * Thus all 4 actors know each other. - -
- -##### Threads in Mock - ![](threads-in-mock.png) \ No newline at end of file diff --git a/mispmock/src/com/olexyn/misp/mock/AdapterMock.java b/mispmock/src/com/olexyn/misp/mock/AdapterMock.java deleted file mode 100644 index f8cfe9b..0000000 --- a/mispmock/src/com/olexyn/misp/mock/AdapterMock.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.olexyn.misp.mock; - -import com.olexyn.misp.helper.Ride; -import com.olexyn.misp.mock.exchange.ExchangeMock; -import com.olexyn.misp.adapter.Adapter; - -import javax.servlet.ServletException; -import java.io.IOException; - - -/** - * Wraps a ClientServlet so it can be debugged easily, i.e. without running Tomcat. - */ -public class AdapterMock extends Adapter { - - private MockSet mockSet; - - - public AdapterMock(MockSet mockSet) { - super(); - mockSet.adapterMock = this; - this.mockSet = mockSet; - } - - /** - * Send POST (Ride). - * Parse response. - */ - @Override - protected Ride doSendPostRide(Ride ride) throws IOException, InterruptedException, ServletException { - - // Mock Exchange - final ExchangeMock exchange = new ExchangeMock(); - exchange.request.setMethod("POST"); - exchange.request.setContentType("application/json"); - exchange.request.setContent(ride.json().getBytes()); - - synchronized (exchange) { - // Mock POST (Ride) - exchange.notify(); - mockSet.bridgeMock.doPost(exchange.request, exchange.response); - exchange.wait(); - exchange.notify(); - } - - // handle OK (Ride)(Request) - return new Ride(exchange.response.getContentAsString()); - } - - - /** - * Send GET (Request) to App. - * Parse response. - */ - @Override - protected String doSendGetRequest(String request) throws IOException { - - // Mock Exchange - final ExchangeMock exchange = new ExchangeMock(); - - exchange.request.setMethod("GET"); - exchange.request.setContent(request.getBytes()); - - synchronized (exchange) { - // Mock GET (Request) - exchange.notify(); - mockSet.appMock.doGet(exchange.request, exchange.response); - - // handle OK (Data) - exchange.notify(); - } - - return exchange.response.getContentAsString(); - } - - - /** - * Send GET (Ride)(Request)(Data). - * Parse response. - */ - @Override - protected void doSendGetRideRequest(Ride ride) throws IOException, InterruptedException { - - // Mock Exchange - final ExchangeMock exchange = new ExchangeMock(); - exchange.request.setMethod("GET"); - exchange.request.setContentType("application/json"); - exchange.request.setContent(ride.json().getBytes()); - - synchronized (exchange) { - // Mock GET (Ride)(Request)(Data) - exchange.notify(); - mockSet.bridgeMock.doGet(exchange.request, exchange.response); - exchange.wait(); - exchange.notify(); - } - } - -} \ No newline at end of file diff --git a/mispmock/src/com/olexyn/misp/mock/AdapterRunnable.java b/mispmock/src/com/olexyn/misp/mock/AdapterRunnable.java deleted file mode 100644 index 7cf08fa..0000000 --- a/mispmock/src/com/olexyn/misp/mock/AdapterRunnable.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.olexyn.misp.mock; - -/** - * Pass the MockSet. - * Provide a Runnable. - */ -public class AdapterRunnable implements Runnable { - - private MockSet mockSet; - - public AdapterRunnable(MockSet mockSet){ - super(); - this.mockSet = mockSet; - } - - @Override - public void run() { - new AdapterMock(mockSet); - } -} diff --git a/mispmock/src/com/olexyn/misp/mock/BridgeMock.java b/mispmock/src/com/olexyn/misp/mock/BridgeMock.java deleted file mode 100644 index 4948a5c..0000000 --- a/mispmock/src/com/olexyn/misp/mock/BridgeMock.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.olexyn.misp.mock; - - -import com.olexyn.misp.mock.exchange.ExchangeMock; -import com.olexyn.misp.mock.exchange.RequestMock; -import com.olexyn.misp.bridge.BridgeServlet; - - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - -public class BridgeMock extends BridgeServlet { - - public BridgeMock(MockSet mockSet) { - super(); - mockSet.bridgeMock = this; - } - - - /** - * handle GET (Request)
- * - wait for availableRides to have an entry
- * - move move Ride to deliveredRides
- * - wait for Ride to have Data
- * - respond to the original request with Data - */ - @Override - protected void handleGetRequest(HttpServletRequest request, HttpServletResponse response) throws IOException, InterruptedException { - - final ExchangeMock exchange; - - synchronized (exchange = ((RequestMock) request).exchange) { - - super.handleGetRequest(request,response); - - exchange.notify(); - } - } - - - /** - * handle GET (Ride)(Data) - * if Ride in ForwardedRequest - * remove Ride from ForwardedRequest - * add Ride to NewData - * send OK (Ride)(Data) - * remove Ride from NewData - * add Ride to ForwardedData - * send OK (EOL) - * remove Ride from ForwardedData - * add Ride to EOL - */ - protected void handleGetRideRequestData(HttpServletRequest request, HttpServletResponse response) throws IOException, InterruptedException { - - final ExchangeMock exchange; - - synchronized (exchange = ((RequestMock) request).exchange) { - - super.handleGetRideRequestData(request,response); - - exchange.notify(); - } - } - - - /** - * handle POST (Ride) - * - wait for Ride to be booked - * - send OK to Client - */ - @Override - protected void handlePostRide(HttpServletRequest request, HttpServletResponse response) throws IOException, InterruptedException { - - final ExchangeMock exchange; - - synchronized (exchange = ((RequestMock) request).exchange) { - - super.handlePostRide(request,response); - - exchange.notify(); - } - } -} diff --git a/mispmock/src/com/olexyn/misp/mock/BridgeRunnable.java b/mispmock/src/com/olexyn/misp/mock/BridgeRunnable.java deleted file mode 100644 index 8874863..0000000 --- a/mispmock/src/com/olexyn/misp/mock/BridgeRunnable.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.olexyn.misp.mock; - -/** - * Pass the MockSet. - * Provide a Runnable. - */ -public class BridgeRunnable implements Runnable { - - MockSet mockSet; - - public BridgeRunnable(MockSet mockSet){ - super(); - this.mockSet = mockSet; - } - - @Override - public void run() { - new BridgeMock(mockSet); - } - -} diff --git a/mispmock/src/com/olexyn/misp/mock/Main.java b/mispmock/src/com/olexyn/misp/mock/Main.java deleted file mode 100644 index 5274457..0000000 --- a/mispmock/src/com/olexyn/misp/mock/Main.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.olexyn.misp.mock; - -import com.olexyn.misp.mock.actor.AppMock; -import com.olexyn.misp.mock.actor.UserMock; - -public class Main { - - - - - - public static void main(String... args){ - - MockSet mockSet = new MockSet(); - - Runnable publicRunnable = new UserMock(mockSet); - Runnable bridgeRunable = new BridgeRunnable(mockSet); - Runnable adapterRunnable = new AdapterRunnable(mockSet); - //Runnable clientRunnable = new ClientRunnable(mockSet); - Runnable appRunnable = new AppMock(mockSet); - - Thread userThread = new Thread(publicRunnable); - Thread bridgeThread = new Thread(bridgeRunable); - Thread adapterThread = new Thread(adapterRunnable); - //Thread clientThread = new Thread(clientRunnable); - Thread appThread = new Thread(appRunnable); - - userThread.setName("userThread"); - userThread.start(); - bridgeThread.setName("bridgeThread"); - bridgeThread.start(); - adapterThread.setName("adapterThread"); - adapterThread.start(); - //clientThread.setName("clientThread"); - //clientThread.start(); - appThread.setName("appThread"); - appThread.start(); - } -} - - - diff --git a/mispmock/src/com/olexyn/misp/mock/MockSet.java b/mispmock/src/com/olexyn/misp/mock/MockSet.java deleted file mode 100644 index 533a1ec..0000000 --- a/mispmock/src/com/olexyn/misp/mock/MockSet.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.olexyn.misp.mock; - -import com.olexyn.misp.mock.actor.AppMock; -import com.olexyn.misp.mock.actor.UserMock; - -public class MockSet { - public UserMock userMock; - public BridgeMock bridgeMock; - public AdapterMock adapterMock; - public AppMock appMock; -} \ No newline at end of file diff --git a/mispmock/src/com/olexyn/misp/mock/actor/ActorRunnable.java b/mispmock/src/com/olexyn/misp/mock/actor/ActorRunnable.java deleted file mode 100644 index 115db66..0000000 --- a/mispmock/src/com/olexyn/misp/mock/actor/ActorRunnable.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.olexyn.misp.mock.actor; - -import com.olexyn.misp.mock.MockSet; -import com.olexyn.misp.mock.exchange.ExchangeMock; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - - - -/** - * Generic Runnable. - * Serves as basis for Actors that are not Servlets. - */ -public abstract class ActorRunnable implements Runnable { - - - List exchanges = new ArrayList<>(); - - protected MockSet mockSet; - - - - public ActorRunnable(MockSet mockSet){ - this.mockSet = mockSet; - - } - - - - - @Override - public void run() { - // - } - - - public void processExchange(ExchangeMock exchange) throws IOException, ServletException { - - - if (exchange.request.getMethod().equalsIgnoreCase("GET")) { - doGet(exchange.request, exchange.response); - } else if (exchange.request.getMethod().equalsIgnoreCase("POST")) { - doPost(exchange.request, exchange.response); - } - } - - - public abstract void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException; - - public abstract void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException; - -} diff --git a/mispmock/src/com/olexyn/misp/mock/actor/AppMock.java b/mispmock/src/com/olexyn/misp/mock/actor/AppMock.java deleted file mode 100644 index b3463ea..0000000 --- a/mispmock/src/com/olexyn/misp/mock/actor/AppMock.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.olexyn.misp.mock.actor; - - - -import com.olexyn.misp.mock.MockSet; -import com.olexyn.misp.mock.exchange.ExchangeMock; -import com.olexyn.misp.mock.exchange.RequestMock; -import org.apache.commons.io.IOUtils; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; - -public class AppMock extends ActorRunnable { - - public AppMock(MockSet mockSet) { - super(mockSet); - mockSet.appMock = this; - } - - - @Override - public void run() { - while (true) { - - - } - } - - @Override - public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { - - RequestMock mockRequest = (RequestMock) request; - ExchangeMock exchange = mockRequest.exchange; - - synchronized (exchange) { - String parsedRequest = IOUtils.toString(request.getReader()); - - String dataString = "DATA-" + parsedRequest; - - exchange.response.setStatus(200); - PrintWriter writer = exchange.response.getWriter(); - writer.write(dataString); - writer.flush(); - writer.close(); - - exchange.notify(); - } - } - - @Override - public void doPost(HttpServletRequest request, HttpServletResponse response) { - - } -} diff --git a/mispmock/src/com/olexyn/misp/mock/actor/UserMock.java b/mispmock/src/com/olexyn/misp/mock/actor/UserMock.java deleted file mode 100644 index cb384c1..0000000 --- a/mispmock/src/com/olexyn/misp/mock/actor/UserMock.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.olexyn.misp.mock.actor; - -import com.olexyn.misp.mock.MockSet; -import com.olexyn.misp.mock.exchange.ExchangeMock; - - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - - - - -public class UserMock extends ActorRunnable { - - - - final String longRequest; - - int requestCount = 0; - - public UserMock(MockSet mockSet){ - super(mockSet); - mockSet.userMock = this; - - - StringBuilder sb = new StringBuilder(); - for (int i=0;i<100;i++){ - sb.append("foo"); - } - longRequest = sb.toString(); - - - } - - @Override - public void run() { - while (true){ - try { - sendGetRequest(); - } catch (IOException | InterruptedException e) { - e.printStackTrace(); - } - - } - } - - @Override - public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { - - } - - @Override - public void doPost(HttpServletRequest request, HttpServletResponse response) { - - } - - - - /** - * # send GET (Request) - * Generated by Loop - */ - void sendGetRequest() throws IOException, InterruptedException { - - // Mock Exchange - ExchangeMock exchange = new ExchangeMock(); - - exchange.request.setMethod("GET"); - //exchange.request.setContentType("application/json"); - - //String requestBody = longRequest+"-"+(++requestCount); - String requestBody = "REQUEST-"+(++requestCount); - String jsonString = "{\"request\":\""+requestBody+ "\"}"; - jsonString = "asdfasdfa"; - exchange.request.setContent(jsonString.getBytes()); - - synchronized (exchange){ - // Mock GET (Request) - exchange.notify(); - mockSet.bridgeMock.doGet(exchange.request,exchange.response); - exchange.wait(); - - // handle OK (Data) - String data = exchange.response.getContentAsString(); - System.out.println(data + " of "+requestBody); - exchange.notify(); - } - } - -} diff --git a/mispmock/src/com/olexyn/misp/mock/exchange/ExchangeMock.java b/mispmock/src/com/olexyn/misp/mock/exchange/ExchangeMock.java deleted file mode 100644 index 1e0c0e3..0000000 --- a/mispmock/src/com/olexyn/misp/mock/exchange/ExchangeMock.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.olexyn.misp.mock.exchange; - - -import java.util.ArrayList; -import java.util.List; - -/** - * How "exchange" mocks an exchange:
- *
- * An "exchange" corresponds to request & reply pair.
- * - i.e. a GET & OK pair.
- * Steps:
- * 1. new Exchange()
- * 2. set properties of .request
- * 3. "send" request by using exchange.notify(); recipient.doGet();
- * 4. recipient does someting with request
- * - - recipient sets proerties of .response
- * - - recipient sends reply using exchange.notify();
- * 5. "receive" response by using exchange.wait(); - */ -public class ExchangeMock { - - public static List exchangeList = new ArrayList<>(); - - - private static int next_id=0; - public int id; - - public RequestMock request =new RequestMock(this); - public ResponseMock response = new ResponseMock(this); - - public ExchangeMock(){ - id = next_id++; - exchangeList.add(this); - } - - - - - - - - - -} - - - - - diff --git a/mispmock/src/com/olexyn/misp/mock/exchange/RequestMock.java b/mispmock/src/com/olexyn/misp/mock/exchange/RequestMock.java deleted file mode 100644 index 0665303..0000000 --- a/mispmock/src/com/olexyn/misp/mock/exchange/RequestMock.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.olexyn.misp.mock.exchange; - -import org.springframework.mock.web.MockHttpServletRequest; - -import javax.servlet.*; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.Part; -import java.io.IOException; -import java.util.Collection; - -/** - * - Contains reference to ExchangeMock - * - Rest is dummy code. - */ -public class RequestMock extends MockHttpServletRequest implements HttpServletRequest { - - public final ExchangeMock exchange; - - public RequestMock(ExchangeMock exchange){ - super(); - this.exchange = exchange; - } - - @Override - public boolean authenticate(HttpServletResponse httpServletResponse) throws IOException, ServletException { - return false; - } - - @Override - public void login(String s, String s1) throws ServletException { - - } - - @Override - public void logout() throws ServletException { - - } - - @Override - public Collection getParts() throws IOException, ServletException { - return null; - } - - @Override - public Part getPart(String s) throws IOException, ServletException { - return null; - } - - @Override - public ServletContext getServletContext() { - return null; - } - - @Override - public AsyncContext startAsync() throws IllegalStateException { - return null; - } - - @Override - public AsyncContext startAsync(ServletRequest servletRequest, ServletResponse servletResponse) throws IllegalStateException { - return null; - } - - @Override - public boolean isAsyncStarted() { - return false; - } - - @Override - public boolean isAsyncSupported() { - return false; - } - - @Override - public AsyncContext getAsyncContext() { - return null; - } - - @Override - public DispatcherType getDispatcherType() { - return null; - } -} \ No newline at end of file diff --git a/mispmock/src/com/olexyn/misp/mock/exchange/ResponseMock.java b/mispmock/src/com/olexyn/misp/mock/exchange/ResponseMock.java deleted file mode 100644 index fb7ff89..0000000 --- a/mispmock/src/com/olexyn/misp/mock/exchange/ResponseMock.java +++ /dev/null @@ -1,209 +0,0 @@ -package com.olexyn.misp.mock.exchange; - - -import org.springframework.mock.web.MockHttpServletResponse; - -import javax.servlet.ServletOutputStream; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.PrintWriter; -import java.io.UnsupportedEncodingException; -import java.util.List; -import java.util.Locale; -import java.util.Set; - -/** - * - Contains reference to ExchangeMock - * - Rest is dummy code. - */ -public class ResponseMock extends MockHttpServletResponse implements HttpServletResponse { - - public ExchangeMock exchange; - - public ResponseMock(ExchangeMock exchange){ - super(); - this.exchange = exchange; - } - - - @Override - public void addCookie(Cookie cookie) { - - } - - @Override - public boolean containsHeader(String s) { - return false; - } - - @Override - public String encodeURL(String s) { - return null; - } - - @Override - public String encodeRedirectURL(String s) { - return null; - } - - @Override - public String encodeUrl(String s) { - return null; - } - - @Override - public String encodeRedirectUrl(String s) { - return null; - } - - @Override - public void sendError(int i, String s) throws IOException { - - } - - @Override - public void sendError(int i) throws IOException { - - } - - @Override - public void sendRedirect(String s) throws IOException { - - } - - @Override - public void setDateHeader(String s, long l) { - - } - - @Override - public void addDateHeader(String s, long l) { - - } - - @Override - public void setHeader(String s, String s1) { - - } - - @Override - public void addHeader(String s, String s1) { - - } - - @Override - public void setIntHeader(String s, int i) { - - } - - @Override - public void addIntHeader(String s, int i) { - - } - - @Override - public void setStatus(int i) { - - } - - @Override - public void setStatus(int i, String s) { - - } - - @Override - public int getStatus() { - return 0; - } - - @Override - public String getHeader(String s) { - return null; - } - - @Override - public List getHeaders(String s) { - return null; - } - - @Override - public Set getHeaderNames() { - return null; - } - - @Override - public String getCharacterEncoding() { - return null; - } - - @Override - public String getContentType() { - return null; - } - - @Override - public ServletOutputStream getOutputStream() { - return null; - } - - @Override - public PrintWriter getWriter() throws UnsupportedEncodingException { - return super.getWriter(); - } - - @Override - public void setCharacterEncoding(String s) { - - } - - @Override - public void setContentLength(int i) { - - } - - @Override - public void setContentType(String s) { - - } - - @Override - public void setBufferSize(int i) { - - } - - @Override - public int getBufferSize() { - return 0; - } - - @Override - public void flushBuffer() { - - } - - @Override - public void resetBuffer() { - - } - - @Override - public boolean isCommitted() { - return false; - } - - @Override - public void reset() { - - } - - @Override - public void setLocale(Locale locale) { - - } - - @Override - public Locale getLocale() { - return null; - } -} diff --git a/mispmock/threads-in-mock.png b/mispmock/threads-in-mock.png deleted file mode 100644 index af9ac6e..0000000 Binary files a/mispmock/threads-in-mock.png and /dev/null differ diff --git a/mispmock/threads-in-mock.uxf b/mispmock/threads-in-mock.uxf deleted file mode 100644 index f7e52d5..0000000 --- a/mispmock/threads-in-mock.uxf +++ /dev/null @@ -1,340 +0,0 @@ - - - 10 - - UMLClass - - 910 - 50 - 90 - 30 - - inet -lt=- - - - - UMLClass - - 680 - 50 - 100 - 30 - - webhost -lt=- -layer=-1 - - - - UMLClass - - 910 - 90 - 90 - 30 - - user -bg=#90CAF9 - - - - UMLClass - - 680 - 90 - 100 - 30 - - mispbridge -bg=#B39DDB -layer=-1 - - - - Relation - - 410 - 140 - 300 - 50 - - lt=<<<- -POST (Ride) -Generated by Loop - 280.0;20.0;10.0;20.0 - - - Relation - - 760 - 180 - 200 - 40 - - lt=<<<- -GET (Request) -fg=#1E88E5 - 10.0;20.0;180.0;20.0 - - - UMLClass - - 350 - 90 - 100 - 30 - - mispclient -bg=#B39DDB -layer=-1 - - - - Relation - - 410 - 290 - 300 - 50 - - lt=<<<- -GET (Ride)(Request) -(Data) - 280.0;20.0;10.0;20.0 - - - Relation - - 760 - 310 - 190 - 40 - - lt=<<<. -OK (Data) -fg=#1E88E5 - 170.0;20.0;10.0;20.0 - - - Relation - - 410 - 350 - 300 - 40 - - lt=<<<. -OK (Ride) - 10.0;20.0;280.0;20.0 - - - UMLClass - - 150 - 90 - 80 - 30 - - app -bg=#90CAF9 - - - - Relation - - 200 - 220 - 200 - 40 - - lt=<<<- -GET (Request) -fg=#1E88E5 - 10.0;20.0;180.0;20.0 - - - Relation - - 200 - 270 - 200 - 40 - - lt=<<<. -OK (Data) -fg=#1E88E5 - 180.0;20.0;10.0;20.0 - - - Relation - - 410 - 200 - 300 - 40 - - lt=<<<. -OK (Ride)(Request) - 10.0;20.0;280.0;20.0 - - - UMLClass - - 150 - 50 - 300 - 30 - - localhost -lt=- - - - - UMLClass - - 120 - 20 - 910 - 400 - - -lt=.. -layer=-10 - - - - Relation - - 940 - 110 - 30 - 310 - - lt=- -fg=#1E88E5 - 10.0;10.0;10.0;290.0 - - - Relation - - 180 - 110 - 30 - 310 - - lt=- -fg=#1E88E5 - 10.0;10.0;10.0;290.0 - - - UMLClass - - 930 - 200 - 40 - 130 - - -bg=#F6F6F6 -transparency=0 -layer=4 - - - - UMLClass - - 170 - 240 - 40 - 50 - - -bg=#F6F6F6 -transparency=0 -layer=4 - - - - Relation - - 720 - 110 - 30 - 310 - - lt=- -fg=#5E35B1 -layer=-4 - 10.0;10.0;10.0;290.0 - - - Relation - - 390 - 110 - 30 - 310 - - lt=- -fg=#5E35B1 -layer=-4 - 10.0;10.0;10.0;290.0 - - - UMLClass - - 380 - 160 - 40 - 210 - - -bg=#F6F6F6 -transparency=0 -layer=4 - - - - UMLClass - - 690 - 160 - 40 - 60 - - -bg=#F6F6F6 -transparency=0 -layer=4 - - - - UMLClass - - 690 - 310 - 40 - 60 - - -bg=#F6F6F6 -transparency=0 -layer=4 - - - - UMLClass - - 730 - 200 - 40 - 130 - - -bg=#F6F6F6 -transparency=0 -layer=4 - - - diff --git a/myjettyproxy/myjettyproxy.iml b/myjettyproxy/myjettyproxy.iml deleted file mode 100644 index c90834f..0000000 --- a/myjettyproxy/myjettyproxy.iml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file
"); - sb.append("URL"); - sb.append(""); - sb.append("Method"); - sb.append(""); - sb.append("Query"); - sb.append("
"); - sb.append(split[0]); - sb.append(""); - sb.append(split[1]); - sb.append(""); - sb.append(split[2]); - sb.append("