B4J Programming Press on the image to return to the main documentation page.

jOkHttpUtils2_NONUI

List of types:

HttpJob
MultipartFileData

HttpJob

Used to create Http requests. You must handle the JobDone event.
Example:
Dim job1 As HttpJob
job1.Initialize("Job1", Me)
job1.Download("http://www.google.com")
...
Sub JobDone (Job As HttpJob)
Log("JobName = " & Job.JobName & ", Success = " & Job.Success)
If Job.Success = True Then
  Log(Job.GetString)
Else
Log("Error: " & Job.ErrorMessage)
End If
Job.Release
End Sub


Events:

None

Members:


  Class_Globals As String

  Complete (id As Int) As String

  Delete (Link As String) As String

  Delete2 (Link As String, Parameters() As String) As String

  Download (Link As String) As String

  Download2 (Link As String, Parameters() As String) As String

  ErrorMessage As String

  GetInputStream As InputStreamWrapper

  GetRequest As OkHttpRequest

  GetString As String

  GetString2 (Encoding As String) As String

  Initialize (Name As String, TargetModule As Object) As String

  IsInitialized As Boolean

  JobName As String

  Password As String

  PostBytes (Link As String, Data() As Byte) As String

  PostFile (Link As String, Dir As String, FileName As String) As String

  PostMultipart (Link As String, NameValues As Map, Files As List) As String

  PostString (Link As String, Text As String) As String

  PutBytes (Link As String, Data() As Byte) As String

  PutString (Link As String, Text As String) As String

  Release As String

  Success As Boolean

  Tag As Object

  Username As String

Members description:

Class_Globals As String
Complete (id As Int) As String
Called by the service when job completes
Delete (Link As String) As String
Delete2 (Link As String, Parameters() As String) As String
Download (Link As String) As String
Submits a HTTP GET request.
Consider using Download2 if the parameters should be escaped.
Download2 (Link As String, Parameters() As String) As String
Submits a HTTP GET request.
Encodes illegal parameter characters.
Example:
job.Download2("http://www.example.com", _
  Array As String("key1", "value1", "key2", "value2"))

ErrorMessage As String
GetInputStream As InputStreamWrapper
GetRequest As OkHttpRequest
Called by the service to get the request
GetString As String
Returns the response as a string encoded with UTF8.
GetString2 (Encoding As String) As String
Returns the response as a string.
Initialize (Name As String, TargetModule As Object) As String
Initializes the Job.
Name - The job's name. Note that the name doesn't need to be unique.
TargetModule - The activity or service that will handle the JobDone event.
IsInitialized As Boolean
Tests whether the object has been initialized.
JobName As String
Password As String
PostBytes (Link As String, Data() As Byte) As String
Sends a POST request with the given string as the post data
PostFile (Link As String, Dir As String, FileName As String) As String
Sends a POST request with the given file as the post data.
This method doesn't work with assets files.
PostMultipart (Link As String, NameValues As Map, Files As List) As String
Sends a multipart POST request.
NameValues - A map with the keys and values. Pass Null if not needed.
Files - List of MultipartFileData items. Pass Null if not needed.
PostString (Link As String, Text As String) As String
Sends a POST request with the given data as the post data.
PutBytes (Link As String, Data() As Byte) As String
Sends a PUT request with the given string as the post data
PutString (Link As String, Text As String) As String
Sends a PUT request with the given data as the post data.
Release As String
Should be called to free resources held by this job.
Success As Boolean
Tag As Object
Username As String

MultipartFileData


Events:

None

Members:


  ContentType As String

  Dir As String

  FileName As String

  Initialize

  IsInitialized As Boolean

  KeyName As String

Members description:

ContentType As String
Dir As String
FileName As String
Initialize
Initializes the fields to their default value.
IsInitialized As Boolean
Tests whether the object has been initialized.
KeyName As String

Top