Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F61402955
JerseyHttpClientTool.scala
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, May 6, 11:01
Size
1 KB
Mime Type
text/x-c
Expires
Wed, May 8, 11:01 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
17507289
Attached To
R2664 SHRINE MedCo Fork
JerseyHttpClientTool.scala
View Options
package
net.shrine.utilities.jerseyhttpclienttool
import
com.typesafe.config.ConfigFactory
import
net.shrine.client.
{
EndpointConfig
,
HttpResponse
,
JerseyHttpClient
}
import
net.shrine.crypto.
{
BouncyKeyStoreCollection
,
KeyStoreDescriptorParser
}
import
net.shrine.config.ConfigExtensions
import
scala.util.control.NonFatal
/**
* @author dwalend
* @since 1.22.5
*/
object
JerseyHttpClientTool
{
def
main
(
args
:
Array
[
String
])
:
Unit
=
{
val
config
=
ConfigFactory
.
load
()
val
shrineConfig
=
config
.
getConfig
(
"shrine"
)
val
qepConfig
=
shrineConfig
.
getConfig
(
"queryEntryPoint"
)
val
endpoint
=
EndpointConfig
(
qepConfig
.
getConfig
(
"broadcasterServiceEndpoint"
))
lazy
val
keyStoreDescriptor
=
KeyStoreDescriptorParser
(
shrineConfig
.
getConfig
(
"keystore"
),
shrineConfig
.
getConfigOrEmpty
(
"hub"
),
shrineConfig
.
getConfigOrEmpty
(
"queryEntryPoint"
))
val
certCollection
:
BouncyKeyStoreCollection
=
BouncyKeyStoreCollection
.
fromFileRecoverWithClassPath
(
keyStoreDescriptor
)
val
httpClient
=
JerseyHttpClient
(
certCollection
,
endpoint
)
try
{
val
response
:
HttpResponse
=
httpClient
.
post
(
s
"test"
,
endpoint
.
url
.
toString
)
println
(
s
"Success with $response"
)
}
catch
{
case
NonFatal
(
x
)
=>
x
.
printStackTrace
()
}
}
}
Event Timeline
Log In to Comment