com.yworks.yfiles.server.graphml.support
Interface ServletRoundtripSupport

All Superinterfaces:
RoundtripSupport
All Known Implementing Classes:
Graph2DRoundtripSupport, GraphRoundtripSupport

public interface ServletRoundtripSupport
extends RoundtripSupport

Interface for roundtrip support classes.

This interface adds methods to support servlets to its base interface RoundtripSupport.


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 interface com.yworks.yfiles.server.graphml.support.RoundtripSupport
addMapper, addObjectMapper, createRoundtripGraph, isSupportUserTags, readGraph, readGraph, sendError, sendGraph, setSupportUserTags
 

Method Detail

readGraph

public boolean readGraph(HttpServletRequest request,
                         Graph graph)
                  throws java.io.IOException
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".

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
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".

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>
 

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