|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.servlet.GenericServlet
javax.servlet.http.HttpServlet
com.yworks.yfiles.server.tiles.servlet.BaseServlet
public abstract class BaseServlet
This is an abstract base class for the servlets in the yFiles AJAX servlet package. It provides some utilities for subclasses. These are
cacheGraph(HttpSession,String,Graph2D),
getId(Graph2D, Node),
getNodeURL(Graph2D, Node),
Serialized Form| Constructor Summary | |
|---|---|
BaseServlet()
|
|
| Method Summary | |
|---|---|
protected static String[] |
cachedGraphs(HttpSession session)
returns the names of the cached graphs for the given session. |
protected static void |
cacheGraph(HttpSession session,
String graphName,
Graph2D graph)
caches the given graph for the given name in the given session. |
protected void |
doGet(HttpServletRequest request,
HttpServletResponse response)
calls handleGetRequest(HttpServletRequest,HttpServletResponse). |
protected void |
doPost(HttpServletRequest request,
HttpServletResponse response)
calls handlePostRequest(HttpServletRequest,HttpServletResponse). |
static String |
getEdgeDescription(Graph2D graph,
Edge edge)
returns a description for a given edge. |
static URL |
getEdgeURL(Graph2D graph,
Edge edge)
returns a URL for a given edge. |
static Object |
getForId(Graph2D graph,
String id)
returns a graph element (node, edge, node label or edge label) for a given graph and an id or null, if not found. |
protected static Graph2D |
getGraph(HttpSession session,
String graphName)
returns the graph cached for the given session and name or null, if not found. |
protected static Rectangle |
getGraphBounds(HttpSession session,
String graphName)
returns the bounds of the cached graph for the given name and session or null, if not found. |
static String |
getId(Graph2D graph,
Edge e)
returns a unique ID for the given edge of the given graph. |
static String |
getId(Graph2D graph,
EdgeLabel el)
returns a unique ID for the given edge label of the given graph. |
static String |
getId(Graph2D graph,
Node n)
returns a unique ID for the given node of the given graph. |
static String |
getId(Graph2D graph,
NodeLabel nl)
returns a unique ID for the given node label of the given graph. |
static String |
getNodeDescription(Graph2D graph,
Node node)
returns a description for a given node. |
static URL |
getNodeURL(Graph2D graph,
Node node)
returns a URL for a given node. |
protected static PrintWriter |
getWriter(HttpServletResponse response)
returns a PrintWriter for the given response with content type "text/json-comment-filtered". |
protected void |
handleGetRequest(HttpServletRequest request,
HttpServletResponse response)
handles GET requests. |
protected void |
handlePostRequest(HttpServletRequest request,
HttpServletResponse response)
handles POST requests. |
static boolean |
hasDescriptions(Graph2D graph)
returns true, if there is a data provider for descriptions for the given graph. |
static boolean |
hasURLs(Graph2D graph)
returns true, if there is a data provider for URLs for the given graph. |
void |
init()
calls initialize(). |
void |
initialize()
is called for initializing the servlet. |
protected static Graph2D |
newGraph()
returns a new empty graph which already has a hierarchy manager. |
static void |
setEdgeDescription(Graph2D graph,
Edge edge,
String desc)
sets the description for a given edge. |
static void |
setEdgeURL(Graph2D graph,
Edge edge,
String urlString)
sets the URL for a given edge. |
static void |
setNodeDescription(Graph2D graph,
Node node,
String desc)
sets the description for a given node. |
static void |
setNodeURL(Graph2D graph,
Node node,
String urlString)
sets the URL for a given node. |
protected static void |
uncacheGraph(HttpSession session,
String graphName)
removes the graph cached for the given name from the cache for the given session. |
protected static void |
writeWorldBounds(String graphName,
HttpServletRequest request,
HttpServletResponse response)
writes the world bounds of the graph with the given name cached for the session of the given request to the given response in JSON format. |
| Methods inherited from class javax.servlet.http.HttpServlet |
|---|
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service |
| Methods inherited from class javax.servlet.GenericServlet |
|---|
destroy, 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 |
| Constructor Detail |
|---|
public BaseServlet()
| Method Detail |
|---|
public final void init()
throws ServletException
initialize().
init in class GenericServletServletException
public void initialize()
throws ServletException
init()
is final.
ServletException - if servlet related problems occur
protected final void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException,
IOException
handlePostRequest(HttpServletRequest,HttpServletResponse).
doPost in class HttpServletrequest - the requestresponse - the response
ServletException
IOException
protected void handlePostRequest(HttpServletRequest request,
HttpServletResponse response)
throws ServletException,
IOException
BaseServlet. Subclasses should redefine this method,
if necessary. Note that doPost(HttpServletRequest,HttpServletResponse) is final.
request - the request from a clientresponse - the response to be sent to the client
IOException - if I/O problems occur
ServletException - if servlet related problems occur
protected final void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException,
IOException
handleGetRequest(HttpServletRequest,HttpServletResponse).
doGet in class HttpServletrequest - the requestresponse - the response
ServletException
IOException
protected void handleGetRequest(HttpServletRequest request,
HttpServletResponse response)
throws ServletException,
IOException
BaseServlet. Subclasses should redefine this method,
if necessary. Note that doGet(HttpServletRequest,HttpServletResponse) is final.
request - the request from a clientresponse - the response to be sent to the client
IOException - if I/O problems occur
ServletException - if servlet related problems occur
protected static PrintWriter getWriter(HttpServletResponse response)
throws IOException
PrintWriter for the given response with content type "text/json-comment-filtered".
response - the given response
IOException - if the writer cannot be obtained
protected static void writeWorldBounds(String graphName,
HttpServletRequest request,
HttpServletResponse response)
throws IOException
graphName - the name of the graphrequest - a servlet requestresponse - the response for the request
IOException - for problems writing the response
public static Object getForId(Graph2D graph,
String id)
graph - the graphid - the id of the graph element
public static String getId(Graph2D graph,
Node n)
graph - the graphn - the node
getId(Graph2D, NodeLabel),
getId(Graph2D, Edge)
public static String getId(Graph2D graph,
NodeLabel nl)
graph - the graphnl - the node label
getId(Graph2D, Node),
getId(Graph2D, Edge)
public static String getId(Graph2D graph,
Edge e)
graph - the graphe - the edge
getId(Graph2D, EdgeLabel),
getId(Graph2D, Node)
public static String getId(Graph2D graph,
EdgeLabel el)
graph - the graphel - the edge label
getId(Graph2D, Edge),
getId(Graph2D, Node)public static boolean hasURLs(Graph2D graph)
graph - the given graph
hasDescriptions(Graph2D),
getNodeURL(Graph2D, Node),
getEdgeURL(Graph2D, Edge)
public static URL getNodeURL(Graph2D graph,
Node node)
graph - the graph, the node belongs tonode - the given node
hasURLs(Graph2D),
setNodeURL(Graph2D, Node, String)
public static void setNodeURL(Graph2D graph,
Node node,
String urlString)
graph - the graph, the node belongs tonode - the given nodeurlString - the URL to sethasURLs(Graph2D),
getNodeURL(Graph2D, Node)
public static URL getEdgeURL(Graph2D graph,
Edge edge)
graph - the graph, the edge belongs toedge - the given edge
hasURLs(Graph2D),
setEdgeURL(Graph2D, Edge, String)
public static void setEdgeURL(Graph2D graph,
Edge edge,
String urlString)
graph - the graph, the node belongs toedge - the given edgeurlString - the URL to sethasURLs(Graph2D),
getEdgeURL(Graph2D, Edge)public static boolean hasDescriptions(Graph2D graph)
graph - the given graph
hasURLs(Graph2D),
getNodeDescription(Graph2D, Node),
getEdgeDescription(Graph2D, Edge)
public static String getNodeDescription(Graph2D graph,
Node node)
graph - the graph, the node belongs tonode - the given node
hasDescriptions(Graph2D),
setNodeDescription(Graph2D, Node, String)
public static void setNodeDescription(Graph2D graph,
Node node,
String desc)
graph - the graph, the node belongs tonode - the given nodedesc - the description to be sethasDescriptions(Graph2D),
getNodeDescription(Graph2D, Node)
public static String getEdgeDescription(Graph2D graph,
Edge edge)
graph - the graph, the edge belongs toedge - the given edge
hasDescriptions(Graph2D),
setEdgeDescription(Graph2D, Edge, String)
public static void setEdgeDescription(Graph2D graph,
Edge edge,
String desc)
graph - the graph, the node belongs toedge - the given edgedesc - the description to be sethasDescriptions(Graph2D),
getEdgeDescription(Graph2D, Edge)
protected static void cacheGraph(HttpSession session,
String graphName,
Graph2D graph)
session - the session for cachinggraphName - the name for the graphgraph - the graph to cachecachedGraphs(HttpSession),
uncacheGraph(HttpSession, String),
getGraph(HttpSession,String),
getGraphBounds(HttpSession,String)
protected static void uncacheGraph(HttpSession session,
String graphName)
session - the sessiongraphName - the name of an entry to be removed from the cachecacheGraph(HttpSession, String, Graph2D),
cachedGraphs(HttpSession)protected static String[] cachedGraphs(HttpSession session)
session - the session
cacheGraph(HttpSession,String,Graph2D),
getGraph(HttpSession,String),
getGraphBounds(HttpSession,String)protected static Graph2D newGraph()
protected static Graph2D getGraph(HttpSession session,
String graphName)
session - the sessiongraphName - the name of the graph
cacheGraph(HttpSession,String,Graph2D),
getGraphBounds(HttpSession,String)
protected static Rectangle getGraphBounds(HttpSession session,
String graphName)
session - the sessiongraphName - the name of the graph
cacheGraph(HttpSession,String,Graph2D),
getGraph(HttpSession,String)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||