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

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

public class DownloadServlet
extends HttpServlet

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

See Also:
Serialized Form

Constructor Summary
DownloadServlet()
          Calls the DownloadServlet(String) constructor using AbstractGraphRoundtripSupport.PARAM_GRAPH as the parameter name.
DownloadServlet(java.lang.String graphParameter)
          Creates a new instance using the provided parameter to get the graphml string from the HttpServletRequest later in getGraphInputStream(javax.servlet.http.HttpServletRequest) from.
 
Method Summary
protected  void doGet(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)
           
protected  void doPost(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)
           
protected  java.lang.String getContentType()
          Get the content type that will be used for the response header.
protected  java.io.InputStream getGraphInputStream(HttpServletRequest httpServletRequest)
          Retrieves the input stream from the request to read the graphml from.
 
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
 

Constructor Detail

DownloadServlet

public DownloadServlet()
Calls the DownloadServlet(String) constructor using AbstractGraphRoundtripSupport.PARAM_GRAPH as the parameter name.


DownloadServlet

public DownloadServlet(java.lang.String graphParameter)
Creates a new instance using the provided parameter to get the graphml string from the HttpServletRequest later in getGraphInputStream(javax.servlet.http.HttpServletRequest) from.

Parameters:
graphParameter - the name of the parameter of null if the ServletInputStream shall be used.
Method Detail

doGet

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

getContentType

protected 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 conten MIME type. This implementation returns "text/xml".

getGraphInputStream

protected java.io.InputStream getGraphInputStream(HttpServletRequest httpServletRequest)
                                           throws java.io.IOException
Retrieves the input stream from the request to read the graphml 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 returned.

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