-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhttp.cpp
More file actions
61 lines (49 loc) · 1.39 KB
/
Copy pathhttp.cpp
File metadata and controls
61 lines (49 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include <dframework/http/HttpGet.h>
#include <dframework/http/HttpPropfind.h>
using namespace dframework;
static int cnt = 0;
class AAA : public Object
{
public:
class HttpListener : public HttpQuery::OnHttpListener
{
public :
virtual sp<Retval> onResponse(sp<HttpConnection>& c
, const char* b, dfw_size_t s){
printf("size = %ld\n", s);
return NULL;
}
};
class PropfindListener : public HttpPropfind::OnPropfindListener
{
public :
virtual sp<Retval> onPropfind(sp<HttpConnection>& c
, sp<HttpPropfind::Prop>& prop){
printf("name => %s\r\n", prop->m_sName.toChars());
return NULL;
}
};
public:
sp<HttpQuery::OnHttpListener> m_HttpListener;
sp<HttpPropfind::OnPropfindListener> m_PropfindListener;
AAA() {
printf("create aaa\n");
m_HttpListener = new HttpListener();
m_PropfindListener = new PropfindListener();
}
virtual ~AAA() { printf("delete aaa\n"); }
};
int main(void)
{
sp<AAA> aaa = new AAA();
sp<HttpPropfind> p = new HttpPropfind();
p->setOnHttpListener(aaa->m_HttpListener);
p->setOnPropfindListener(aaa->m_PropfindListener);
sp<Retval> ret = p->query("http://drm.client.imgtech.co.kr/webdav/");
if(ret.has()){
printf("%s\n", ret->dump().toChars());
}else{
printf("OK\n");
}
return 0;
}