Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
MidTerm
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
9731301
MidTerm
Commits
c3a90235
Commit
c3a90235
authored
4 years ago
by
9731301
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add ResponseDataClass
parent
23f3b1b4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
188 additions
and
46 deletions
+188
-46
workspace.xml
.idea/workspace.xml
+12
-45
Parser.java
src/com/insomnia/parser/Parser.java
+1
-1
ResponseData.java
src/com/insomnia/parser/ResponseData.java
+151
-0
Saver.java
src/com/insomnia/parser/Saver.java
+24
-0
No files found.
.idea/workspace.xml
View file @
c3a90235
...
...
@@ -7,43 +7,10 @@
</component>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"f2dd20fb-7e97-49ef-9dfe-5631626d7912"
name=
"Default Changelist"
comment=
""
>
<change
afterPath=
"$PROJECT_DIR$/.idea/artifacts/Insomnia_jar.xml"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/src/META-INF/MANIFEST.MF"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/src/Run.java"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/src/com/insomnia/GUI/InsomniaGUI.java"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/src/com/insomnia/GUI/LeftPanel.java"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/src/com/insomnia/GUI/RequestPanel.java"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/src/com/insomnia/GUI/RespondPanel.java"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/src/com/insomnia/GUI/VerticalFlowLayout.java"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/src/com/insomnia/parser/Parser.java"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/src/com/insomnia/parser/RequestData.java"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/src/com/insomnia/parser/Saver.java"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/src/com/insomnia/parser/ResponseData.java"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/out/production/Insomnia/Insomnia.class"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$1.class"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$2.class"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$3.class"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$4.class"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$5.class"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$6.class"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$exitApp$1.class"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$exitApp$2.class"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$exitApp.class"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI.class"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/out/production/Insomnia/LeftPanel$1.class"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/out/production/Insomnia/LeftPanel.class"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/out/production/Insomnia/RequestPanel$1.class"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/out/production/Insomnia/RequestPanel$TextFieldHandler.class"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/out/production/Insomnia/RequestPanel.class"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/out/production/Insomnia/RespondPanel$1.class"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/out/production/Insomnia/RespondPanel.class"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/out/production/Insomnia/VerticalFlowLayout.class"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/Insomnia.java"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/InsomniaGUI.java"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/LeftPanel.java"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/RequestPanel.java"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/RespondPanel.java"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/VerticalFlowLayout.java"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/com/insomnia/parser/Parser.java"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/com/insomnia/parser/Parser.java"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/com/insomnia/parser/Saver.java"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/com/insomnia/parser/Saver.java"
afterDir=
"false"
/>
</list>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
...
...
@@ -145,7 +112,7 @@
<workItem
from=
"1590491155616"
duration=
"8322000"
/>
<workItem
from=
"1590502223611"
duration=
"8513000"
/>
<workItem
from=
"1590582948373"
duration=
"9875000"
/>
<workItem
from=
"1590600904796"
duration=
"
3653
000"
/>
<workItem
from=
"1590600904796"
duration=
"
12014
000"
/>
</task>
<servers
/>
</component>
...
...
@@ -176,22 +143,22 @@
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
x=
"402"
y=
"167"
key=
"FileChooserDialogImpl/0.0.1536.824@0.0.1536.824"
timestamp=
"1590494460700"
/>
<state
width=
"
906"
height=
"2"
key=
"GridCell.Tab.0.bottom"
timestamp=
"1590597048866
"
>
<state
width=
"
1493"
height=
"174"
key=
"GridCell.Tab.0.bottom"
timestamp=
"1590614025564
"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
width=
"
906"
height=
"2"
key=
"GridCell.Tab.0.bottom/0.0.1536.824@0.0.1536.824"
timestamp=
"1590597048866
"
/>
<state
width=
"
906"
height=
"2"
key=
"GridCell.Tab.0.center"
timestamp=
"1590597048866
"
>
<state
width=
"
1493"
height=
"174"
key=
"GridCell.Tab.0.bottom/0.0.1536.824@0.0.1536.824"
timestamp=
"1590614025564
"
/>
<state
width=
"
1493"
height=
"174"
key=
"GridCell.Tab.0.center"
timestamp=
"1590614025564
"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
width=
"
906"
height=
"2"
key=
"GridCell.Tab.0.center/0.0.1536.824@0.0.1536.824"
timestamp=
"1590597048866
"
/>
<state
width=
"
906"
height=
"2"
key=
"GridCell.Tab.0.left"
timestamp=
"1590597048866
"
>
<state
width=
"
1493"
height=
"174"
key=
"GridCell.Tab.0.center/0.0.1536.824@0.0.1536.824"
timestamp=
"1590614025564
"
/>
<state
width=
"
1493"
height=
"174"
key=
"GridCell.Tab.0.left"
timestamp=
"1590614025564
"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
width=
"
906"
height=
"2"
key=
"GridCell.Tab.0.left/0.0.1536.824@0.0.1536.824"
timestamp=
"1590597048866
"
/>
<state
width=
"
906"
height=
"2"
key=
"GridCell.Tab.0.right"
timestamp=
"1590597048866
"
>
<state
width=
"
1493"
height=
"174"
key=
"GridCell.Tab.0.left/0.0.1536.824@0.0.1536.824"
timestamp=
"1590614025564
"
/>
<state
width=
"
1493"
height=
"174"
key=
"GridCell.Tab.0.right"
timestamp=
"1590614025564
"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
<state
width=
"
906"
height=
"2"
key=
"GridCell.Tab.0.right/0.0.1536.824@0.0.1536.824"
timestamp=
"1590597048866
"
/>
<state
width=
"
1493"
height=
"174"
key=
"GridCell.Tab.0.right/0.0.1536.824@0.0.1536.824"
timestamp=
"1590614025564
"
/>
<state
x=
"249"
y=
"0"
key=
"SettingsEditor"
timestamp=
"1590496679192"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
...
...
This diff is collapsed.
Click to expand it.
src/com/insomnia/parser/Parser.java
View file @
c3a90235
...
...
@@ -5,7 +5,7 @@ import java.util.HashMap;
public
class
Parser
{
static
ArrayList
<
String
>
fixArgs
(
String
[]
args
){
public
static
ArrayList
<
String
>
fixArgs
(
String
[]
args
){
ArrayList
<
String
>
args2
=
new
ArrayList
<>();
String
f
=
""
;
for
(
String
arg
:
args
){
...
...
This diff is collapsed.
Click to expand it.
src/com/insomnia/parser/ResponseData.java
0 → 100644
View file @
c3a90235
/**
* ResponseData represents a class
*/
package
com
.
insomnia
.
parser
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.util.List
;
import
java.util.Map
;
public
class
ResponseData
{
private
RequestData
requestData
;
private
long
startTime
,
finalTime
;
private
boolean
syntaxError
=
false
;
private
String
syntaxErrorLog
=
""
;
private
boolean
successful
=
false
;
private
int
status
=
-
1
;
private
InputStream
inputStream
=
null
;
private
Map
<
String
,
List
<
String
>>
responseHeaders
;
private
String
errorMessage
=
""
;
public
ResponseData
(
RequestData
data
){
this
.
requestData
=
data
;
startTime
=
System
.
currentTimeMillis
();
}
public
ResponseData
finish
(){
finalTime
=
System
.
currentTimeMillis
();
return
this
;
}
public
int
getStatus
()
{
return
status
;
}
public
void
setResponseHeaders
(
Map
<
String
,
List
<
String
>>
responseHeaders
)
{
this
.
responseHeaders
=
responseHeaders
;
}
public
void
setSuccessful
(
boolean
successful
)
{
this
.
successful
=
successful
;
}
public
String
getErrorMessage
()
{
return
errorMessage
;
}
public
String
getSyntaxErrorLog
()
{
return
syntaxErrorLog
;
}
public
RequestData
getRequestData
()
{
return
requestData
;
}
public
Map
<
String
,
List
<
String
>>
getResponseHeaders
()
{
return
responseHeaders
;
}
public
boolean
hasSyntaxError
()
{
return
syntaxError
;
}
public
int
getResponseStatus
()
{
return
status
;
}
public
long
getFinalTime
()
{
return
finalTime
;
}
public
long
getStartTime
()
{
return
startTime
;
}
public
boolean
isSuccessful
()
{
return
successful
;
}
String
res
=
""
;
public
String
getResponseString
(){
return
res
;
}
String
convertStreamToString
(
InputStream
is
,
boolean
close
)
{
BufferedReader
reader
=
new
BufferedReader
(
new
InputStreamReader
(
is
));
StringBuilder
sb
=
new
StringBuilder
();
String
line
=
null
;
try
{
while
((
line
=
reader
.
readLine
())
!=
null
)
{
sb
.
append
(
line
);
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
close
)
{
try
{
is
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
return
sb
.
toString
();
}
public
void
setRequestData
(
RequestData
requestData
)
{
this
.
requestData
=
requestData
;
}
public
void
setFinalTime
(
long
finalTime
)
{
this
.
finalTime
=
finalTime
;
}
public
boolean
isSyntaxError
()
{
return
syntaxError
;
}
public
void
setSyntaxError
(
boolean
syntaxError
)
{
this
.
syntaxError
=
syntaxError
;
}
public
void
setSyntaxErrorLog
(
String
syntaxErrorLog
)
{
this
.
syntaxErrorLog
=
syntaxErrorLog
;
}
public
InputStream
getInputStream
()
{
return
inputStream
;
}
public
void
setInputStream
(
InputStream
inputStream
)
{
this
.
inputStream
=
inputStream
;
}
public
void
setErrorMessage
(
String
errorMessage
)
{
this
.
errorMessage
=
errorMessage
;
}
public
void
setStatus
(
int
status
)
{
this
.
status
=
status
;
}
}
This diff is collapsed.
Click to expand it.
src/com/insomnia/parser/Saver.java
View file @
c3a90235
...
...
@@ -88,6 +88,30 @@ public class Saver {
return
null
;
}
public
static
void
saveResponse
(
ResponseData
data
){
if
(!
data
.
getRequestData
().
getOutput
().
equals
(
"-null"
)){
String
fileName
;
if
(
data
.
getRequestData
().
getOutput
().
equals
(
"-t"
)){
fileName
=
"output_"
+
new
SimpleDateFormat
(
"dd_MM_yyyy"
).
format
(
new
Date
());
}
else
{
fileName
=
data
.
getRequestData
().
getOutput
();
}
File
file
=
new
File
(
getOutputDir
(),
fileName
);
try
{
FileOutputStream
outputStream
=
new
FileOutputStream
(
file
);
int
read
;
byte
[]
bytes
=
new
byte
[
1024
];
while
((
read
=
data
.
getInputStream
().
read
(
bytes
))
!=
-
1
)
{
outputStream
.
write
(
bytes
,
0
,
read
);
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
public
static
File
[]
getRequestFiles
(){
return
new
File
(
getRequestsDir
()).
listFiles
();
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment