|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.faceless.graph2.tag.GraphContext
public class GraphContext
The GraphContext is the equivalent of the ServletContext
, and manages
the generated graphs, their resources and the Embedders/RequestHandlers that
are used to create and serve them. Unless you're creating your own RequestHandler
you will not need to access this class.
Method Summary | |
---|---|
void |
destroy()
Destroy this GraphContext - must be called when the ServletContext is reloaded. |
EmbedderFactory |
getEmbedderFactory(String type)
Get the EmbedderFactory that closest matches the specified type, which may be a default EmbedderFactory if no direct match is found. |
byte[] |
getFile(String pageid,
String graphid)
Return a generated file saved with putFile() |
String |
getFileType(String pageid,
String graphid)
Return the MIME-type of the generated file saved with putFile() |
static GraphContext |
getGraphContext(ServletContext sc)
Retrieve the GraphContext object for the specified ServletContext. |
static GraphContext |
getGraphContext(ServletContext sc,
HttpServletRequest req)
Retrieve the GraphContext object for the specified context. |
RequestHandler |
getRequestHandler(String type)
Get a RequestHandler that matches the specified type, or null if no matching handlers are found. |
Map |
getResources()
Return a context-wide Map that can be used to save general resources |
String |
nextPageId()
Return a new unique ID for the next page - guaranteed to be unique |
void |
putFile(String pageid,
String graphid,
byte[] data,
String mimetype)
Store a generated Image |
void |
setStoreSize(int storesize)
Set the maximum number of pages to keep around before they're freed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static GraphContext getGraphContext(ServletContext sc)
getGraphContext(sc, null)
sc
- the Servlet Contextpublic static GraphContext getGraphContext(ServletContext sc, HttpServletRequest req)
Retrieve the GraphContext object for the specified context. One is created if it doesn't exist.
Which context is used (the session or the ServletContext) depends
on the org.faceless.graph2.tag.UseSession
init-parameter.
If this is set to true
, graphs will be stored in the session.
This is required for clustered load-balancing.
sc
- the Servlet Contextreq
- the HTTP request - only required if graphs are to be stored in the session contextpublic void destroy()
public void setStoreSize(int storesize)
storesize
- the size of the page storepublic RequestHandler getRequestHandler(String type)
null
if no matching handlers are found.
type
- the typepublic EmbedderFactory getEmbedderFactory(String type)
type
- the typepublic String nextPageId()
public void putFile(String pageid, String graphid, byte[] data, String mimetype)
pageid
- the page idgraphid
- the graph id - must be unique on the specified pagedata
- the datamimetype
- the MIME-type of the imagepublic byte[] getFile(String pageid, String graphid)
putFile()
pageid
- the page idgraphid
- the graph idpublic String getFileType(String pageid, String graphid)
putFile()
pageid
- the page idgraphid
- the graph idpublic Map getResources()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |