Code Monkey home page Code Monkey logo

mod_servlet's Introduction

C++ Servlet API and container

This is where simplicity of Servlet API, power of C++ language and performance of Apache2 httpd server meet!

This is my attempt to implement C++ API for server side web development. The API is based on Java Servlet API. The container is implemented as an Apache2 module.

What is a servlet anyways? A servlet is a server-resident program that typically runs automatically in response to user request. It can process user input and/or generate the output dynamically.

The features of mod_servlet API:

  • Servlets;
  • Filters;
  • Sessions;
  • Cookies;
  • Redirects
  • Server side forwards and includes;
  • SSL related information;
  • Request streams, including multipart uploads;
  • Serving static content from web application;
  • and probably a lot of other stuff I cannot remember now.

How a simple HTML generating servlet looks like? This is how:

#include <iostream>
#include <servlet/servlet.h>

struct hello_servlet : public servlet::http_servlet
{
    void do_get(http_request& req, http_response& resp) override
    {
        resp.set_content_type("text/html");
        resp.get_output_stream() << "<h1>Hello, mod_servlet!</h1>";
    }
};

SERVLET_EXPORT(helloServlet, hello_servlet)

Full example with build instructions is here. You also get with it exceptional performance. Interested?

You'll need to build and install it first. Then configure it with Apache2. And you are ready to start development of your own web applications. Extensive API reference is also available.

Documentation pages:

mod_servlet's People

Contributors

novalexei avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.