Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CONF
Project
Project
Details
Activity
Releases
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UvA
CONF
Commits
a7f2ee92
Commit
a7f2ee92
authored
Jul 14, 2020
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed accept headers
parent
1a02d6fb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
28 deletions
+30
-28
nginx-service.yaml
k8s/CONF/nginx-service.yaml
+3
-0
CredentialApiController.java
...ain/java/nl/uva/sne/drip/api/CredentialApiController.java
+7
-8
ToscaTemplateApiController.java
.../java/nl/uva/sne/drip/api/ToscaTemplateApiController.java
+20
-20
No files found.
k8s/CONF/nginx-service.yaml
View file @
a7f2ee92
...
@@ -12,6 +12,9 @@ spec:
...
@@ -12,6 +12,9 @@ spec:
nodePort
:
30001
nodePort
:
30001
protocol
:
TCP
protocol
:
TCP
name
:
https
name
:
https
-
port
:
80
protocol
:
TCP
name
:
http
selector
:
selector
:
io.kompose.service
:
nginx
io.kompose.service
:
nginx
status
:
status
:
...
...
manager/src/main/java/nl/uva/sne/drip/api/CredentialApiController.java
View file @
a7f2ee92
...
@@ -15,7 +15,6 @@ import org.springframework.web.bind.annotation.RequestBody;
...
@@ -15,7 +15,6 @@ import org.springframework.web.bind.annotation.RequestBody;
import
javax.validation.Valid
;
import
javax.validation.Valid
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.List
;
import
java.util.List
;
import
java.util.logging.Level
;
import
javax.crypto.BadPaddingException
;
import
javax.crypto.BadPaddingException
;
import
javax.crypto.IllegalBlockSizeException
;
import
javax.crypto.IllegalBlockSizeException
;
import
javax.crypto.NoSuchPaddingException
;
import
javax.crypto.NoSuchPaddingException
;
...
@@ -49,26 +48,26 @@ public class CredentialApiController implements CredentialApi {
...
@@ -49,26 +48,26 @@ public class CredentialApiController implements CredentialApi {
value
=
"Created user object"
,
required
=
true
)
value
=
"Created user object"
,
required
=
true
)
@Valid
@RequestBody
Credential
body
)
{
@Valid
@RequestBody
Credential
body
)
{
String
accept
=
request
.
getHeader
(
"Accept"
);
String
accept
=
request
.
getHeader
(
"Accept"
);
if
(
accept
!=
null
&&
accept
.
contains
(
"application/json"
))
{
//
if (accept != null && accept.contains("application/json")) {
try
{
try
{
String
id
=
credentialService
.
save
(
body
);
String
id
=
credentialService
.
save
(
body
);
return
new
ResponseEntity
<>(
id
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
id
,
HttpStatus
.
OK
);
}
catch
(
UnsupportedEncodingException
|
NoSuchAlgorithmException
|
NoSuchPaddingException
|
InvalidKeyException
|
IllegalBlockSizeException
|
BadPaddingException
ex
)
{
}
catch
(
UnsupportedEncodingException
|
NoSuchAlgorithmException
|
NoSuchPaddingException
|
InvalidKeyException
|
IllegalBlockSizeException
|
BadPaddingException
ex
)
{
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
}
}
}
else
{
//
} else {
return
new
ResponseEntity
<>(
HttpStatus
.
NOT_ACCEPTABLE
);
//
return new ResponseEntity<>(HttpStatus.NOT_ACCEPTABLE);
}
//
}
}
}
@Override
@Override
public
ResponseEntity
<
List
<
String
>>
getCredentialIDs
()
{
public
ResponseEntity
<
List
<
String
>>
getCredentialIDs
()
{
String
accept
=
request
.
getHeader
(
"Accept"
);
String
accept
=
request
.
getHeader
(
"Accept"
);
if
(
accept
!=
null
&&
accept
.
contains
(
"application/json"
))
{
//
if (accept != null && accept.contains("application/json")) {
List
<
String
>
ids
=
credentialService
.
getAllIds
();
List
<
String
>
ids
=
credentialService
.
getAllIds
();
return
new
ResponseEntity
<>(
ids
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
ids
,
HttpStatus
.
OK
);
}
//
}
return
new
ResponseEntity
<>(
HttpStatus
.
NOT_IMPLEMENTED
);
//
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
}
}
}
manager/src/main/java/nl/uva/sne/drip/api/ToscaTemplateApiController.java
View file @
a7f2ee92
...
@@ -53,7 +53,7 @@ public class ToscaTemplateApiController implements ToscaTemplateApi {
...
@@ -53,7 +53,7 @@ public class ToscaTemplateApiController implements ToscaTemplateApi {
@PathVariable
(
"id"
)
String
id
,
@ApiParam
(
value
=
"The node(s) to delete"
)
@PathVariable
(
"id"
)
String
id
,
@ApiParam
(
value
=
"The node(s) to delete"
)
@Valid
@RequestParam
(
value
=
"node_names"
,
required
=
false
)
List
<
String
>
nodeName
)
{
@Valid
@RequestParam
(
value
=
"node_names"
,
required
=
false
)
List
<
String
>
nodeName
)
{
String
accept
=
request
.
getHeader
(
"Accept"
);
String
accept
=
request
.
getHeader
(
"Accept"
);
if
(
accept
!=
null
&&
accept
.
contains
(
"text/plain"
))
{
//
if (accept != null && accept.contains("text/plain")) {
try
{
try
{
dripService
.
delete
(
id
,
nodeName
);
dripService
.
delete
(
id
,
nodeName
);
return
new
ResponseEntity
<>(
id
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
id
,
HttpStatus
.
OK
);
...
@@ -63,15 +63,15 @@ public class ToscaTemplateApiController implements ToscaTemplateApi {
...
@@ -63,15 +63,15 @@ public class ToscaTemplateApiController implements ToscaTemplateApi {
}
catch
(
NotFoundException
ex
)
{
}
catch
(
NotFoundException
ex
)
{
return
new
ResponseEntity
<>(
HttpStatus
.
NOT_FOUND
);
return
new
ResponseEntity
<>(
HttpStatus
.
NOT_FOUND
);
}
}
}
else
{
//
} else {
return
new
ResponseEntity
<>(
HttpStatus
.
NOT_ACCEPTABLE
);
//
return new ResponseEntity<>(HttpStatus.NOT_ACCEPTABLE);
}
//
}
}
}
@Override
@Override
public
ResponseEntity
<
String
>
getToscaTemplateByID
(
@ApiParam
(
value
=
"ID of topolog template to return"
,
required
=
true
)
@PathVariable
(
"id"
)
String
id
)
{
public
ResponseEntity
<
String
>
getToscaTemplateByID
(
@ApiParam
(
value
=
"ID of topolog template to return"
,
required
=
true
)
@PathVariable
(
"id"
)
String
id
)
{
String
accept
=
request
.
getHeader
(
"Accept"
);
String
accept
=
request
.
getHeader
(
"Accept"
);
if
(
accept
!=
null
&&
accept
.
contains
(
"text/plain"
))
{
//
if (accept != null && accept.contains("text/plain")) {
try
{
try
{
String
ymlStr
=
toscaTemplateService
.
findByID
(
id
);
String
ymlStr
=
toscaTemplateService
.
findByID
(
id
);
...
@@ -81,9 +81,9 @@ public class ToscaTemplateApiController implements ToscaTemplateApi {
...
@@ -81,9 +81,9 @@ public class ToscaTemplateApiController implements ToscaTemplateApi {
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
}
}
}
else
{
//
} else {
return
new
ResponseEntity
<>(
HttpStatus
.
NOT_ACCEPTABLE
);
//
return new ResponseEntity<>(HttpStatus.NOT_ACCEPTABLE);
}
//
}
}
}
...
@@ -93,7 +93,7 @@ public class ToscaTemplateApiController implements ToscaTemplateApi {
...
@@ -93,7 +93,7 @@ public class ToscaTemplateApiController implements ToscaTemplateApi {
@PathVariable
(
"id"
)
String
id
,
@ApiParam
(
value
=
"file detail"
)
@PathVariable
(
"id"
)
String
id
,
@ApiParam
(
value
=
"file detail"
)
@Valid
@RequestPart
(
"file"
)
MultipartFile
file
)
{
@Valid
@RequestPart
(
"file"
)
MultipartFile
file
)
{
String
accept
=
request
.
getHeader
(
"Accept"
);
String
accept
=
request
.
getHeader
(
"Accept"
);
if
(
accept
!=
null
&&
accept
.
contains
(
"text/plain"
))
{
//
if (accept != null && accept.contains("text/plain")) {
try
{
try
{
id
=
toscaTemplateService
.
updateToscaTemplateByID
(
id
,
file
);
id
=
toscaTemplateService
.
updateToscaTemplateByID
(
id
,
file
);
return
new
ResponseEntity
<>(
id
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
id
,
HttpStatus
.
OK
);
...
@@ -102,15 +102,15 @@ public class ToscaTemplateApiController implements ToscaTemplateApi {
...
@@ -102,15 +102,15 @@ public class ToscaTemplateApiController implements ToscaTemplateApi {
java
.
util
.
logging
.
Logger
.
getLogger
(
ToscaTemplateApiController
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
e
);
java
.
util
.
logging
.
Logger
.
getLogger
(
ToscaTemplateApiController
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
e
);
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
}
}
}
else
{
//
} else {
return
new
ResponseEntity
<>(
HttpStatus
.
NOT_ACCEPTABLE
);
//
return new ResponseEntity<>(HttpStatus.NOT_ACCEPTABLE);
}
//
}
}
}
@Override
@Override
public
ResponseEntity
<
String
>
uploadToscaTemplate
(
@ApiParam
(
value
=
"file detail"
)
@Valid
@RequestPart
(
"file"
)
MultipartFile
file
)
{
public
ResponseEntity
<
String
>
uploadToscaTemplate
(
@ApiParam
(
value
=
"file detail"
)
@Valid
@RequestPart
(
"file"
)
MultipartFile
file
)
{
String
accept
=
request
.
getHeader
(
"Accept"
);
String
accept
=
request
.
getHeader
(
"Accept"
);
if
(
accept
!=
null
&&
accept
.
contains
(
"*/*"
))
{
//
if (accept != null && accept.contains("*/*")) {
try
{
try
{
String
id
=
toscaTemplateService
.
saveFile
(
file
);
String
id
=
toscaTemplateService
.
saveFile
(
file
);
return
new
ResponseEntity
<>(
id
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
id
,
HttpStatus
.
OK
);
...
@@ -119,21 +119,21 @@ public class ToscaTemplateApiController implements ToscaTemplateApi {
...
@@ -119,21 +119,21 @@ public class ToscaTemplateApiController implements ToscaTemplateApi {
log
.
error
(
"Couldn't serialize response for content type application/json"
,
e
);
log
.
error
(
"Couldn't serialize response for content type application/json"
,
e
);
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
}
}
}
else
{
//
} else {
return
new
ResponseEntity
<>(
HttpStatus
.
NOT_ACCEPTABLE
);
//
return new ResponseEntity<>(HttpStatus.NOT_ACCEPTABLE);
}
//
}
}
}
@Override
@Override
public
ResponseEntity
<
List
<
String
>>
getToscaTemplateIDs
()
{
public
ResponseEntity
<
List
<
String
>>
getToscaTemplateIDs
()
{
String
accept
=
request
.
getHeader
(
"Accept"
);
String
accept
=
request
.
getHeader
(
"Accept"
);
if
(
accept
!=
null
&&
accept
.
contains
(
"application/json"
))
{
//
if (accept != null && accept.contains("application/json")) {
List
<
String
>
ids
=
toscaTemplateService
.
getAllIds
();
List
<
String
>
ids
=
toscaTemplateService
.
getAllIds
();
return
new
ResponseEntity
<>(
ids
,
HttpStatus
.
NOT_IMPLEMENTED
);
return
new
ResponseEntity
<>(
ids
,
HttpStatus
.
NOT_IMPLEMENTED
);
}
else
{
//
} else {
return
new
ResponseEntity
<>(
HttpStatus
.
NOT_ACCEPTABLE
);
//
return new ResponseEntity<>(HttpStatus.NOT_ACCEPTABLE);
}
//
}
}
}
...
...
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