Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple Java stand-alone server container/framework?

Tags:

java

For the last couple of years I've had my head in Python, where there are numerous choices for simple, minimal frameworks that allow me to stand up a website or service easily (eg. web.py). I'm looking for something similar in Java.

What is the simplest, least-moving-parts way of standing up simple services using Java these days? I'm looking for something as simple as:

  • the ability to receive HTTP requests
  • the ability to dispatch those requests to handlers (preferably a regular expression based url to handler mapping facility)
  • the ability to set HTTP headers and generally fully control the request/response

Bonus points if the framework plays well with Jython.

[Update] Thanks for the responses, some of these look quite interesting. I'm not seeing the url dispatch capability in these, however. I'm looking for something similar to Django's url.py system, which looks like:

urlpatterns = patterns('',
    (r'^articles/2003/$', 'news.views.special_case_2003'),
    (r'^articles/(\d{4})/$', 'news.views.year_archive'),
    (r'^articles/(\d{4})/(\d{2})/$', 'news.views.month_archive'),
    (r'^articles/(\d{4})/(\d{2})/(\d+)/$', 'news.views.article_detail'),
)

Where you specify a url regular expression along with the handler that handles it.

like image 585
Parand Avatar asked Jul 15 '09 18:07

Parand


1 Answers

I liked to worth the Simple HTTP Server from the Simple Framework. It offers a nice Tutorial about how to start as well.

like image 190
Daff Avatar answered Oct 28 '22 10:10

Daff