]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.rest/scl/HTTP/Client.scl
Improvements to SCL HTTP client
[simantics/platform.git] / bundles / org.simantics.scl.rest / scl / HTTP / Client.scl
index 9ebeeea8f8907994ed5430d1a4ce1adc0f89afff..6568116c9e6a5d9c496e45e16b9b06e5075b1bde 100644 (file)
@@ -24,6 +24,8 @@ importJava "javax.ws.rs.core.Response" where
     @Private
     @JavaName readEntity
     readEntity_ :: Response -> Class a -> <Proc, Exception> a
+    @JavaName getHeaderString
+    possibleHeaderOf :: Response -> String -> <Proc> Maybe String
 
 readEntity :: VecComp a => Response -> <Proc, Exception> a
 readEntity response = readEntity_ response classObject
@@ -73,10 +75,13 @@ importJava "javax.ws.rs.client.ClientBuilder" where
     clientBuilder :: <Proc> ClientBuilder
 
 importJava "org.simantics.scl.rest.HttpClientUtils" where
-    buildClient :: ClientBuilder -> Client
+    buildClient :: ClientBuilder -> <Proc> Client
     statusMessageOf :: Response -> <Proc> String
     asyncInvoke :: Invocation -> ResponseHandler -> FailureHandler -> <Proc> Future Response
     trustAllClientBuilder :: <Proc> ClientBuilder
+    onReadProgress :: WebTarget -> (Long -> <Proc> ()) -> <Proc> ()
+    onWriteProgress :: WebTarget -> (Long -> <Proc> ()) -> <Proc> ()
+    possibleContentLengthOf :: Response -> <Proc> Maybe Long
 
 importJava "javax.ws.rs.client.Entity" where
     data Entity
@@ -133,7 +138,6 @@ postFileExample uri f = do
     webTarget = target httpClient uri
     builder = request webTarget
     acceptMediaType builder [WILDCARD_TYPE]
-    mp = formDataMultiPart
     invocation = buildPost builder $ entity f APPLICATION_OCTET_STREAM_TYPE
     response = syncInvoke invocation
     print $ statusCodeOf response