jacquard 1.12.0 by The Web Engineering Factory and Toolworks

uk.co.weft.htform
Class CompositeStylesheetSample

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended byuk.co.weft.maybeupload.MaybeUploadServlet
              extended byuk.co.weft.htform.Servlet
                  extended byuk.co.weft.htform.WithExceptionHandlerServlet
                      extended byuk.co.weft.htform.Page
                          extended byuk.co.weft.htform.CompositeStylesheetSample
All Implemented Interfaces:
ResourceConsumer, java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class CompositeStylesheetSample
extends Page

generate a page with sample content to show off the stylesheets selected in a CompositeStylesheetWidget, q.v. The stylesheets to be used can be specified in one of two ways: by passing a parameter stylesheets bound to a comma-separated list of stylesheet URLs, or by passing a parameter whose name is the value of masterkey. If both are passed the value of stylesheets will take precendence.

This servlet generates no body content and is expected to take its content from a head include file. You may want to specialise this and generate some particular content, if the head include solution does not owrk for you.

This servlet knows about the following configuration parameters:

master_key
String: a token which will be bound to a value in the context which when substituted into the query will identify the relevent stylesheet URLs in the database. Optional. Defaults to key.
query
String: a SQL query which will retrieve just the stylesheet URLs from the database, with a single question mark '?' indicating where the masterkey value should be substituted. Optional. No default.

Since:
Jacquard 1.9
Version:
$Revision: 1.4.4.1 $ This revision: $Author: simon $
Author:
Simon Brooke
See Also:
CompositeStylesheetWidget, Serialized Form

Field Summary
protected  java.lang.String masterkey
          the name of the token in the context which will be bound to the key value
protected  java.lang.String query
          query template to use for querying the database.
 
Fields inherited from class uk.co.weft.htform.Page
DOCTYPECONFIGTOKEN, dynamicFootInclude, dynamicHeadInclude, footInclude, footIncludeURL, headInclude, headIncludeURL, imageUrlBase, layout, printStylesheet, PRINTSTYLESHEETCONFIGTOKEN, stylesheet, STYLESHEETCONFIGTOKEN, title, titleMagicToken, TITLEMAGICTOKEN
 
Fields inherited from class uk.co.weft.htform.WithExceptionHandlerServlet
EXCEPTIONHANDLERCLASSCONFIGTOKEN
 
Fields inherited from class uk.co.weft.htform.Servlet
calendar, conf, contentType, CONTENTTYPECONFIGTOKEN, cookieDomain, cookiePath, COOKIESCONFIGTOKEN, cookieTTL, dbPassword, dbUrl, dbUsername, debug, DEBUGCONFIGTOKEN, driverName, embedded, here, identity, localeMagicToken, LOCALEMAGICTOKEN, outputStreamMagicToken, OUTPUTSTREAMMAGICTOKEN, parsePathInfo, PATHINFOMAGICTOKEN, ready, redirectMagicToken, REDIRECTMAGICTOKEN, requestMagicToken, REQUESTMAGICTOKEN, resourceBundleName, responseMagicToken, RESPONSEMAGICTOKEN, servletMagicToken, SERVLETMAGICTOKEN, sessionMagicToken, SESSIONMAGICTOKEN, USEHTTPSCONFIGTOKEN, zone
 
Fields inherited from class uk.co.weft.maybeupload.MaybeUploadServlet
allowOverwrite, maxUpload, saveUploadedFilesToDisk, silentlyRename, uploadDir, uploadDirPath, uploadDirURL
 
Fields inherited from interface uk.co.weft.htform.ResourceConsumer
RESOURCEBUNDLEMAGICTOKEN
 
Constructor Summary
CompositeStylesheetSample()
           
 
Method Summary
protected  void doBody(Context context)
          No need to do anything, since I intend to get content at least initially from a head_include
 java.util.Vector getStylesheets(Context context)
          get the URLs of multiple stylesheets to use in this context.
 void init(Context config)
          Initialisation: Set up my variables from my configuration.
 
Methods inherited from class uk.co.weft.htform.Page
doFoot, doFoot, doHead, doHeadBodySep, generateContent, getFootInclude, getFootIncludeURL, getFootIncludeURL, getHeadInclude, getHeadIncludeURL, getHeadIncludeURL, getLayout, getStylesheet, getTables, getTitle, getTitle, outputRedirectBlock, readStringFromURL
 
Methods inherited from class uk.co.weft.htform.WithExceptionHandlerServlet
whinge, whinge, whinge
 
Methods inherited from class uk.co.weft.htform.Servlet
addCookie, addCookie, coerceCookiesToContext, coerceToContext, coerceToContext, coerceToContext, coerceToContext, coerceToUrl, createContext, doGet, doPost, fixupMagicValues, getCalendar, getContentType, getDebug, getLocale, getOutputStream, getResource, getResourceString, getServletInfo, grs, grs, handleAction, handleCookies, handleRedirect, init, makeReady, setCookieValues, storeOnSession
 
Methods inherited from class uk.co.weft.maybeupload.MaybeUploadServlet
doDelete, doHead, doOptions, doPut, doTrace, getUploadDir, getUploadURL, service
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

query

protected java.lang.String query
query template to use for querying the database. Must have one '?' as a placeholder for the value of masterkey


masterkey

protected java.lang.String masterkey
the name of the token in the context which will be bound to the key value

Constructor Detail

CompositeStylesheetSample

public CompositeStylesheetSample()
Method Detail

init

public void init(Context config)
          throws InitialisationException
Initialisation: Set up my variables from my configuration.

Overrides:
init in class Page
Throws:
InitialisationException

getStylesheets

public java.util.Vector getStylesheets(Context context)
                                throws java.lang.Exception
get the URLs of multiple stylesheets to use in this context. May be in two forms - a 'parent' index or a comma separated list.

Overrides:
getStylesheets in class Page
Parameters:
context - the context of this service
Returns:
a vector all of whose members are URLs or string representations of URLs, all of which point to CSS stylesheets. Must return a vector (even if empty) rather than null.
Throws:
java.lang.Exception
Since:
Jacquard 1.9

doBody

protected void doBody(Context context)
               throws java.lang.Exception
No need to do anything, since I intend to get content at least initially from a head_include

Specified by:
doBody in class Page
Throws:
java.lang.Exception

jacquard 1.12.0 by The Web Engineering Factory and Toolworks