UZI::HTTPClient Class Reference

#include <HTTPClient.hpp>

List of all members.


Detailed Description

This class implement network client for HTTP/1.1 and older.

Please notice that this is full HTTP/1.1 client supporting multiple features like resuming, multipart, and so on...


Public Types

enum  DocumentType {
  Unknown = 0x00000000, XML = 0x00000001, HTML = 0x00000002, JPEGImage = 0x00000003,
  PNGImage = 0x00000004, GIFImage = 0x00000005, Stylesheet = 0x00000006, ScriptFile = 0x00000007
}
 The possible documents type. More...
typedef juce::MemoryBlock MemoryBlock
typedef juce::Socket Socket
enum  State {
  Constructed = 0, Connected = 1, Prepared = 2, RequestEmitted = 3,
  FetchingResult = 4, HeaderReceived = 5, ResultFetched = 6, ResultParsed = 7,
  ErrorDetected = 8
}
 The current client state. More...
typedef juce::String String

Public Member Functions

bool connectToServer ()
 Locate server IP.
bool emitRequest ()
 Emit the request.
bool fetchResults (const int timeoutMs)
 Fetching the results.
const void * getDataPtr () const
 Get the data.
const unsigned int getDataSize () const
 Get the result data size.
String getHeaders () const
 Get headers.
const DocumentType getMimeType () const
 Try to deduce document type from answer mimetype.
const State getState () const
 Get the current status.
 HTTPClient (const Network::URL &_URL=Network::URL(), const int _portNumber=80, const String &_postData=String::empty)
 A simple client.
void Mutate (const Network::URL &_URL, const int portNumber, const String &postData=String::empty)
 Mutate the client to another server.
bool parseResults ()
 Parse the result data.
bool prepareHTTPHeaders ()
 Prepare document request headers.
 ~HTTPClient ()


Member Typedef Documentation

typedef juce::MemoryBlock UZI::HTTPClient::MemoryBlock

typedef juce::Socket UZI::HTTPClient::Socket

typedef juce::String UZI::HTTPClient::String


Member Enumeration Documentation

enum UZI::HTTPClient::DocumentType

The possible documents type.

Enumerator:
Unknown  The document type is unknown.
XML  The document is an XML stream.
HTML  The document is an HTML stream.
JPEGImage  The document is an image compressed using JPEG codec.
PNGImage  The document is an image compressed using PNG codec.
GIFImage  The document is an image compressed using GIF codec.
Stylesheet  The document is an external stylesheet stream.
ScriptFile  The document is an external script stream.

enum UZI::HTTPClient::State

The current client state.

Enumerator:
Constructed  The client is just constructed.
Connected  The client is connected to server.
Prepared  The client has prepared its request and is ready to emit.
RequestEmitted  The client has emitted the request.
FetchingResult  The client is currently fetching results.
HeaderReceived  The client is currently fetching results - header is received.
ResultFetched  The client has finished fetching the results.
ResultParsed  The client has parsed the results.
ErrorDetected  The client detected an error.


Constructor & Destructor Documentation

UZI::HTTPClient::HTTPClient ( const Network::URL _URL = Network::URL(),
const int  _portNumber = 80,
const String _postData = String::empty 
) [inline]

A simple client.

UZI::HTTPClient::~HTTPClient (  )  [inline]


Member Function Documentation

bool UZI::HTTPClient::connectToServer (  ) 

Locate server IP.

Returns:
true if the server is available and accept connections

bool UZI::HTTPClient::emitRequest (  ) 

Emit the request.

bool UZI::HTTPClient::fetchResults ( const int  timeoutMs  ) 

Fetching the results.

Returns:
true if no more data need to be downloaded, false otherwise (timeout or bad connection)

const void * UZI::HTTPClient::getDataPtr (  )  const

Get the data.

const unsigned int UZI::HTTPClient::getDataSize (  )  const

Get the result data size.

String UZI::HTTPClient::getHeaders (  )  const [inline]

Get headers.

const HTTPClient::DocumentType UZI::HTTPClient::getMimeType (  )  const

Try to deduce document type from answer mimetype.

const State UZI::HTTPClient::getState (  )  const [inline]

Get the current status.

void UZI::HTTPClient::Mutate ( const Network::URL _URL,
const int  portNumber,
const String postData = String::empty 
)

Mutate the client to another server.

bool UZI::HTTPClient::parseResults (  ) 

Parse the result data.

After this call, the communication buffer contains the HTTP headers, while the answer buffer contains the data

bool UZI::HTTPClient::prepareHTTPHeaders (  ) 

Prepare document request headers.


The documentation for this class was generated from the following files:

(C) An X-Ryl669 project 2007

This document describes Unlimited Zooming Interface source code. UZI stands for Unlimited Zooming Interface, and source code license is