jacquard 1.12.0 by The Web Engineering Factory and Toolworks

uk.co.weft.graphic
Class Graphic

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
All Implemented Interfaces:
ResourceConsumer, java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
Direct Known Subclasses:
ExampleMappedImageServlet

public class Graphic
extends Servlet

A basic Servlet which outputs a GIF or JPEG, not an HTML page. Specialise.

Note: This class and its subclasses use image encoders by Jef Poskanzer (jef@acme.com), also avialable under BSD-style license. These encoders are not part of Jacquard, but can be downloaded from his site.

Configuration:

width ( integer)
the width of the image produced
height ( integer)
the height of the image produced
graphic_format (string)
one of 'gif', 'jpg, 'png'

Graphic Servlets under X11

Getting graphic servlets to work on UN*X style operating systems is tricky. The following conditions all have to be met:

Version:
$Revision: 1.2.4.1 $ This revision: $Author: simon $
Author:
Simon Brooke
See Also:
Serialized Form

Field Summary
protected  java.lang.String contentType
          my content type
protected  java.lang.String format
          my graphics format
protected  int height
          The height of my canvas
protected  int width
          The width of my canvas
 
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
Graphic()
           
 
Method Summary
protected  void generateContent(Context context)
          Really perform service of an HTTP GET request, by printing myself on the response stream
 void init(Context config)
          Initialisation: set up my variables from configuration
protected  void paintImage(java.awt.Graphics g)
          Paint the desired image onto this graphics context.
 
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, 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
 

Field Detail

width

protected int width
The width of my canvas


height

protected int height
The height of my canvas


contentType

protected java.lang.String contentType
my content type


format

protected java.lang.String format
my graphics format

Constructor Detail

Graphic

public Graphic()
Method Detail

init

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

Overrides:
init in class Servlet
Throws:
InitialisationException

paintImage

protected void paintImage(java.awt.Graphics g)
Paint the desired image onto this graphics context. This is the one method that subclasses should need to specialise


generateContent

protected void generateContent(Context context)
                        throws java.lang.Exception
Really perform service of an HTTP GET request, by printing myself on the response stream

Specified by:
generateContent in class Servlet
Parameters:
context - the context in which to generate this content.
Throws:
java.lang.Exception

jacquard 1.12.0 by The Web Engineering Factory and Toolworks