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

HttpServer

List of types:

HttpServer
ServletRequest
ServletResponse

HttpServer


Permissions:

android.permission.INTERNET
android.permission.WRITE_EXTERNAL_STORAGE

Events:

HandleRequest (Request As ServletRequest, Response As ServletResponse)

Members:


  Initialize (EventName As String)

  Start (Port As Int)

  Stop

  TempFolder As String

Members description:

Initialize (EventName As String)
Initializes the server.
Start (Port As Int)
Starts the server. The server will listen to the given port.
Stop
Stops the server.
TempFolder As String

ServletRequest


Events:

None

Members:


  GetHeader (Name As String) As String

  GetParameter (Name As String) As String

  GetUploadedFile (Key As String) As String

  Method As String [read only]

  RemoteAddress As String [read only]

  RequestURI As String [read only]

Members description:

GetHeader (Name As String) As String
Returns the header value or an empty string if the header does not exist.
GetParameter (Name As String) As String
Returns the parameter value or an empty string if the parameter does not exist.
GetUploadedFile (Key As String) As String
Returns the name of the temporary file that was uploaded to Server.TempFolder.
Method As String [read only]
Returns the HTTP method (GET or POST).
RemoteAddress As String [read only]
Returns the client IP address.
RequestURI As String [read only]
Returns the request URL without the host and any parameters.

ServletResponse


Events:

None

Members:


  SendFile (Dir As String, FileName As String)

  SendRedirect (Location As String)

  SendString (Text As String)

  SetContentType (Type As String)

  SetHeader (Name As String, Value As String)

  Status As Int [write only]

Members description:

SendFile (Dir As String, FileName As String)
Sends a file as a response.
SendRedirect (Location As String)
Redirets the client to a different location.
SendString (Text As String)
Sends the response text.
SetContentType (Type As String)
Sets the content type header.
SetHeader (Name As String, Value As String)
Sets the response header.
Status As Int [write only]
Sets the HTTP status code. Default value is 200 (success).
Top