1
0
Fork 0
arangodb/mr/server/mr-server.h

178 lines
5.7 KiB
C

static string MR_server_server =
"################################################################################\n"
"### @brief error handling\n"
"###\n"
"### @file\n"
"###\n"
"### DISCLAIMER\n"
"###\n"
"### Copyright 2012 triagens GmbH, Cologne, Germany\n"
"###\n"
"### Licensed under the Apache License, Version 2.0 (the \"License\");\n"
"### you may not use this file except in compliance with the License.\n"
"### You may obtain a copy of the License at\n"
"###\n"
"### http://www.apache.org/licenses/LICENSE-2.0\n"
"###\n"
"### Unless required by applicable law or agreed to in writing, software\n"
"### distributed under the License is distributed on an \"AS IS\" BASIS,\n"
"### WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n"
"### See the License for the specific language governing permissions and\n"
"### limitations under the License.\n"
"###\n"
"### Copyright holder is triAGENS GmbH, Cologne, Germany\n"
"###\n"
"### @author Dr. Frank Celler\n"
"### @author Copyright 2012, triAGENS GmbH, Cologne, Germany\n"
"################################################################################\n"
"\n"
"module Arango\n"
"\n"
"## -----------------------------------------------------------------------------\n"
"## --SECTION-- HttpRequest\n"
"## -----------------------------------------------------------------------------\n"
"\n"
" class HttpRequest\n"
" def body()\n"
" return @body\n"
" end\n"
"\n"
" def headers()\n"
" return @headers\n"
" end\n"
"\n"
" def parameters()\n"
" return @parameters\n"
" end\n"
"\n"
" def request_type()\n"
" return @request_type\n"
" end\n"
"\n"
" def suffix()\n"
" return @suffix\n"
" end\n"
" end\n"
"\n"
"## -----------------------------------------------------------------------------\n"
"## --SECTION-- HttpResponse\n"
"## -----------------------------------------------------------------------------\n"
"\n"
" class HttpResponse\n"
" def content_type()\n"
" return @content_type\n"
" end\n"
"\n"
" def content_type=(type)\n"
" @content_type = type\n"
" end\n"
"\n"
" def body()\n"
" return @body\n"
" end\n"
"\n"
" def body=(text)\n"
" @body = text.to_s\n"
" end\n"
" def status()\n"
" return @status\n"
" end\n"
"\n"
" def status=(code)\n"
" @status = code.to_i\n"
" end\n"
" end\n"
"\n"
"## -----------------------------------------------------------------------------\n"
"## --SECTION-- AbstractServlet\n"
"## -----------------------------------------------------------------------------\n"
"\n"
" class AbstractServlet\n"
" @@HTTP_OK = 200\n"
" @@HTTP_CREATED = 201\n"
" @@HTTP_ACCEPTED = 202\n"
" @@HTTP_PARTIAL = 203\n"
" @@HTTP_NO_CONTENT = 204\n"
"\n"
" @@HTTP_MOVED_PERMANENTLY = 301\n"
" @@HTTP_FOUND = 302\n"
" @@HTTP_SEE_OTHER = 303\n"
" @@HTTP_NOT_MODIFIED = 304\n"
" @@HTTP_TEMPORARY_REDIRECT = 307\n"
"\n"
" @@HTTP_BAD = 400\n"
" @@HTTP_UNAUTHORIZED = 401\n"
" @@HTTP_PAYMENT = 402\n"
" @@HTTP_FORBIDDEN = 403\n"
" @@HTTP_NOT_FOUND = 404\n"
" @@HTTP_METHOD_NOT_ALLOWED = 405\n"
" @@HTTP_CONFLICT = 409\n"
" @@HTTP_PRECONDITION_FAILED = 412\n"
" @@HTTP_UNPROCESSABLE_ENTITY = 422\n"
"\n"
" @@HTTP_SERVER_ERROR = 500\n"
" @@HTTP_NOT_IMPLEMENTED = 501\n"
" @@HTTP_BAD_GATEWAY = 502\n"
" @@HTTP_SERVICE_UNAVAILABLE = 503\n"
"\n"
" def service(req, res)\n"
" p \"Body: <#{req.body}>\"\n"
" p \"Headers: <#{req.headers}>\"\n"
" p \"Parameters: <#{req.parameters}>\"\n"
" p \"RequestType: <#{req.request_type}>\"\n"
" p \"Suffix: <#{req.suffix}>\"\n"
"\n"
" method = req.request_type\n"
"\n"
" if method == \"GET\"\n"
" self.do_GET(req, res)\n"
" elsif method == \"PUT\"\n"
" self.do_PUT(req, res)\n"
" elsif method == \"POST\"\n"
" self.do_POST(req, res)\n"
" elsif method == \"DELETE\"\n"
" self.do_DELETE(req, res)\n"
" elsif method == \"HEAD\"\n"
" self.do_HEAD(req, res)\n"
" else\n"
" generate_unknown_method(req, res, method)\n"
" end\n"
" end\n"
"\n"
" def do_GET(req, res)\n"
" res.status = @@HTTP_METHOD_NOT_ALLOWED\n"
" end\n"
"\n"
" def do_PUT(req, res)\n"
" res.status = @@HTTP_METHOD_NOT_ALLOWED\n"
" end\n"
"\n"
" def do_POST(req, res)\n"
" res.status = @@HTTP_METHOD_NOT_ALLOWED\n"
" end\n"
"\n"
" def do_DELETE(req, res)\n"
" res.status = @@HTTP_METHOD_NOT_ALLOWED\n"
" end\n"
"\n"
" def do_HEAD(req, res)\n"
" res.status = @@HTTP_METHOD_NOT_ALLOWED\n"
" end\n"
"\n"
" def generate_unknown_method(req, res, method)\n"
" res.status = @@HTTP_METHOD_NOT_ALLOWED\n"
" end\n"
" end\n"
"\n"
"end\n"
"\n"
"## -----------------------------------------------------------------------------\n"
"## --SECTION-- END-OF-FILE\n"
"## -----------------------------------------------------------------------------\n"
"\n"
"## Local Variables:\n"
"## mode: outline-minor\n"
"## outline-regexp: \"^\\\\(### @brief\\\\|## --SECTION--\\\\|# -\\\\*- \\\\)\"\n"
"## End:\n"
;