GlassFish behind Apache HTTP Server

You may have developed a web application using JSF or other techniques, wich runs on an application server and should be reachable from the internet. You might configure your AppServer, e.g. GlassFish, listening on port 80 directly. Usually it is better to run this behind a HTTP server, which serves static content or provides load balancing. The folowing configuration is an example how to run GlassFish behind an Apach WebServer.

Its using this scenario:

  • The application runs on localhost:8080/myapp
  • The site is reachable on http://mydomain.net
  • The site is hosted on a virtual server
  • The complete site is forwared to the AppServer
  • The modules mod_proxy.so and mod_proxy_http.so are loaded
<VirtualHost *:80>
  ServerName mydomain.net
  ServerAlias www.mydomain.net

  ServerAdmin webmaster@mydomain.net
  DocumentRoot /var/htdocs/mydomain/

  <Directory /var/htdocs/mydomain/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
  </Directory>

  ProxyRequests Off

  <Proxy *>
    Order deny,allow
    Allow from all
  </Proxy>

  ProxyPass /myapp http://localhost:8080/myapp/
  ProxyPassReverse /myapp http://localhost:8080/myapp/

</VirtualHost>

Essential is the config of ProxyPass(Reverse), which forwards the directory (“/myapp”) to the adress of your AppServer (“http://localhost:8080/myapp/”). Please treat this only as an example. For security reasons you may run Apache within your dmz and GlassFish on a different machine behind your firewall.

Maybe I provide a full commented description later on in an future article of my JSF tutorial.

 

To web development content.

JSF, mark required fields

Don’t you know this: You have an application using some dialogs and each dialog contains some required fields and some, whiche are not mandatory. To disinguish these two kinds of fields, the required fields should be marked, e.g. with an asterisk. Now, what we want to do, is to write a central function which might be used in all pages. The idea is quite simple: Before rendereing, check all labels and theis associated input components. If the input is required, mark it. Continue reading “JSF, mark required fields”

Tutorial web development (with JSF) VI: Templates

Templates

In the last part of this series, we created a second page, which looked similar to the first one. Now, we will put the common parts into a central place. To do this, we’ll create a template, which acts as kind of container for the shared part, which contains some individual information.

As a reminder, here is the souce of tese two pages:

Continue reading “Tutorial web development (with JSF) VI: Templates”

Tutorial web development (with JSF) V: Scene change

Scene change

The tiny calculator is now functional. After entering the two parameters ans clicking on one of the buttons for the basic arthimetics, you’ll get the result just below the buttons. This is well designed since the usuer usually wants to stay on this site and continues calculating. On the other side, lots of apps exists with quite a couple of pages. For example, think about a booking system or a shop. Finishing a transaction you’ll usually get es confirmation page. I like to demonstrate you something similar: The result od the addition will be presented on a different page. A button “back” leads you back to the calculator’s main page. This is not a very user friendly design, but it’s just to show you a first approach of page nagvigation.

Continue reading “Tutorial web development (with JSF) V: Scene change”

Tutorial web development (with JSF)

For a while, I had not written a new article for my tutorial. Those people, who follow me on Twitter may know about my heavy workload at the institute. Currently, I got a feedback by Andreas Schlappig, who recognized this tutorial as interesting and send me soma errata. Thus I like to tell you, I'm planning to re-start writing articles apx. at mid of April. Since I'm going to delve deeper insight, it will hopfully will continue to be interesting and helpfully.