Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
e822f1f0
Commit
e822f1f0
authored
1 year ago
by
juanf
Browse files
Options
Downloads
Patches
Plain Diff
SSDM-13251: Changes from code review
parent
8c7f85ae
No related branches found
No related tags found
1 merge request
!40
SSDM-13578 : 2PT : Database and V3 Implementation - include the new AFS "free"...
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
api-data-store-server-java/src/main/java/ch/ethz/sis/afsclient/client/AfsClientV2.java
+21
-6
21 additions, 6 deletions
...c/main/java/ch/ethz/sis/afsclient/client/AfsClientV2.java
with
21 additions
and
6 deletions
api-data-store-server-java/src/main/java/ch/ethz/sis/afsclient/client/AfsClientV2.java
+
21
−
6
View file @
e822f1f0
...
@@ -226,12 +226,9 @@ public final class AfsClientV2 implements PublicAPI
...
@@ -226,12 +226,9 @@ public final class AfsClientV2 implements PublicAPI
@NonNull
final
Map
<
String
,
String
>
params
)
@NonNull
final
Map
<
String
,
String
>
params
)
throws
Exception
throws
Exception
{
{
HttpClient
.
Builder
clientBuilder
=
HttpClient
.
newBuilder
()
//
.
version
(
HttpClient
.
Version
.
HTTP_1_1
)
// General Parameter Handling
.
followRedirects
(
HttpClient
.
Redirect
.
NORMAL
)
//
.
connectTimeout
(
Duration
.
ofMillis
(
timeout
));
HttpClient
client
=
clientBuilder
.
build
();
if
(
sessionToken
!=
null
)
if
(
sessionToken
!=
null
)
{
{
...
@@ -255,17 +252,28 @@ public final class AfsClientV2 implements PublicAPI
...
@@ -255,17 +252,28 @@ public final class AfsClientV2 implements PublicAPI
return
urlEncode
(
entry
.
getKey
())
+
"="
+
urlEncode
(
entry
.
getValue
());
return
urlEncode
(
entry
.
getKey
())
+
"="
+
urlEncode
(
entry
.
getValue
());
})
})
.
reduce
((
s1
,
s2
)
->
s1
+
"&"
+
s2
).
get
();
.
reduce
((
s1
,
s2
)
->
s1
+
"&"
+
s2
).
get
();
//
// GET Request - Parameters on the query string
// GET Request - Parameters on the query string
//
String
queryParameters
=
null
;
String
queryParameters
=
null
;
if
(
httpMethod
.
equals
(
"GET"
))
{
if
(
httpMethod
.
equals
(
"GET"
))
{
queryParameters
=
parameters
;
queryParameters
=
parameters
;
}
}
//
// POST Request - Parameters on body
// POST Request - Parameters on body
//
byte
[]
body
=
null
;
byte
[]
body
=
null
;
if
(
httpMethod
.
equals
(
"POST"
))
{
if
(
httpMethod
.
equals
(
"POST"
))
{
body
=
parameters
.
getBytes
(
StandardCharsets
.
UTF_8
);
body
=
parameters
.
getBytes
(
StandardCharsets
.
UTF_8
);
}
}
//
// HTTP Client
//
final
URI
uri
=
final
URI
uri
=
new
URI
(
serverUri
.
getScheme
(),
null
,
serverUri
.
getHost
(),
serverUri
.
getPort
(),
new
URI
(
serverUri
.
getScheme
(),
null
,
serverUri
.
getHost
(),
serverUri
.
getPort
(),
serverUri
.
getPath
(),
queryParameters
,
null
);
serverUri
.
getPath
(),
queryParameters
,
null
);
...
@@ -278,6 +286,13 @@ public final class AfsClientV2 implements PublicAPI
...
@@ -278,6 +286,13 @@ public final class AfsClientV2 implements PublicAPI
final
HttpRequest
request
=
builder
.
build
();
final
HttpRequest
request
=
builder
.
build
();
HttpClient
.
Builder
clientBuilder
=
HttpClient
.
newBuilder
()
.
version
(
HttpClient
.
Version
.
HTTP_1_1
)
.
followRedirects
(
HttpClient
.
Redirect
.
NORMAL
)
.
connectTimeout
(
Duration
.
ofMillis
(
timeout
));
HttpClient
client
=
clientBuilder
.
build
();
final
HttpResponse
<
byte
[]>
httpResponse
=
final
HttpResponse
<
byte
[]>
httpResponse
=
client
.
send
(
request
,
HttpResponse
.
BodyHandlers
.
ofByteArray
());
client
.
send
(
request
,
HttpResponse
.
BodyHandlers
.
ofByteArray
());
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment