org.meshcms.extra
Class StaticExporter

java.lang.Object
  extended byjava.lang.Thread
      extended byorg.meshcms.util.DirectoryParser
          extended byorg.meshcms.extra.StaticExporter
All Implemented Interfaces:
java.lang.Runnable

public class StaticExporter
extends DirectoryParser

Performs the export of a website in static files (for use with the Apache web server or any other one).


Field Summary
static java.lang.String REQUEST_ATTRIBUTE_CHECK
           
static java.lang.String USER_AGENT
           
static java.lang.String USER_AGENT_HEADER
           
 
Fields inherited from class org.meshcms.util.DirectoryParser
initialDir, processStartDir, recursive
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
StaticExporter(WebSite webSite, java.net.URL contextURL, java.io.File staticDir)
          Creates an instance.
 
Method Summary
 boolean getCheckDates()
          Returns the value of the date check option.
 java.net.URL getContextURL()
          Returns the context URL.
 java.io.File getStaticDir()
          Returns the static directory.
 java.io.Writer getWriter()
          Returns the writer (if any).
 boolean isExportable(Path path)
           
static boolean isExportRequest(javax.servlet.http.HttpServletRequest request)
           
protected  void postProcess()
          This method is called at the end of the processing.
protected  boolean preProcessDirectory(java.io.File file, Path path)
           
 void process()
          Starts processing.
protected  void processFile(java.io.File file, Path path)
          This method will be called for any file found while parsing the base directory.
 void setCheckDates(boolean checkDates)
          Sets the date check to on or off.
 void setContextURL(java.net.URL contextURL)
          Sets the context URL.
 void setStaticDir(java.io.File staticDir)
          Sets the static directory.
 void setWriter(java.io.Writer writer)
          Sets the writer for logging (usually the writer of the web page).
 
Methods inherited from class org.meshcms.util.DirectoryParser
getInitialDir, isProcessStartDir, isRecursive, isSorted, postProcessDirectory, preProcess, run, setInitialDir, setInitialDir, setProcessStartDir, setRecursive, setSorted
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

REQUEST_ATTRIBUTE_CHECK

public static final java.lang.String REQUEST_ATTRIBUTE_CHECK
See Also:
Constant Field Values

USER_AGENT_HEADER

public static final java.lang.String USER_AGENT_HEADER
See Also:
Constant Field Values

USER_AGENT

public static final java.lang.String USER_AGENT
Constructor Detail

StaticExporter

public StaticExporter(WebSite webSite,
                      java.net.URL contextURL,
                      java.io.File staticDir)
Creates an instance.

Parameters:
staticDir - the directory where files should be exported
Method Detail

setStaticDir

public void setStaticDir(java.io.File staticDir)
Sets the static directory.


getStaticDir

public java.io.File getStaticDir()
Returns the static directory.


setContextURL

public void setContextURL(java.net.URL contextURL)
Sets the context URL.


getContextURL

public java.net.URL getContextURL()
Returns the context URL.


setCheckDates

public void setCheckDates(boolean checkDates)
Sets the date check to on or off. If the date check is on, only newer files are copied. HTML are always recreated regardless of this option. Default is true (recommended).


getCheckDates

public boolean getCheckDates()
Returns the value of the date check option.


setWriter

public void setWriter(java.io.Writer writer)
Sets the writer for logging (usually the writer of the web page).


getWriter

public java.io.Writer getWriter()
Returns the writer (if any).


postProcess

protected void postProcess()
Description copied from class: DirectoryParser
This method is called at the end of the processing. It is called even if DirectoryParser.preProcess() returned false.

The base implementation does nothing.

Overrides:
postProcess in class DirectoryParser

preProcessDirectory

protected boolean preProcessDirectory(java.io.File file,
                                      Path path)
Overrides:
preProcessDirectory in class DirectoryParser

processFile

protected void processFile(java.io.File file,
                           Path path)
Description copied from class: DirectoryParser
This method will be called for any file found while parsing the base directory.

Overrides:
processFile in class DirectoryParser
Parameters:
file - the file to be processed
path - the path of the file (relative to the base directory)

isExportable

public boolean isExportable(Path path)

process

public void process()
Description copied from class: DirectoryParser
Starts processing.

Overrides:
process in class DirectoryParser

isExportRequest

public static boolean isExportRequest(javax.servlet.http.HttpServletRequest request)