org.weborganic.berlioz.servlet
Class BerliozConfig

java.lang.Object
  extended by org.weborganic.berlioz.servlet.BerliozConfig

public final class BerliozConfig
extends Object

Defines the configuration uses by a a Berlioz Servlet.

Since:
Berlioz 0.8.1
Version:
Berlioz 0.9.0 - 13 October 2011
Author:
Christophe Lauret

Method Summary
 boolean enableCompression()
          Indicates whether HTTP compression is enabled for the Berlioz configuration.
 String getCacheControl()
          Returns the default cache control instruction.
 String getContentType()
          Returns the content type.
 Environment getEnvironment()
          Returns the environment.
 long getETagSeed()
          Return the ETag Seed.
 long getExpiryDate()
          Expiry date is a year from now.
static GeneratorListener getListener()
           
 String getName()
          Returns the name of this configuration, usually the servlet name.
 XSLTransformer getTransformer(Service service)
          Returns the XSLT transformer for the specified service.
 boolean hasControl(javax.servlet.ServletRequest req)
          Indicates whether this configuration can be controlled by the user.
static BerliozConfig newConfig(javax.servlet.ServletConfig servletConfig)
          Creates a new config for a given Servlet config.
 void resetETagSeed()
          Resets the ETag Seed.
 void setContentType(String contentType)
          Sets the content type.
static void setListener(GeneratorListener listener)
           
static boolean unregister(BerliozConfig config)
          Creates a new config for a given Servlet config.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getName

public String getName()
Returns the name of this configuration, usually the servlet name.

Returns:
the name of this configuration, usually the servlet name.

getEnvironment

public Environment getEnvironment()
Returns the environment.

Returns:
the environment.

getETagSeed

public long getETagSeed()
Return the ETag Seed.

Returns:
the ETag Seed.

resetETagSeed

public void resetETagSeed()
Resets the ETag Seed.


getExpiryDate

public long getExpiryDate()
Expiry date is a year from now.

Returns:
One year into the future.

getCacheControl

public String getCacheControl()
Returns the default cache control instruction.

Returns:
the cache control.

getContentType

public String getContentType()
Returns the content type.

Returns:
the content type.

enableCompression

public boolean enableCompression()
Indicates whether HTTP compression is enabled for the Berlioz configuration.

Returns:
true to enable HTTP compression; false otherwise.

setContentType

public void setContentType(String contentType)
Sets the content type.

Parameters:
contentType - the content type.

hasControl

public boolean hasControl(javax.servlet.ServletRequest req)
Indicates whether this configuration can be controlled by the user.

Parameters:
req - the request including the control key is specified as a request parameter
Returns:
true if no key has been configured or the berlioz-control matches the control key; false otherwise.

getTransformer

public XSLTransformer getTransformer(Service service)
Returns the XSLT transformer for the specified service.

Parameters:
service - the service which requires a transformer.
Returns:
the corresponding XSLT transformer.

newConfig

public static BerliozConfig newConfig(javax.servlet.ServletConfig servletConfig)
Creates a new config for a given Servlet config.

Parameters:
servletConfig - The servlet configuration.
Returns:
A new Berlioz config.

unregister

public static boolean unregister(BerliozConfig config)
Creates a new config for a given Servlet config.

Parameters:
config - The Berlioz configuration to unregister.
Returns:
true if the config was unregistered; false otherwise.

setListener

public static void setListener(GeneratorListener listener)
Parameters:
listener - the listener to set

getListener

public static GeneratorListener getListener()
Returns:
the listener currently in use.