Skip to content
Snippets Groups Projects
Commit 74951720 authored by Jesper Fyhr Knudsen's avatar Jesper Fyhr Knudsen
Browse files

Add Http Request and Response parsing

parent c613695d
No related branches found
No related tags found
No related merge requests found
...@@ -2,11 +2,10 @@ ...@@ -2,11 +2,10 @@
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="057f0053-f4e8-40ac-9d01-6a2f351d655a" name="Default" comment=""> <list default="true" id="057f0053-f4e8-40ac-9d01-6a2f351d655a" name="Default" comment="">
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/octopus-commons/src/main/java/com/chaos/octopus/commons/http/SimpleServer.java" /> <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/octopus-commons/src/main/java/com/chaos/octopus/commons/core/Request.java" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/octopus-commons/src/test/java/com/chaos/octopus/commons/core/http/test/SimpleServerTest.java" /> <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/octopus-commons/src/main/java/com/chaos/octopus/commons/core/Response.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/modules.xml" afterPath="$PROJECT_DIR$/.idea/modules.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/octopus-server/src/main/java/com/chaos/octopus/server/OrchestratorImpl.java" afterPath="$PROJECT_DIR$/octopus-server/src/main/java/com/chaos/octopus/server/OrchestratorImpl.java" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/octopus-commons/src/main/java/com/chaos/octopus/commons/http/SimpleServer.java" afterPath="$PROJECT_DIR$/octopus-commons/src/main/java/com/chaos/octopus/commons/http/SimpleServer.java" />
</list> </list>
<ignored path="parent-project.iws" /> <ignored path="parent-project.iws" />
<ignored path=".idea/workspace.xml" /> <ignored path=".idea/workspace.xml" />
...@@ -45,9 +44,20 @@ ...@@ -45,9 +44,20 @@
<file leaf-file-name="OrchestratorImpl.java" pinned="false" current-in-tab="false"> <file leaf-file-name="OrchestratorImpl.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/octopus-server/src/main/java/com/chaos/octopus/server/OrchestratorImpl.java"> <entry file="file://$PROJECT_DIR$/octopus-server/src/main/java/com/chaos/octopus/server/OrchestratorImpl.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="884"> <state relative-caret-position="1037">
<caret line="92" column="20" selection-start-line="92" selection-start-column="20" selection-end-line="92" selection-end-column="20" /> <caret line="92" column="20" selection-start-line="92" selection-start-column="20" selection-end-line="92" selection-end-column="20" />
<folding /> <folding>
<element signature="n#!!doc" expanded="false" />
<element signature="imports" expanded="false" />
<element signature="e#1828#1829#0" expanded="false" />
<element signature="e#1897#1898#0" expanded="false" />
<element signature="e#2845#2846#0" expanded="false" />
<element signature="e#2892#2893#0" expanded="false" />
<element signature="e#5577#5578#0" expanded="false" />
<element signature="e#5599#5600#0" expanded="false" />
<element signature="e#6282#6283#0" expanded="false" />
<element signature="e#6315#6316#0" expanded="false" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
...@@ -74,10 +84,38 @@ ...@@ -74,10 +84,38 @@
<file leaf-file-name="SimpleServer.java" pinned="false" current-in-tab="true"> <file leaf-file-name="SimpleServer.java" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/octopus-commons/src/main/java/com/chaos/octopus/commons/http/SimpleServer.java"> <entry file="file://$PROJECT_DIR$/octopus-commons/src/main/java/com/chaos/octopus/commons/http/SimpleServer.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="136"> <state relative-caret-position="-263">
<caret line="9" column="0" selection-start-line="9" selection-start-column="0" selection-end-line="9" selection-end-column="0" /> <caret line="63" column="7" selection-start-line="63" selection-start-column="7" selection-end-line="63" selection-end-column="7" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#1076#1077#0" expanded="true" />
<element signature="e#1110#1111#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Request.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/octopus-commons/src/main/java/com/chaos/octopus/commons/core/Request.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="170">
<caret line="10" column="57" selection-start-line="10" selection-start-column="57" selection-end-line="10" selection-end-column="57" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Response.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/octopus-commons/src/main/java/com/chaos/octopus/commons/core/Response.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="170">
<caret line="10" column="23" selection-start-line="10" selection-start-column="23" selection-end-line="10" selection-end-column="23" />
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
<element signature="e#309#310#0" expanded="true" />
<element signature="e#360#361#0" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>
...@@ -91,7 +129,7 @@ ...@@ -91,7 +129,7 @@
<entry file="file://$PROJECT_DIR$/octopus-commons/src/test/java/com/chaos/octopus/commons/core/http/test/SimpleServerTest.java"> <entry file="file://$PROJECT_DIR$/octopus-commons/src/test/java/com/chaos/octopus/commons/core/http/test/SimpleServerTest.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="204"> <state relative-caret-position="204">
<caret line="12" column="13" selection-start-line="12" selection-start-column="13" selection-end-line="12" selection-end-column="13" /> <caret line="12" column="0" selection-start-line="12" selection-start-column="0" selection-end-line="12" selection-end-column="0" />
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
</folding> </folding>
...@@ -123,7 +161,6 @@ ...@@ -123,7 +161,6 @@
<component name="IdeDocumentHistory"> <component name="IdeDocumentHistory">
<option name="CHANGED_PATHS"> <option name="CHANGED_PATHS">
<list> <list>
<option value="$PROJECT_DIR$/octopus-integrationtests/src/test/java/com/chaos/octopus/integrationtests/plugin/ChaosPluginTest.java" />
<option value="$PROJECT_DIR$/octopus-commons/src/main/java/com/chaos/sdk/ChaosGateway.java" /> <option value="$PROJECT_DIR$/octopus-commons/src/main/java/com/chaos/sdk/ChaosGateway.java" />
<option value="$PROJECT_DIR$/octopus-commons/src/main/java/com/chaos/sdk/HeartbeatGateway.java" /> <option value="$PROJECT_DIR$/octopus-commons/src/main/java/com/chaos/sdk/HeartbeatGateway.java" />
<option value="$PROJECT_DIR$/octopus-commons/src/main/java/com/chaos/octopus/commons/exception/InsufficientPermissionsException.java" /> <option value="$PROJECT_DIR$/octopus-commons/src/main/java/com/chaos/octopus/commons/exception/InsufficientPermissionsException.java" />
...@@ -171,7 +208,9 @@ ...@@ -171,7 +208,9 @@
<option value="$PROJECT_DIR$/octopus-server/src/main/java/com/chaos/octopus/server/AllocationHandler.java" /> <option value="$PROJECT_DIR$/octopus-server/src/main/java/com/chaos/octopus/server/AllocationHandler.java" />
<option value="$PROJECT_DIR$/LICENSE.txt" /> <option value="$PROJECT_DIR$/LICENSE.txt" />
<option value="$PROJECT_DIR$/octopus-server/src/main/java/com/chaos/octopus/server/OrchestratorImpl.java" /> <option value="$PROJECT_DIR$/octopus-server/src/main/java/com/chaos/octopus/server/OrchestratorImpl.java" />
<option value="$PROJECT_DIR$/octopus-commons/src/main/java/com/chaos/octopus/commons/core/Response.java" />
<option value="$PROJECT_DIR$/octopus-commons/src/test/java/com/chaos/octopus/commons/core/http/test/SimpleServerTest.java" /> <option value="$PROJECT_DIR$/octopus-commons/src/test/java/com/chaos/octopus/commons/core/http/test/SimpleServerTest.java" />
<option value="$PROJECT_DIR$/octopus-commons/src/main/java/com/chaos/octopus/commons/core/Request.java" />
<option value="$PROJECT_DIR$/octopus-commons/src/main/java/com/chaos/octopus/commons/http/SimpleServer.java" /> <option value="$PROJECT_DIR$/octopus-commons/src/main/java/com/chaos/octopus/commons/http/SimpleServer.java" />
</list> </list>
</option> </option>
...@@ -652,6 +691,10 @@ ...@@ -652,6 +691,10 @@
<option name="myItemId" value="commons" /> <option name="myItemId" value="commons" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT> </PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="util" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH> </PATH>
<PATH> <PATH>
<PATH_ELEMENT> <PATH_ELEMENT>
...@@ -691,6 +734,78 @@ ...@@ -691,6 +734,78 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT> </PATH_ELEMENT>
</PATH> </PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="parent-project" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="octopus-java" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="octopus-commons" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="main" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="java" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="chaos" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="commons" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="parent-project" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="octopus-java" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="octopus-commons" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="main" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="java" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="chaos" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="commons" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="core" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH> <PATH>
<PATH_ELEMENT> <PATH_ELEMENT>
<option name="myItemId" value="parent-project" /> <option name="myItemId" value="parent-project" />
...@@ -728,18 +843,22 @@ ...@@ -728,18 +843,22 @@
<option name="myItemId" value="core" /> <option name="myItemId" value="core" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT> </PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="message" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH> </PATH>
</subPane> </subPane>
</pane> </pane>
<pane id="PackagesPane" /> <pane id="PackagesPane" />
<pane id="Scope" />
<pane id="Scratches" /> <pane id="Scratches" />
<pane id="Scope" />
</panes> </panes>
</component> </component>
<component name="PropertiesComponent"> <component name="PropertiesComponent">
<property name="last_opened_file_path" value="$USER_HOME$/.babun/cygwin/bin/git.exe" /> <property name="last_opened_file_path" value="$USER_HOME$/.babun/cygwin/bin/git.exe" />
<property name="dynamic.classpath" value="false" /> <property name="dynamic.classpath" value="false" />
<property name="settings.editor.selected.configurable" value="preferences.sourceCode.Java" /> <property name="settings.editor.selected.configurable" value="editor.preferences.appearance" />
<property name="settings.editor.splitter.proportion" value="0.2" /> <property name="settings.editor.splitter.proportion" value="0.2" />
<property name="recentsLimit" value="5" /> <property name="recentsLimit" value="5" />
<property name="last_directory_selection" value="$PROJECT_DIR$/octopus-agent/src/main/java/com/chaos/octopus/agent" /> <property name="last_directory_selection" value="$PROJECT_DIR$/octopus-agent/src/main/java/com/chaos/octopus/agent" />
...@@ -1371,48 +1490,49 @@ ...@@ -1371,48 +1490,49 @@
<workItem from="1463474130110" duration="1672000" /> <workItem from="1463474130110" duration="1672000" />
<workItem from="1466680301868" duration="4041000" /> <workItem from="1466680301868" duration="4041000" />
<workItem from="1466691045796" duration="601000" /> <workItem from="1466691045796" duration="601000" />
<workItem from="1466764339577" duration="3972000" /> <workItem from="1466764339577" duration="7277000" />
<workItem from="1467023521811" duration="6520000" />
</task> </task>
<servers /> <servers />
</component> </component>
<component name="TestHistory"> <component name="TestHistory">
<history-entry file="SimpleServerTest_nothing - 2016.06.24 at 13h 58m 48s.xml"> <history-entry file="SimpleServerTest_nothing - 2016.06.27 at 16h 14m 55s.xml">
<configuration name="SimpleServerTest.nothing" configurationId="JUnit" /> <configuration name="SimpleServerTest.nothing" configurationId="JUnit" />
</history-entry> </history-entry>
<history-entry file="SimpleServerTest_nothing - 2016.06.24 at 13h 59m 03s.xml"> <history-entry file="SimpleServerTest_nothing - 2016.06.27 at 16h 15m 59s.xml">
<configuration name="SimpleServerTest.nothing" configurationId="JUnit" /> <configuration name="SimpleServerTest.nothing" configurationId="JUnit" />
</history-entry> </history-entry>
<history-entry file="SimpleServerTest_nothing - 2016.06.24 at 13h 59m 17s.xml"> <history-entry file="SimpleServerTest_nothing - 2016.06.27 at 16h 25m 08s.xml">
<configuration name="SimpleServerTest.nothing" configurationId="JUnit" /> <configuration name="SimpleServerTest.nothing" configurationId="JUnit" />
</history-entry> </history-entry>
<history-entry file="SimpleServerTest_nothing - 2016.06.24 at 14h 00m 10s.xml"> <history-entry file="SimpleServerTest_nothing - 2016.06.27 at 16h 28m 56s.xml">
<configuration name="SimpleServerTest.nothing" configurationId="JUnit" /> <configuration name="SimpleServerTest.nothing" configurationId="JUnit" />
</history-entry> </history-entry>
<history-entry file="SimpleServerTest_nothing - 2016.06.24 at 14h 01m 18s.xml"> <history-entry file="SimpleServerTest_nothing - 2016.06.27 at 16h 35m 22s.xml">
<configuration name="SimpleServerTest.nothing" configurationId="JUnit" /> <configuration name="SimpleServerTest.nothing" configurationId="JUnit" />
</history-entry> </history-entry>
<history-entry file="SimpleServerTest_nothing - 2016.06.24 at 14h 02m 07s.xml"> <history-entry file="SimpleServerTest_nothing - 2016.06.27 at 16h 36m 22s.xml">
<configuration name="SimpleServerTest.nothing" configurationId="JUnit" /> <configuration name="SimpleServerTest.nothing" configurationId="JUnit" />
</history-entry> </history-entry>
<history-entry file="SimpleServerTest_nothing - 2016.06.24 at 14h 02m 25s.xml"> <history-entry file="SimpleServerTest_nothing - 2016.06.27 at 16h 37m 07s.xml">
<configuration name="SimpleServerTest.nothing" configurationId="JUnit" /> <configuration name="SimpleServerTest.nothing" configurationId="JUnit" />
</history-entry> </history-entry>
<history-entry file="SimpleServerTest_nothing - 2016.06.24 at 14h 03m 14s.xml"> <history-entry file="SimpleServerTest_nothing - 2016.06.27 at 16h 37m 36s.xml">
<configuration name="SimpleServerTest.nothing" configurationId="JUnit" /> <configuration name="SimpleServerTest.nothing" configurationId="JUnit" />
</history-entry> </history-entry>
<history-entry file="SimpleServerTest_nothing - 2016.06.24 at 14h 03m 48s.xml"> <history-entry file="SimpleServerTest_nothing - 2016.06.27 at 16h 41m 18s.xml">
<configuration name="SimpleServerTest.nothing" configurationId="JUnit" /> <configuration name="SimpleServerTest.nothing" configurationId="JUnit" />
</history-entry> </history-entry>
<history-entry file="SimpleServerTest_nothing - 2016.06.24 at 14h 04m 14s.xml"> <history-entry file="SimpleServerTest_nothing - 2016.06.27 at 16h 42m 04s.xml">
<configuration name="SimpleServerTest.nothing" configurationId="JUnit" /> <configuration name="SimpleServerTest.nothing" configurationId="JUnit" />
</history-entry> </history-entry>
</component> </component>
<component name="TimeTrackingManager"> <component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="13280000" /> <option name="totallyTimeSpent" value="23105000" />
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="-8" y="-8" width="1936" height="1056" extended-state="6" /> <frame x="-8" y="-8" width="1936" height="1056" extended-state="6" />
<editor active="false" /> <editor active="true" />
<layout> <layout>
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" /> <window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" /> <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
...@@ -1422,7 +1542,7 @@ ...@@ -1422,7 +1542,7 @@
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="11" side_tool="true" content_ui="tabs" /> <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="11" side_tool="true" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.096875" sideWeight="0.4973404" order="4" side_tool="false" content_ui="tabs" /> <window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.096875" sideWeight="0.4973404" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" /> <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.2410148" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.2410148" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" /> <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
<window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" /> <window_info id="Designer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
...@@ -1456,7 +1576,7 @@ ...@@ -1456,7 +1576,7 @@
</component> </component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager> <breakpoint-manager>
<option name="time" value="5" /> <option name="time" value="6" />
</breakpoint-manager> </breakpoint-manager>
<watches-manager /> <watches-manager />
</component> </component>
...@@ -1465,20 +1585,6 @@ ...@@ -1465,20 +1585,6 @@
<option name="FILTER_TARGETS" value="false" /> <option name="FILTER_TARGETS" value="false" />
</component> </component>
<component name="editorHistoryManager"> <component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/octopus-commons/src/test/java/com/chaos/sdk/test/MockGateway.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="4" column="28" selection-start-line="4" selection-start-column="28" selection-end-line="4" selection-end-column="28" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/octopus-agent/src/main/java/com/chaos/octopus/agent/OrchestratorProxy.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="14" column="13" selection-start-line="14" selection-start-column="13" selection-end-line="14" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/octopus-commons/src/main/java/com/chaos/octopus/commons/core/TaskState.java"> <entry file="file://$PROJECT_DIR$/octopus-commons/src/main/java/com/chaos/octopus/commons/core/TaskState.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0"> <state relative-caret-position="0">
...@@ -1696,7 +1802,6 @@ ...@@ -1696,7 +1802,6 @@
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0"> <state relative-caret-position="0">
<caret line="11" column="13" selection-start-line="11" selection-start-column="13" selection-end-line="11" selection-end-column="13" /> <caret line="11" column="13" selection-start-line="11" selection-start-column="13" selection-end-line="11" selection-end-column="13" />
<folding />
</state> </state>
</provider> </provider>
</entry> </entry>
...@@ -1725,7 +1830,6 @@ ...@@ -1725,7 +1830,6 @@
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0"> <state relative-caret-position="0">
<caret line="10" column="46" selection-start-line="10" selection-start-column="46" selection-end-line="10" selection-end-column="46" /> <caret line="10" column="46" selection-start-line="10" selection-start-column="46" selection-end-line="10" selection-end-column="46" />
<folding />
</state> </state>
</provider> </provider>
</entry> </entry>
...@@ -1768,9 +1872,6 @@ ...@@ -1768,9 +1872,6 @@
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="170"> <state relative-caret-position="170">
<caret line="36" column="0" selection-start-line="36" selection-start-column="0" selection-end-line="36" selection-end-column="0" /> <caret line="36" column="0" selection-start-line="36" selection-start-column="0" selection-end-line="36" selection-end-column="0" />
<folding>
<element signature="imports" expanded="false" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
...@@ -1823,37 +1924,73 @@ ...@@ -1823,37 +1924,73 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/octopus-server/src/main/java/com/chaos/octopus/server/OrchestratorImpl.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1037">
<caret line="92" column="20" selection-start-line="92" selection-start-column="20" selection-end-line="92" selection-end-column="20" />
<folding>
<element signature="n#!!doc" expanded="false" />
<element signature="imports" expanded="false" />
<element signature="e#1828#1829#0" expanded="false" />
<element signature="e#1897#1898#0" expanded="false" />
<element signature="e#2845#2846#0" expanded="false" />
<element signature="e#2892#2893#0" expanded="false" />
<element signature="e#5577#5578#0" expanded="false" />
<element signature="e#5599#5600#0" expanded="false" />
<element signature="e#6282#6283#0" expanded="false" />
<element signature="e#6315#6316#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/octopus-commons/src/main/java/com/chaos/octopus/commons/util/StreamUtilities.java"> <entry file="file://$PROJECT_DIR$/octopus-commons/src/main/java/com/chaos/octopus/commons/util/StreamUtilities.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="479"> <state relative-caret-position="102">
<caret line="38" column="18" selection-start-line="38" selection-start-column="18" selection-end-line="38" selection-end-column="18" /> <caret line="14" column="21" selection-start-line="14" selection-start-column="17" selection-end-line="14" selection-end-column="21" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/octopus-commons/src/main/java/com/chaos/octopus/commons/core/Response.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="170">
<caret line="10" column="23" selection-start-line="10" selection-start-column="23" selection-end-line="10" selection-end-column="23" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#309#310#0" expanded="true" />
<element signature="e#360#361#0" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/octopus-commons/src/test/java/com/chaos/octopus/commons/core/http/test/SimpleServerTest.java"> <entry file="file://$PROJECT_DIR$/octopus-commons/src/test/java/com/chaos/octopus/commons/core/http/test/SimpleServerTest.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="204"> <state relative-caret-position="204">
<caret line="12" column="13" selection-start-line="12" selection-start-column="13" selection-end-line="12" selection-end-column="13" /> <caret line="12" column="0" selection-start-line="12" selection-start-column="0" selection-end-line="12" selection-end-column="0" />
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/octopus-server/src/main/java/com/chaos/octopus/server/OrchestratorImpl.java"> <entry file="file://$PROJECT_DIR$/octopus-commons/src/main/java/com/chaos/octopus/commons/core/Request.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="884"> <state relative-caret-position="170">
<caret line="92" column="20" selection-start-line="92" selection-start-column="20" selection-end-line="92" selection-end-column="20" /> <caret line="10" column="57" selection-start-line="10" selection-start-column="57" selection-end-line="10" selection-end-column="57" />
<folding /> <folding>
<element signature="imports" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/octopus-commons/src/main/java/com/chaos/octopus/commons/http/SimpleServer.java"> <entry file="file://$PROJECT_DIR$/octopus-commons/src/main/java/com/chaos/octopus/commons/http/SimpleServer.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="136"> <state relative-caret-position="-263">
<caret line="9" column="0" selection-start-line="9" selection-start-column="0" selection-end-line="9" selection-end-column="0" /> <caret line="63" column="7" selection-start-line="63" selection-start-column="7" selection-end-line="63" selection-end-column="7" />
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
<element signature="e#1076#1077#0" expanded="true" />
<element signature="e#1110#1111#0" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>
......
package com.chaos.octopus.commons.core;
import java.util.HashMap;
import java.util.Map;
/**
* Created by Jesper on 27-06-2016.
*/
public class Request {
public String method;
public Map<String, String> queryString = new HashMap<>();
}
package com.chaos.octopus.commons.core;
import com.google.gson.Gson;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Jesper on 27-06-2016.
*/
public class Response {
private static Gson _json = new Gson();
public List<Result> Results = new ArrayList<>();
public String toJson(){
return _json.toJson(this, Response.class);
}
public class Result {
public List<String> Keys = new ArrayList<>();
}
}
package com.chaos.octopus.commons.http; package com.chaos.octopus.commons.http;
import com.chaos.octopus.commons.core.Request;
import com.chaos.octopus.commons.core.Response;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.*; import java.net.*;
import java.util.HashMap;
import java.util.Map;
/** /**
* Created by Jesper on 23-06-2016. * Created by Jesper on 23-06-2016.
*/ */
public class SimpleServer implements Runnable{ public class SimpleServer implements Runnable{
public boolean _isRunning = true; private boolean _isRunning = true;
private ServerSocket _serverSocket; private ServerSocket _serverSocket;
public SimpleServer(){ public SimpleServer(){
...@@ -19,27 +25,48 @@ public class SimpleServer implements Runnable{ ...@@ -19,27 +25,48 @@ public class SimpleServer implements Runnable{
} }
} }
public void stop(){
_isRunning = false;
try {
_serverSocket.close();
} catch (IOException e) { }
}
@Override @Override
public void run() { public void run() {
while (_isRunning) { while (_isRunning) {
try(Socket socket = _serverSocket.accept()){ try(Socket socket = _serverSocket.accept()){
new HttpRequestHander(socket).invoke(); new HttpRequestHandler(socket).invoke();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
} }
private class HttpRequestHander { private class HttpRequestHandler {
private Socket socket; private Socket socket;
public HttpRequestHander(Socket socket) { public HttpRequestHandler(Socket socket) {
this.socket = socket; this.socket = socket;
} }
public void invoke() throws IOException { public void invoke() throws IOException {
while(socket.getInputStream().available() == 0); while(socket.getInputStream().available() == 0);
Request requestString = parseRequest();
Response res = new Response();
Response.Result result = res.new Result();
res.Results.add(result);
for (String val : requestString.queryString.values()) {
result.Keys.add(val);
}
SendResponse(res);
}
private Request parseRequest() throws IOException {
String requestString = ""; String requestString = "";
while(socket.getInputStream().available() != 0){ while(socket.getInputStream().available() != 0){
...@@ -49,11 +76,33 @@ public class SimpleServer implements Runnable{ ...@@ -49,11 +76,33 @@ public class SimpleServer implements Runnable{
requestString += new String(buffer); requestString += new String(buffer);
} }
//System.out.println(requestString); Request request = new Request();
SendResponse("{\"Hello\":\"World\"}"); request.method = "GET";
request.queryString = parseQueryString(requestString);
return request;
}
private Map<String, String> parseQueryString(String requestString) throws UnsupportedEncodingException {
String query = requestString.substring(6, requestString.indexOf("HTTP"));
query = URLDecoder.decode(query.trim(), "UTF-8");
Map<String, String> parameters = new HashMap<>();
if("".equals(query)) return parameters;
for (String pair : query.split("&")) {
String key = pair.split("=")[0];
String value = pair.split("=")[1];
parameters.put(key, value);
}
return parameters;
} }
private void SendResponse(String content) throws IOException { private void SendResponse(Response response) throws IOException {
String content = response.toJson();
byte[] contentBytes = content.getBytes(); byte[] contentBytes = content.getBytes();
String responseString = "HTTP/1.x 200 OK\n" + String responseString = "HTTP/1.x 200 OK\n" +
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment