summaryrefslogtreecommitdiffhomepage
path: root/NetEx/HttpServlet.h
blob: eb706eab452896c97dc02b691a82e484335abb1e (plain)
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
/*  Starshatter: The Open Source Project
    Copyright (c) 2021-2022, Starshatter: The Open Source Project Contributors
    Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors
    Copyright (c) 1997-2006, Destroyer Studios LLC.

    AUTHOR:       John DiCamillo


    OVERVIEW
    ========
    Network Server Pump for HTTP Server
*/

#ifndef HttpServlet_h
#define HttpServlet_h

#include "HttpRequest.h"
#include "HttpResponse.h"
#include "HttpSession.h"


class HttpServlet
{
public:
    static const char* TYPENAME() { return "HttpServlet"; }

    HttpServlet();
    virtual ~HttpServlet();

    virtual bool      Service(HttpRequest& request, HttpResponse& response);

    virtual bool      DoGet(HttpRequest& request,  HttpResponse& response);
    virtual bool      DoPost(HttpRequest& request, HttpResponse& response);
    virtual bool      DoHead(HttpRequest& request, HttpResponse& response);

    virtual HttpSession* GetSession()               { return session; }
    virtual void         SetSession(HttpSession* s) { session = s; }

protected:
    HttpSession*      session;
};


#endif  // HttpServlet_h