3

Actually I have a Java application running on a Linux server as daemon. Now I'll provide a simple web-based configuration page. I have no clue how to solve this without using big frameworks.

What I fell that I don't want is to use Java EE or sth like this. A "small" free (for commercial use) library is ok.

Any ideas?

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
tuergeist
  • 9,171
  • 3
  • 37
  • 58

5 Answers5

3

I would recommend you to use Jetty(it is probably most Java lightweight server) with pure Servlets and JSP. If you need only one or two pages with few configuration options then any framework seem to me like unnessecary overkill.

Petr Mensik
  • 26,874
  • 17
  • 90
  • 115
2

I can recommend play framework if you want to stay in the java space or if you are adventurous you might consider any number of microframeworks/environments in other languages.

  • flask(python)
  • scalatra(scala)
  • meteor.js(javascript)
  • node.js(javascript)
  • twisted(python)
  • sinatra(ruby)

All of these offer very lightweight web servers(Often allowing you to create dynamic web content in just a few lines) in conjunction with languages that have os integration that will allow you to manage the configuration and status of your application.

nsfyn55
  • 14,875
  • 8
  • 50
  • 77
  • Play seems a little bit too much for serving one page. – tuergeist Oct 05 '12 at 18:16
  • Eh its a matter of opinion. The play binary is a very flexible console app based on sbt. It has a nice convenient set of commands one of which generates a Skeleton Web project. I mean why would you limit yourself to something less feature rich just because you are only servng one Page? What's the benefit? its not like you have to write those features yourself. Are you really itching to write a bunch of routing xml in a deployment descriptor? – nsfyn55 Oct 05 '12 at 23:56
1

You can use Apache Tomcat or Jetty.

Pradeep Pati
  • 5,779
  • 3
  • 29
  • 43
  • Thank you for your answer, but do you think tomcat is a small library? And how should I use Jetty for one webpage? Could you provide an example? – tuergeist Oct 05 '12 at 17:43
  • I believe Tomcat is the smallest Java server which is reasonably easy to develop with You can have a look at the pages at http://wiki.eclipse.org/Jetty/Starting You write the regular servlet/jsp. And then run them with jetty. – Pradeep Pati Oct 05 '12 at 17:50
  • Jetty looks good, it seems to extended com.sun.net.httpserver which is also ok. – tuergeist Oct 05 '12 at 18:00
1

Look into com.sun.net.httpserver if you are using the jre. It's already there any very easy the embed.

Wolfgang Kuehn
  • 12,206
  • 2
  • 33
  • 46
1

For configurations you can also use JMX. The jconsole can easily access your application and there is also a JMX HTTP adapter. This adapter allows you to monitor the setting and also change them. This gives you a web page for free but of course its not a "pretty" page.

Christian Ullenboom
  • 1,388
  • 3
  • 24
  • 20
  • JMX is a good idea. But it seems not that easy to use and really not pretty... Btw. I really like your Java ist auch eine Insel books ;) – tuergeist Oct 05 '12 at 18:15