March 17, 2010

Filling the Gaps with Resin

Posted in Uncategorized at 7:37 pm by dgcombs

I needed a way to show off the quick reports I was generating. I could have created a fabulous document in Word or Writer or Pages. But I thought, why not use a website? Cliche or not, a website provides much more fluid and flexible than the outcome of any of these programs the end product of which is a sheet of paper. I got plenty of those. Choosing a web server to host is more complicated. I could use Windows and IIS or run Linux and Apache. But I thought, just for fun, I’d use something completely different, Resin.

Resin is a Java-based application server rather than a web server. The difference is that Java applications can bundled up in a WAR file, dropped into the proper directory and Resin will unpack, install and run them. For quite some time, I ran a Blojsom blog which came as a WAR file on Resin. Caucho, the company that wrote and sells Resin also has a product called Quercus which is a native Java implementation of PHP (the software of choice for many web applications) that is actually faster than C implementations. The theory being that you can run a PHP-based application faster and more efficiently in a fully Java environment. Ya gotta love that!

One of the things that I like about Resin is that it can run as a light weight, stand-alone web/application server. Oh, it can integrate with IIS or Apache, too. But I’ve never understood why you’d want to do that. The Resin component is perfectly capable of serving up application (using Java Servlets and .JSP files) while at the same time serving up .HTML files.

Resin is also able to work in a clustered environment as well. In fact, by default, the resin configuration is “clustered” even though it’s a cluster consisting of a single server.

Clustered Resin Server

Clustered Server Concept

My default configuration, though, is a single server with a single directory serving up JSP and HTML web pages with appropriate CSS and HTML5 so that it looks good. I customize the minimal configuration file to support this and provide a small report.

<resin xmlns="http://caucho.com/ns/resin"
       xmlns:resin="urn:java:com.caucho.resin">

  <cluster-default>
    <resin:import path="${__DIR__}/app-default.xml"/>
    <development-mode-error-page/>
  </cluster-default>

  <cluster id="app-tier">
    <server id="" address="127.0.0.1" port="6800">
      <http port="8080"/>
    </server>

    <host id="">
      <web-app id="">
        <root-directory>/var/www/ROOT</root-directory>
      </web-app>
    </host>
  </cluster>

</resin>

Some applications require an odd URL. Drupal, MediaWiki and pmWiki are examples. Resin handles these by providing a rewrite function configurable using a combination of XML and regular expressions. Fortunately, I did not need to explore this far into the Resin cave to extract my golden nugget.

Outbound Connections by Protocol

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: