HttpServer

Overview

A simple embeddable socket/http/sip server implementation is available in the razpub project. It is not a complete web server implementation, but serves most purposes. It is easy to extend/use - just start it up and mount "listeners".

You can use it as a plain socket server (i.e. ftp or something) OR, just mount the LightCmdGET and it becomes an http server with SOA support. OR extend it to handle sip requests…THAT is the point of this yet-another-web-server: extensibility. I extended the basic http protocol with ACT directives for acting on objects. These have different semantics than either GET or POST.

Features:

  • bind java code to URL
  • parse URL into map of values and viceversa
  • handles multithreaded request processing
  • handles simple authentication/authorization
  • default implementation can serve files from disk and/or classpath (keep application compact by including icons into jar file), different types of files

Roadmap:

  • support SSL
  • The truth is that it should be dumped in favor of jetty or alike :(

See more details at http://code.google.com/p/razpub/source/browse/trunk/razpub/src/com/razie/pub/http/package-info.java

Very simple architecture:

  • a "server" listens on a socket and spawns "receivers" for each incoming request
  • the received has registered a list of "handlers" which it invokes to handle the requests

A cool implementation is that the GET and POST handlers are just that: other handlers, nothing really special :)

See the examples at: http://code.google.com/p/razpub/source/browse/trunk/razpub/#razpub/test_src/com/razie/pub/http/test

Serve from jar file

It is annoying to carry files around, so why not just serve resources from the classpath. Thus, all icons for instance can be packed inside the application's jar files.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License