com.yworks.yfiles.server.graphml.support
Class Graph2DRoundtripSupport

java.lang.Object
  extended bycom.yworks.yfiles.server.graphml.support.AbstractGraphRoundtripSupport
      extended bycom.yworks.yfiles.server.graphml.support.Graph2DRoundtripSupportBase
          extended bycom.yworks.yfiles.server.graphml.support.Graph2DRoundtripSupport
All Implemented Interfaces:
RoundtripSupport, ServletRoundtripSupport

public class Graph2DRoundtripSupport
extends Graph2DRoundtripSupportBase
implements ServletRoundtripSupport

A RoundtripSupport for use with the y.view package.

The io handler will be configured to parse and serialize NodeRealizer and EdgeRealizer instances by using NodeRealizerSerializers and EdgeRealizerSerializers.

This class adds support for servlets to its base class GraphRoundtripSupportBase.


Field Summary
 
Fields inherited from class com.yworks.yfiles.server.graphml.support.AbstractGraphRoundtripSupport
EDGE_2_ID_DPKEY, mappers, NODE_2_ID_DPKEY, objectMappers, PARAM_GRAPH, RESPONSE_DOCUMENT_TAG, USERTAGS_DPKEY
 
Constructor Summary
Graph2DRoundtripSupport()
           
 
Method Summary
 boolean readGraph(HttpServletRequest request, Graph graph)
          If the request contains the AbstractGraphRoundtripSupport.PARAM_GRAPH parameter, the parameter value is used for updating the graph instance currently stored in the session.
 void sendError(java.lang.String message, HttpServletResponse response)
          Send an error to the client.
 void sendGraph(Graph graph, HttpServletResponse response)
          Send the current graph to the client in GraphML format using UTF-8 encoding.
 
Methods inherited from class com.yworks.yfiles.server.graphml.support.Graph2DRoundtripSupportBase
configureHandler, configureRoundtripGraph, createHandler, createRoundtripGraph, isHierarchyEnabled, readGraph, readGraph, sendGraph, setHierarchyEnabled
 
Methods inherited from class com.yworks.yfiles.server.graphml.support.AbstractGraphRoundtripSupport
addMapper, addObjectMapper, createAutoMapperInputHandlerProvider, createAutoMapperOutputHandlerProvider, createDefaultElementTagWrapper, createInputHandlerProvider, createObjectInputHandlerProvider, createObjectOutputHandlerProvider, createOutputHandlerProvider, createTagInputHandlerProvider, createTagOutputHandler, createXmlWriter, getGraphDecoder, getTagInputHandlerProvider, getTagOutputHandler, isSupportUserTags, sendError, setSupportUserTags
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.yworks.yfiles.server.graphml.support.RoundtripSupport
addMapper, addObjectMapper, createRoundtripGraph, isSupportUserTags, readGraph, readGraph, sendError, sendGraph, setSupportUserTags
 

Constructor Detail

Graph2DRoundtripSupport

public Graph2DRoundtripSupport()
Method Detail

readGraph

public boolean readGraph(HttpServletRequest request,
                         Graph graph)
                  throws java.io.IOException
Description copied from interface: ServletRoundtripSupport
If the request contains the AbstractGraphRoundtripSupport.PARAM_GRAPH parameter, the parameter value is used for updating the graph instance currently stored in the session.

To decide whether the value of the AbstractGraphRoundtripSupport.PARAM_GRAPH parameter has to be decoded and decompressed, the "graphEncoding" parameter is used. For example, to indicate base64-encoded, zlib-compressed and URI-encoded data, the value has to be "base64/zlib/encodeURIComponent".

Specified by:
readGraph in interface ServletRoundtripSupport
Parameters:
request - The servlet request
Returns:
whether the request contained a graph that was read.
Throws:
java.io.IOException - If parsing goes wrong.

sendGraph

public void sendGraph(Graph graph,
                      HttpServletResponse response)
               throws java.io.IOException
Description copied from interface: ServletRoundtripSupport
Send the current graph to the client in GraphML format using UTF-8 encoding. This method will close the response stream.

The response content type is set to "text/xml".

Specified by:
sendGraph in interface ServletRoundtripSupport
Parameters:
graph - The current graph.
response - The response that will be sent to the client.
Throws:
java.io.IOException - If something goes wrong during GraphML export.

sendError

public void sendError(java.lang.String message,
                      HttpServletResponse response)
               throws java.io.IOException
Send an error to the client. The error is sent in XML format:
  <?xml version="1.0" encoding="UTF-8"?>
  <response>
    <errors>
      <error>
       <![CDATA[
          error message
        ]]>
      </error>
    </errors>
 </response>
 

Specified by:
sendError in interface ServletRoundtripSupport
Parameters:
message - The error message.
response - The response.
Throws:
java.io.IOException - If writing to the response writer fails.


Copyright © 2000-2013 yWorks GmbH. All rights reserved