org.qtunes.web
Class StaticWebHandler

java.lang.Object
  extended by org.qtunes.web.StaticWebHandler
All Implemented Interfaces:
WebHandler

public class StaticWebHandler
extends java.lang.Object
implements WebHandler

A StaticWebHandler returns a static resource. Caching is done internally - it's assumed resources are loaded from Jars so are unchanging. Pre-compressed versions of a resource may be stored with a ".gz" suffix and will be returned if found.


Field Summary
 
Fields inherited from interface org.qtunes.web.WebHandler
DATEFORMAT
 
Constructor Summary
StaticWebHandler(ServiceContext context, java.lang.String oldprefix, java.lang.String newprefix, java.lang.Class base)
          Create a new StaticWebHandler
 
Method Summary
 java.lang.String getPrefix()
           
 void handle(WebConnection con)
           
 void setEncoding(java.lang.String encoding)
          Set the encoding for any text resources (txt, html, css, js) that are served by this handler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StaticWebHandler

public StaticWebHandler(ServiceContext context,
                        java.lang.String oldprefix,
                        java.lang.String newprefix,
                        java.lang.Class base)
Create a new StaticWebHandler

Parameters:
context - the ServiceContext
oldprefix - the prefix to the incoming URI that should be matched and removed
newprefix - the prefix to the resource that should replace oldprefix
base - the base class from which resources should be loaded
Method Detail

setEncoding

public void setEncoding(java.lang.String encoding)
Set the encoding for any text resources (txt, html, css, js) that are served by this handler. The default encoding is "UTF-8"


getPrefix

public java.lang.String getPrefix()

handle

public void handle(WebConnection con)
            throws java.io.IOException
Specified by:
handle in interface WebHandler
Throws:
java.io.IOException