Drizzled Public API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
http_handler.h
1
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
*
4
* Copyright (C) 2012 Mohit Srivastava
5
*
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
*/
24
#pragma once
25
26
#include <config.h>
27
#include <evhttp.h>
28
#include <plugin/json_server/json/json.h>
29
#include <drizzled/plugin.h>
30
31
using namespace
std;
35
namespace
drizzle_plugin
36
{
40
namespace
json_server
41
{
46
class
HttpHandler
47
{
48
public
:
56
HttpHandler
(
Json::Value
& json_out,
Json::Value
json_in,
struct
evhttp_request *req);
63
bool
handleRequest();
73
bool
validate(
string
&default_schema,
string
&default_table,
bool
allow_drop_table);
79
void
sendResponse();
83
void
generateHttpError();
87
void
generateDropTableError();
92
const
char
*
getSchema
()
const
93
{
94
return
_schema;
95
}
101
const
char
*
getTable
()
const
102
{
103
return
_table;
104
}
109
const
string
&
getQuery
()
const
110
{
111
return
_query;
112
}
117
const
char
*
getId
()
const
118
{
119
return
_id;
120
}
125
const
Json::Value
getOutputJson
()
const
126
{
127
return
_json_out;
128
}
133
const
Json::Value
getInputJson
()
const
134
{
135
return
_json_in;
136
}
141
void
setOutputJson
(
Json::Value
& json_out)
142
{
143
_json_out=json_out;
144
}
145
146
private
:
150
const
char
*
_schema
;
154
const
char
*
_table
;
158
string
_query
;
162
const
char
*
_id
;
166
Json::Value
_json_out
;
170
Json::Value
_json_in
;
174
int
_http_response_code
;
178
const
char
*
_http_response_text
;
182
struct
evhttp_request *
_req
;
183
};
184
185
}
186
}
plugin
json_server
http_handler.h
Generated on Tue Oct 29 2013 17:05:48 for drizzle by
1.8.4