org.hd.d.pg2k.webSvr.catalogue
Class TreeFilterServletBase

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.hd.d.pg2k.webSvr.catalogue.TreeFilterServletBase
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
Direct Known Subclasses:
TreeFilterServletAllExhibits, TreeFilterServletAllIcons

public abstract class TreeFilterServletBase
extends javax.servlet.http.HttpServlet

Servlet to do filtering and selection of one tree of exhibits for display. Sub-classes must implement getTitleCommonCatalogueName() and getFilter().

See Also:
Serialized Form

Field Summary
private  TreeFilterBean tfb
          Bean that holds cache of selected data in tree-form for us.
 
Constructor Summary
TreeFilterServletBase()
           
 
Method Summary
 void destroy()
          This clears the cache in the filter bean.
protected  void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Handle a GET request.
protected  Breadcrumbs getBreadcrumbs(LocaleBeanBase localeBean)
          Get Breadcrumbs; null if none.
protected  java.lang.String getDescriptionCommonCatalogueName()
          Get descriptive text (i18n-ed if possible); null if none.
protected abstract  Expr getFilter()
          Get the filter expression to apply.
protected abstract  java.lang.String getTitleCommonCatalogueName()
          Get (short) title text common catalogue name; null if none.
 void init()
          Initialises the servlet the filter bean.
static java.lang.String makeOfficialURI(java.lang.CharSequence baseURI, java.lang.CharSequence prwseq)
          Function to provide full "official" URI for page given base URI and word prefix.
static boolean redirectIfCanonicalisationNeeded(TreeFilterBean tfb, javax.servlet.http.HttpServletResponse response, java.lang.String baseURI, java.lang.CharSequence wsPrefix, javax.servlet.ServletContext context, java.util.List<java.lang.CharSequence> nodeContent)
          302 TEMP REDIRECTS FOR NODES THAT CURRENTLY DUPLICATE THEIR PARENT NODE.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tfb

private final TreeFilterBean tfb
Bean that holds cache of selected data in tree-form for us. Only created at init().

Constructor Detail

TreeFilterServletBase

public TreeFilterServletBase()
Method Detail

doGet

protected void doGet(javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response)
              throws javax.servlet.ServletException,
                     java.io.IOException
Handle a GET request. Ultimately we will internally redirect to the tree-display JSP, unless:

Overrides:
doGet in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
java.io.IOException

redirectIfCanonicalisationNeeded

public static boolean redirectIfCanonicalisationNeeded(TreeFilterBean tfb,
                                                       javax.servlet.http.HttpServletResponse response,
                                                       java.lang.String baseURI,
                                                       java.lang.CharSequence wsPrefix,
                                                       javax.servlet.ServletContext context,
                                                       java.util.List<java.lang.CharSequence> nodeContent)
                                                throws java.io.IOException,
                                                       java.lang.IllegalStateException
302 TEMP REDIRECTS FOR NODES THAT CURRENTLY DUPLICATE THEIR PARENT NODE.

Returns:
true if a redirect has been done, so the caller should return immediately and not try to generate any page content.
Throws:
java.io.IOException
java.lang.IllegalStateException

destroy

public void destroy()
This clears the cache in the filter bean. We chain to super.destroy() to tidy up the underlying generic servlet.

Specified by:
destroy in interface javax.servlet.Servlet
Overrides:
destroy in class javax.servlet.GenericServlet

init

public void init()
          throws javax.servlet.ServletException
Initialises the servlet the filter bean. Derived class can choose to override it but should chain to it if so.

This sets the memory sensitivity and the filter expression.

Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException

getFilter

protected abstract Expr getFilter()
Get the filter expression to apply. Override in derived classes.


getTitleCommonCatalogueName

protected abstract java.lang.String getTitleCommonCatalogueName()
Get (short) title text common catalogue name; null if none. The expanded text should be 7-bit printable ASCII, possibly with embedded entities and mark-up.

Override in derived classes.


getDescriptionCommonCatalogueName

protected java.lang.String getDescriptionCommonCatalogueName()
Get descriptive text (i18n-ed if possible); null if none. The expanded text should be 7-bit printable ASCII, possibly with embedded entities and mark-up.

Defaults to null (no descriptive text).

Override as needed in derived classes.


getBreadcrumbs

protected Breadcrumbs getBreadcrumbs(LocaleBeanBase localeBean)
Get Breadcrumbs; null if none. By default, just a link to the top of the virtual collections, but can either be added to or replaced by an overriding class.


makeOfficialURI

public static java.lang.String makeOfficialURI(java.lang.CharSequence baseURI,
                                               java.lang.CharSequence prwseq)
Function to provide full "official" URI for page given base URI and word prefix. Note that the URI that this returns always ends with a slash to unambiguously mark the whole thing as a directory; no trailing "welcome" file component is added nor should be.

The suffix is also forced to lower-case to ensure canonicalisation.

Parameters:
baseURI - base URI for this tree; never null
prwseq - prefix word sequence, "" or lower-case word sequence ending in a hyphen.

DHD Multimedia Gallery V1.53.0

Copyright (c) 1996-2009, Damon Hart-Davis. All rights reserved.