com.yworks.yfiles.server.graphml.servlets
Class ExportServlet

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended bycom.yworks.yfiles.server.graphml.servlets.ExportServlet
All Implemented Interfaces:
java.io.Serializable, Servlet, ServletConfig

public class ExportServlet
extends HttpServlet

Simple export servlet that takes the export data from the request and creates a file download for it.

See Also:
Serialized Form

Field Summary
static java.lang.String PARAM_EXPORT_DATA
           
 
Constructor Summary
ExportServlet()
          Calls the ExportServlet(String) constructor using PARAM_EXPORT_DATA as the parameter name.
ExportServlet(java.lang.String exportDataParameter)
          Calls the ExportServlet(String,String) constructor using "image/png" as the contentType paramater.
ExportServlet(java.lang.String exportDataParameter, java.lang.String contentType)
          Creates a new instance using the provided export data parameter to get the export data from the HttpServletRequest later in getExportDataInputStream(javax.servlet.http.HttpServletRequest) from.
 
Method Summary
protected  void doGet(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)
           
protected  void doPost(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)
           
 java.lang.String getContentType()
          Get the content type that will be used for the response header.
protected  java.io.InputStream getExportDataInputStream(HttpServletRequest httpServletRequest)
          Retrieves the input stream from the request to read the export data from.
 void setContentType(java.lang.String value)
          Set the content type that will be used for the response header.
 
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, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARAM_EXPORT_DATA

public static final java.lang.String PARAM_EXPORT_DATA
See Also:
Constant Field Values
Constructor Detail

ExportServlet

public ExportServlet()
Calls the ExportServlet(String) constructor using PARAM_EXPORT_DATA as the parameter name.


ExportServlet

public ExportServlet(java.lang.String exportDataParameter)
Calls the ExportServlet(String,String) constructor using "image/png" as the contentType paramater.


ExportServlet

public ExportServlet(java.lang.String exportDataParameter,
                     java.lang.String contentType)
Creates a new instance using the provided export data parameter to get the export data from the HttpServletRequest later in getExportDataInputStream(javax.servlet.http.HttpServletRequest) from.

Parameters:
exportDataParameter - the name of the parameter of null if the ServletInputStream shall be used.
contentType - The content type to use for the response header.
Method Detail

doGet

protected void doGet(HttpServletRequest httpServletRequest,
                     HttpServletResponse httpServletResponse)
              throws java.io.IOException
Throws:
java.io.IOException

getContentType

public java.lang.String getContentType()
Get the content type that will be used for the response header.

Depending on the servlet container configuration, the response content type might determine whether the servlet container sends a compressed response.

Returns:
A content MIME type. The default value is "image/png".

setContentType

public void setContentType(java.lang.String value)
Set the content type that will be used for the response header.

Parameters:
value - The content type string. The default is "image/png"..

getExportDataInputStream

protected java.io.InputStream getExportDataInputStream(HttpServletRequest httpServletRequest)
                                                throws java.io.IOException
Retrieves the input stream from the request to read the export data from. This implementation uses the ServletRequest.getParameter(String) method using the parameter name specified in the constructor. If no parameter name has been specified the ServletInputStream is used. A Base64InputStream is wrapped around the used input stream.

Parameters:
httpServletRequest - the request
Returns:
the stream to read the graph from.
Throws:
java.io.IOException - if something bad happened.

doPost

protected void doPost(HttpServletRequest httpServletRequest,
                      HttpServletResponse httpServletResponse)
               throws ServletException,
                      java.io.IOException
Throws:
ServletException
java.io.IOException


Copyright © 2000-2013 yWorks GmbH. All rights reserved