org.qtunes.web
Class StaticWebHandler
java.lang.Object
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.
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 |
StaticWebHandler
public StaticWebHandler(ServiceContext context,
java.lang.String oldprefix,
java.lang.String newprefix,
java.lang.Class base)
- Create a new StaticWebHandler
- Parameters:
context
- the ServiceContextoldprefix
- the prefix to the incoming URI that should be matched and removednewprefix
- the prefix to the resource that should replace oldprefixbase
- the base class from which resources should be loaded
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