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:
nodePort
:
30001
protocol
:
TCP
name
:
https
-
port
:
80
protocol
:
TCP
name
:
http
selector
:
io.kompose.service
:
nginx
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;
import
javax.validation.Valid
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.List
;
import
java.util.logging.Level
;
import
javax.crypto.BadPaddingException
;
import
javax.crypto.IllegalBlockSizeException
;
import
javax.crypto.NoSuchPaddingException
;
...
...
@@ -49,26 +48,26 @@ public class CredentialApiController implements CredentialApi {
value
=
"Created user object"
,
required
=
true
)
@Valid
@RequestBody
Credential
body
)
{
String
accept
=
request
.
getHeader
(
"Accept"
);
if
(
accept
!=
null
&&
accept
.
contains
(
"application/json"
))
{
//
if (accept != null && accept.contains("application/json")) {
try
{
String
id
=
credentialService
.
save
(
body
);
return
new
ResponseEntity
<>(
id
,
HttpStatus
.
OK
);
}
catch
(
UnsupportedEncodingException
|
NoSuchAlgorithmException
|
NoSuchPaddingException
|
InvalidKeyException
|
IllegalBlockSizeException
|
BadPaddingException
ex
)
{
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
}
}
else
{
return
new
ResponseEntity
<>(
HttpStatus
.
NOT_ACCEPTABLE
);
}
//
} else {
//
return new ResponseEntity<>(HttpStatus.NOT_ACCEPTABLE);
//
}
}
@Override
public
ResponseEntity
<
List
<
String
>>
getCredentialIDs
()
{
String
accept
=
request
.
getHeader
(
"Accept"
);
if
(
accept
!=
null
&&
accept
.
contains
(
"application/json"
))
{
//
if (accept != null && accept.contains("application/json")) {
List
<
String
>
ids
=
credentialService
.
getAllIds
();
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 {
@PathVariable
(
"id"
)
String
id
,
@ApiParam
(
value
=
"The node(s) to delete"
)
@Valid
@RequestParam
(
value
=
"node_names"
,
required
=
false
)
List
<
String
>
nodeName
)
{
String
accept
=
request
.
getHeader
(
"Accept"
);
if
(
accept
!=
null
&&
accept
.
contains
(
"text/plain"
))
{
//
if (accept != null && accept.contains("text/plain")) {
try
{
dripService
.
delete
(
id
,
nodeName
);
return
new
ResponseEntity
<>(
id
,
HttpStatus
.
OK
);
...
...
@@ -63,15 +63,15 @@ public class ToscaTemplateApiController implements ToscaTemplateApi {
}
catch
(
NotFoundException
ex
)
{
return
new
ResponseEntity
<>(
HttpStatus
.
NOT_FOUND
);
}
}
else
{
return
new
ResponseEntity
<>(
HttpStatus
.
NOT_ACCEPTABLE
);
}
//
} else {
//
return new ResponseEntity<>(HttpStatus.NOT_ACCEPTABLE);
//
}
}
@Override
public
ResponseEntity
<
String
>
getToscaTemplateByID
(
@ApiParam
(
value
=
"ID of topolog template to return"
,
required
=
true
)
@PathVariable
(
"id"
)
String
id
)
{
String
accept
=
request
.
getHeader
(
"Accept"
);
if
(
accept
!=
null
&&
accept
.
contains
(
"text/plain"
))
{
//
if (accept != null && accept.contains("text/plain")) {
try
{
String
ymlStr
=
toscaTemplateService
.
findByID
(
id
);
...
...
@@ -81,9 +81,9 @@ public class ToscaTemplateApiController implements ToscaTemplateApi {
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
}
}
else
{
return
new
ResponseEntity
<>(
HttpStatus
.
NOT_ACCEPTABLE
);
}
//
} else {
//
return new ResponseEntity<>(HttpStatus.NOT_ACCEPTABLE);
//
}
}
...
...
@@ -93,7 +93,7 @@ public class ToscaTemplateApiController implements ToscaTemplateApi {
@PathVariable
(
"id"
)
String
id
,
@ApiParam
(
value
=
"file detail"
)
@Valid
@RequestPart
(
"file"
)
MultipartFile
file
)
{
String
accept
=
request
.
getHeader
(
"Accept"
);
if
(
accept
!=
null
&&
accept
.
contains
(
"text/plain"
))
{
//
if (accept != null && accept.contains("text/plain")) {
try
{
id
=
toscaTemplateService
.
updateToscaTemplateByID
(
id
,
file
);
return
new
ResponseEntity
<>(
id
,
HttpStatus
.
OK
);
...
...
@@ -102,15 +102,15 @@ public class ToscaTemplateApiController implements ToscaTemplateApi {
java
.
util
.
logging
.
Logger
.
getLogger
(
ToscaTemplateApiController
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
e
);
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
}
}
else
{
return
new
ResponseEntity
<>(
HttpStatus
.
NOT_ACCEPTABLE
);
}
//
} else {
//
return new ResponseEntity<>(HttpStatus.NOT_ACCEPTABLE);
//
}
}
@Override
public
ResponseEntity
<
String
>
uploadToscaTemplate
(
@ApiParam
(
value
=
"file detail"
)
@Valid
@RequestPart
(
"file"
)
MultipartFile
file
)
{
String
accept
=
request
.
getHeader
(
"Accept"
);
if
(
accept
!=
null
&&
accept
.
contains
(
"*/*"
))
{
//
if (accept != null && accept.contains("*/*")) {
try
{
String
id
=
toscaTemplateService
.
saveFile
(
file
);
return
new
ResponseEntity
<>(
id
,
HttpStatus
.
OK
);
...
...
@@ -119,21 +119,21 @@ public class ToscaTemplateApiController implements ToscaTemplateApi {
log
.
error
(
"Couldn't serialize response for content type application/json"
,
e
);
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
}
}
else
{
return
new
ResponseEntity
<>(
HttpStatus
.
NOT_ACCEPTABLE
);
}
//
} else {
//
return new ResponseEntity<>(HttpStatus.NOT_ACCEPTABLE);
//
}
}
@Override
public
ResponseEntity
<
List
<
String
>>
getToscaTemplateIDs
()
{
String
accept
=
request
.
getHeader
(
"Accept"
);
if
(
accept
!=
null
&&
accept
.
contains
(
"application/json"
))
{
//
if (accept != null && accept.contains("application/json")) {
List
<
String
>
ids
=
toscaTemplateService
.
getAllIds
();
return
new
ResponseEntity
<>(
ids
,
HttpStatus
.
NOT_IMPLEMENTED
);
}
else
{
return
new
ResponseEntity
<>(
HttpStatus
.
NOT_ACCEPTABLE
);
}
//
} else {
//
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