public abstract class WebSite extends Object
Dispatcher
creates one instance of the class named
Main
from the default package. (Another class name can be
selected using a servlet initialization parameter named
MainClass
with the class of interest as value.) That class must
be a subclass of dk.brics.jwig.WebSite
(or
dk.brics.jwig.WebApp
for a web site consisting of only one web
app). The init()
method in the Main
class constructs
WebApp
objects and adds them to the site using add(WebApp)
.
Configuration properties can be set in jwig.properties
and/or
using setProperty(String, Object)
during initialization.
Name | Description | Default value |
---|---|---|
jwig.base_url | absolute base URL | auto-detect (should be set if using a proxy server) |
jwig.base_url_secure | absolute base URL for secure connections | auto-detect (should be set if using proxy server or another port than 443 for https) |
jwig.session_timeout | default session timeout (minutes) | 1440 (=one day) |
jwig.max_sessions | maximum number of sessions allowed | 1000 |
jwig.auto_refresh_sessions | if set, sessions are automatically updated while a page is being viewed | true |
jwig.cache_max_pages | maximal number of response pages to cache in memory | 25 |
jwig.fileupload_memory_threshold | file uploads above this size (in bytes) are stored on disk instead of in memory | 100000 |
jwig.fileupload_tmpdir | directory for file upload storage (relative to the
Dispatcher home directory)
| as the java.io.tmpdir system property (e.g. the Tomcat
temp directory)
|
jwig.fileupload_maxsize | maximal size (in bytes) for each file upload (-1 = no limit) | -1 |
jwig.multipart_maxsize | maximal size (in bytes) for multipart/form-data requests (-1 = no limit) | 100000000 |
jwig.max_long_polling | maximal number of long polling connections (used for XMLProducer )
| 1000 |
jwig.logo | if set, JWIG logo is added to all XML pages | true |
jwig.hibernate | if set, Hibernate is enabled | false |
mail.* | configuration of JavaMail (used by sendEmail )
| none set |
hibernate.* | configuration of Hibernate (see dk.brics.jwig.persistence) | see below |
log4j.* | configuration of log4j (see WebContext.log )
| see below |
Name | Default value |
---|---|
hibernate.connection.driver_class | com.mysql.jdbc.Driver |
hibernate.dialect | org.hibernate.dialect.MySQLDialect |
hibernate.connection.pool_size | 10 |
hibernate.transaction.factory_class | org.hibernate.transaction.JDBCTransactionFactory |
hibernate.cache.provider_class | org.hibernate.cache.HashtableCacheProvider |
hibernate.hbm2ddl.auto | update |
hibernate.show_sql | false |
hibernate.current_session_context_class | dk.brics.jwig.persistence.JwigCurrentSessionContext |
hibernate.c3p0.acquire_increment | 1 |
hibernate.c3p0.idle_test_period | 1000 |
hibernate.c3p0.max_size | 100 |
hibernate.c3p0.max_statements | 0 |
hibernate.c3p0.min_size | 3 |
hibernate.c3p0.timeout | 100 |
hibernate.c3p0.acquireRetryAttempts | 1 |
Name | Default value |
---|---|
log4j.rootLogger | INFO, jwig |
log4j.appender.jwig | org.apache.log4j.ConsoleAppender |
log4j.appender.jwig.layout | org.apache.log4j.PatternLayout |
log4j.appender.jwig.layout.ConversionPattern | %d{dd MMM yyyy HH:mm:ss,SSS} [%t] %p %c - %m%n |
Constructor and Description |
---|
WebSite()
Constructs a new web site object.
|
Modifier and Type | Method and Description |
---|---|
protected void |
add(WebApp app)
Adds a new web application to this web site.
|
void |
close()
Closes the hibernate session factory (if any) and calls the
destroy()
method which may be overridden by the client. |
void |
destroy()
Invoked when the JWIG server stops, for cleaning up after web apps.
|
Cache |
getCache()
Return a new instance of the cache implementation that is used in this
web site.
|
String |
getCacheAugmentationString()
Returns the string used to seperate two entries with the same URL in the
cache.
|
Map<String,Object> |
getProperties()
Returns the web site configuration properties.
|
<T> T |
getProperty(String name)
Returns the web site configuration property value for the given name.
|
<T> T |
getProperty(String name,
T defaultvalue)
Returns the configuration property value for the given name, with a
default value.
|
Querier |
getQuerier()
Gets the querier that should be used to query object from the database.
|
List<WebApp> |
getWebApps()
Returns the list of web application objects of this web site.
|
abstract void |
init()
Invoked when the JWIG server starts, for constructing web apps (
WebApp objects) and other initialization. |
XML |
sendError(int status_code,
String msg)
Creates an error message string to be send to the client.
|
XML |
sendError(int status_code,
XML msg) |
XML |
sendError(int status_code,
XML msg,
boolean standalone)
Creates an error message string to be send to the client.
|
void |
setProperty(String name,
Object value)
Sets a web site configuration property.
|
public WebSite() throws JWIGException
jwig.properties
obtained from the
class loader.JWIGException
- if an error occurred when reading configuration propertiesprotected final void add(WebApp app)
init()
.app
- web application objectpublic final void close()
destroy()
method which may be overridden by the client.public void destroy()
public Cache getCache()
public String getCacheAugmentationString()
public Map<String,Object> getProperties()
public final <T> T getProperty(String name)
WebApp.getProperty(String)
public final <T> T getProperty(String name, T defaultvalue)
ClassCastException
- if the actual type cannot be converted to the type of the
default valuepublic Querier getQuerier()
HibernateQuerier
if
jwig.hibernate
is enabled, otherwise a placeholder querier.public final List<WebApp> getWebApps()
public abstract void init()
WebApp
objects) and other initialization.public XML sendError(int status_code, String msg)
status_code
- HTTP status codemsg
- message stringpublic XML sendError(int status_code, XML msg, boolean standalone)
status_code
- HTTP status codemsg
- message document bodypublic final void setProperty(String name, Object value)
WebApp.setProperty(String, Object)
Copyright © 2008-2012 Anders Møller & Mathias Schwarz.