jacquard 1.12.0 by The Web Engineering Factory and Toolworks

uk.co.weft.graphic
Class ExampleMappedImageServlet

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.graphic.Graphic
                      extended byuk.co.weft.graphic.ExampleMappedImageServlet
All Implemented Interfaces:
ResourceConsumer, java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class ExampleMappedImageServlet
extends Graphic

Simple tutorial example of how to use computed mapped images in a servlet. We've found this extremely hard to do which is why we've put so much effort into producing a framework of classes to support it: this class provides an example of how to use them. It's also a simple example of how to do a non-trivial non-form with Jacquard. In addition to the other configuration parameters that all Jacquard servlets understand, this one expects 's1' and 's2' to be strings, and 'u1' and 'u2' to be URLs to map those strings to.

See Also:
MappedImage, Serialized Form

Field Summary
 
Fields inherited from class uk.co.weft.graphic.Graphic
contentType, format, height, width
 
Fields inherited from class uk.co.weft.htform.Servlet
calendar, conf, 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
ExampleMappedImageServlet()
           
 
Method Summary
protected  void generateContent(Context context)
          work out whether I'm a type one (generate an HTML page) call or a type two (generate a raster image) call; despatch to the appropriate method
protected  java.lang.String getContentType(Context context)
          Return my computed content type in this context.
 
Methods inherited from class uk.co.weft.graphic.Graphic
init, paintImage
 
Methods inherited from class uk.co.weft.htform.Servlet
addCookie, addCookie, coerceCookiesToContext, coerceToContext, coerceToContext, coerceToContext, coerceToContext, coerceToUrl, createContext, doGet, doPost, fixupMagicValues, getCalendar, getDebug, getLocale, getOutputStream, getResource, getResourceString, getServletInfo, grs, grs, handleAction, handleCookies, handleRedirect, init, makeReady, outputRedirectBlock, setCookieValues, storeOnSession, whinge, whinge
 
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
 

Constructor Detail

ExampleMappedImageServlet

public ExampleMappedImageServlet()
Method Detail

getContentType

protected java.lang.String getContentType(Context context)
Return my computed content type in this context. If I'm a 'second call' I need to be a gif; if first call, html

Overrides:
getContentType in class Servlet
Returns:
my content type in this context.

generateContent

protected void generateContent(Context context)
                        throws java.lang.Exception
work out whether I'm a type one (generate an HTML page) call or a type two (generate a raster image) call; despatch to the appropriate method

Overrides:
generateContent in class Graphic
Throws:
java.lang.Exception

jacquard 1.12.0 by The Web Engineering Factory and Toolworks