• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdenetwork
  • Sitemap
  • Contact Us
 

kopete/protocols/messenger/libpapillon

Papillon::HttpTransfer

Papillon::HttpTransfer Class Reference

#include <Papillon/Http/Transfer>

List of all members.


Detailed Description

HttpTransfer represent a transfer between a HTTP server.

This is wrapper around QHttpHeader and a body. Based on QHttpHeader classes.

Author:
Michaƫl Larouche <larouche@kde.org>

Definition at line 38 of file httptransfer.h.


Public Types

enum  HttpTransferType { HttpRequest, HttpResponse }

Public Member Functions

QByteArray body () const
uint contentLength () const
QString contentType () const
bool hasContentLength () const
bool hasContentType () const
bool hasKey (const QString &key) const
 HttpTransfer (HttpTransferType type=HttpRequest)
bool isValid () const
QString method () const
QString path () const
void setBody (const QByteArray &body)
void setContentType (const QString &contentType)
void setHttpHeader (const QHttpResponseHeader &responseHeader)
void setHttpHeader (const QHttpRequestHeader &requestHeader)
void setRequest (const QString &method, const QString &path, int majorVer=1, int minorVer=1)
void setValue (const QString &key, const QString &value)
void setValues (const QList< QPair< QString, QString > > &values)
int statusCode () const
QByteArray toRawCommand ()
HttpTransferType type () const
QString value (const QString &key) const
QList< QPair< QString, QString > > values () const
 ~HttpTransfer ()

Member Enumeration Documentation

enum Papillon::HttpTransfer::HttpTransferType

Determine the Transfer type.

HttpRequest: a HTTP request (with method GET or POST) HttpResponse: a HTTP response (with a status code)

Enumerator:
HttpRequest 
HttpResponse 

Definition at line 46 of file httptransfer.h.


Constructor & Destructor Documentation

Papillon::HttpTransfer::HttpTransfer ( HttpTransferType  type = HttpRequest  ) 

Build a new HttpTransfer.

By default it is set in HTTP request mode, because this is the kind of HttpTransfer you create manually.

Parameters:
type Type of HttpTransfer, by default HttpRequest.

Definition at line 42 of file httptransfer.cpp.

Papillon::HttpTransfer::~HttpTransfer (  ) 

d-tor (duh)

Definition at line 57 of file httptransfer.cpp.


Member Function Documentation

QByteArray Papillon::HttpTransfer::body (  )  const

Get the HTTP body.

Returns:
the HTTP body.

Definition at line 168 of file httptransfer.cpp.

uint Papillon::HttpTransfer::contentLength (  )  const

Get the Content-Length value.

Use value in the HTTP header.

Returns:
the content length.

Definition at line 72 of file httptransfer.cpp.

QString Papillon::HttpTransfer::contentType (  )  const

Get the Content-Type for this HTTP transfer.

Returns:

Definition at line 77 of file httptransfer.cpp.

bool Papillon::HttpTransfer::hasContentLength (  )  const

Check if the header contains the "Content-Length" key.

Returns:
true if the header contains "Content-Length" key.

Definition at line 112 of file httptransfer.cpp.

bool Papillon::HttpTransfer::hasContentType (  )  const

Check if the header contains the "Content-Type" key.

Returns:
true if the header contains "Content-Type" key.

Definition at line 117 of file httptransfer.cpp.

bool Papillon::HttpTransfer::hasKey ( const QString &  key  )  const

Check if the header has the given key.

Parameters:
key the given key.
Returns:
true if the given key was found.

Definition at line 122 of file httptransfer.cpp.

bool Papillon::HttpTransfer::isValid (  )  const

Check if the HttpTransfer is valid.

Returns:
true if the HttpTransfer is valid.

Definition at line 67 of file httptransfer.cpp.

QString Papillon::HttpTransfer::method (  )  const

Get the HTTP method for the request Use it only in HttpRequest mode.

Returns:
the current method

Definition at line 154 of file httptransfer.cpp.

QString Papillon::HttpTransfer::path (  )  const

Get the path used in the request.

Use it only in HttpRequest mode.

Returns:
the path in the request.

Definition at line 161 of file httptransfer.cpp.

void Papillon::HttpTransfer::setBody ( const QByteArray &  body  ) 

Set the HTTP body Set the Content-Length value according to the body size.

Parameters:
body body to set to the transfer.

Definition at line 173 of file httptransfer.cpp.

void Papillon::HttpTransfer::setContentType ( const QString &  contentType  ) 

Set the Content-Type of the HTTP body.

Example are text/html, text/xml, image/png

Parameters:
contentType Content-Type as string.

Definition at line 82 of file httptransfer.cpp.

void Papillon::HttpTransfer::setHttpHeader ( const QHttpResponseHeader &  responseHeader  ) 

Replace the internal HTTP header with the given HTTP header.

Same as above, but for QHttpResponseHeader.

Parameters:
responseHeader QHttpResponseHeader to replace.

Definition at line 103 of file httptransfer.cpp.

void Papillon::HttpTransfer::setHttpHeader ( const QHttpRequestHeader &  requestHeader  ) 

Replace the internal HTTP header with the given HTTP header.

Replace the internal header with the given QHttpRequestHeader.

Parameters:
requestHeader QHttpRequestHeader to replace.

Definition at line 94 of file httptransfer.cpp.

void Papillon::HttpTransfer::setRequest ( const QString &  method,
const QString &  path,
int  majorVer = 1,
int  minorVer = 1 
)

Set the request details.

Only call this method in HttpRequest method. This is a wrapper around QHttpRequestHeader::setRequest().

Parameters:
method HTTP method, either GET or POST
path path to request on server.
majorVer HTTP major version (default to 1)
minorVer HTTP minir version (default to 1)

Definition at line 87 of file httptransfer.cpp.

void Papillon::HttpTransfer::setValue ( const QString &  key,
const QString &  value 
)

Sets the value of the entry with the key to value.

If no entry with key exists, a new entry with the given key and value is created. If an entry with the key already exists, the first value is discarded and replaced with the given value.

Parameters:
key Key
value value

Definition at line 137 of file httptransfer.cpp.

void Papillon::HttpTransfer::setValues ( const QList< QPair< QString, QString > > &  values  ) 

Sets the header entries to be the list of key value pairs in values.

Parameters:
values the values.

Definition at line 142 of file httptransfer.cpp.

int Papillon::HttpTransfer::statusCode (  )  const

Get the status code from the HTTP Response.

Only available in HttpResponse mode.

Returns:
the status code.

Definition at line 147 of file httptransfer.cpp.

QByteArray Papillon::HttpTransfer::toRawCommand (  ) 

Return the current transfer as a raw command.

It formats the HttpTransfer to be ready to be sent on a ByteStream.

Definition at line 179 of file httptransfer.cpp.

HttpTransfer::HttpTransferType Papillon::HttpTransfer::type (  )  const

Get the current HttpTransfer type.

Returns:
the current HttpTransfer type

Definition at line 62 of file httptransfer.cpp.

QString Papillon::HttpTransfer::value ( const QString &  key  )  const

Get the header value for the given key.

Parameters:
key given key.
Returns:
the value for the given key.

Definition at line 127 of file httptransfer.cpp.

QList< QPair< QString, QString > > Papillon::HttpTransfer::values (  )  const

Get all the key: values.

Returns:
all the key: values

Definition at line 132 of file httptransfer.cpp.


The documentation for this class was generated from the following files:
  • httptransfer.h
  • httptransfer.cpp

kopete/protocols/messenger/libpapillon

Skip menu "kopete/protocols/messenger/libpapillon"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdenetwork

Skip menu "kdenetwork"
  • kget
  • kopete
  •   kopete
  •   libkopete
  •       libpapillon
  • krfb
Generated for kdenetwork by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal