Nebula
Toggle main menu visibility
Loading...
Searching...
No Matches
nebulahttpclient.h
Go to the documentation of this file.
1
#pragma once
2
//------------------------------------------------------------------------------
14
#include "
core/config.h
"
15
#include "
core/refcounted.h
"
16
#include "
net/tcpclient.h
"
17
#include "
http/httpstatus.h
"
18
#include "
http/httpmethod.h
"
19
#include "
io/uri.h
"
20
#include "
io/stream.h
"
21
22
//------------------------------------------------------------------------------
23
namespace
Http
24
{
25
class
NebulaHttpClient
:
public
Core::RefCounted
26
{
27
__DeclareClass
(
NebulaHttpClient
);
28
public
:
30
NebulaHttpClient
();
32
virtual
~NebulaHttpClient
();
33
35
void
SetUserAgent
(
const
Util::String
&
userAgent
);
37
const
Util::String
&
GetUserAgent
()
const
;
38
40
bool
Connect
(
const
IO::URI
& uri);
42
void
Disconnect
();
44
bool
IsConnected
()
const
;
45
47
HttpStatus::Code
SendRequest
(
HttpMethod::Code
requestMethod,
const
IO::URI
& uri,
const
Ptr<IO::Stream>
& responseContentStream);
49
HttpStatus::Code
SendRequest
(
HttpMethod::Code
requestMethod,
const
IO::URI
& uri,
const
Util::String
& body,
const
Ptr<IO::Stream>
& responseContentStream);
50
private
:
51
Util::String
userAgent
;
52
Ptr<Net::TcpClient>
tcpClient
;
53
};
54
55
//------------------------------------------------------------------------------
58
inline
void
59
NebulaHttpClient::SetUserAgent
(
const
Util::String
& agent)
60
{
61
this->
userAgent
= agent;
62
}
63
64
//------------------------------------------------------------------------------
67
inline
const
Util::String
&
68
NebulaHttpClient::GetUserAgent
()
const
69
{
70
return
this->
userAgent
;
71
}
72
73
}
// namespace Simple
74
//------------------------------------------------------------------------------
Core::RefCounted
The common base class of Nebula.
Definition
refcounted.h:38
Http::HttpMethod::Code
Code
http methods
Definition
httpmethod.h:24
Http::HttpStatus::Code
Code
status codes
Definition
httpstatus.h:24
Http::NebulaHttpClient::SetUserAgent
void SetUserAgent(const Util::String &userAgent)
set the user-agent to use for HTTP requests
Definition
nebulahttpclient.h:59
Http::NebulaHttpClient::NebulaHttpClient
NebulaHttpClient()
constructor
Definition
nebulahttpclient.cc:22
Http::NebulaHttpClient::~NebulaHttpClient
virtual ~NebulaHttpClient()
destructor
Definition
nebulahttpclient.cc:32
Http::NebulaHttpClient::IsConnected
bool IsConnected() const
return true if currently connected
Definition
nebulahttpclient.cc:78
Http::NebulaHttpClient::__DeclareClass
__DeclareClass(NebulaHttpClient)
Http::NebulaHttpClient::Disconnect
void Disconnect()
disconnect from the server
Definition
nebulahttpclient.cc:66
Http::NebulaHttpClient::SendRequest
HttpStatus::Code SendRequest(HttpMethod::Code requestMethod, const IO::URI &uri, const Ptr< IO::Stream > &responseContentStream)
send request and write result to provided response content stream
Definition
nebulahttpclient.cc:87
Http::NebulaHttpClient::Connect
bool Connect(const IO::URI &uri)
establish a connection to a HTTP server
Definition
nebulahttpclient.cc:45
Http::NebulaHttpClient::tcpClient
Ptr< Net::TcpClient > tcpClient
Definition
nebulahttpclient.h:52
Http::NebulaHttpClient::userAgent
Util::String userAgent
Definition
nebulahttpclient.h:51
Http::NebulaHttpClient::GetUserAgent
const Util::String & GetUserAgent() const
get the user-agent
Definition
nebulahttpclient.h:68
IO::URI
An URI object can split a Uniform Resource Identifier string into its components or build a string fr...
Definition
uri.h:67
Ptr
Nebula's smart pointer class which manages the life time of RefCounted objects.
Definition
ptr.h:38
config.h
Nebula compiler specific defines and configuration.
httpmethod.h
httpstatus.h
Http
This file was generated with Nebula Trifid's idlc compiler tool.
Definition
defaulthttprequesthandler.cc:15
refcounted.h
stream.h
Util.String
Nebula's universal string class.
Definition
String.cs:8
tcpclient.h
uri.h
code
foundation
http
simple
nebulahttpclient.h
Generated on
for Nebula. Dark theme by
Tilen Majerle
. All rights reserved.