Esri Geoportal Server
1.0

com.esri.gpt.framework.http
Class StreamProvider

java.lang.Object
  extended by com.esri.gpt.framework.http.ContentBase
      extended by com.esri.gpt.framework.http.ContentProvider
          extended by com.esri.gpt.framework.http.StreamProvider

public class StreamProvider
extends ContentProvider

Stream based provider for the content of an HTTP request body.


Constructor Summary
StreamProvider(InputStream content, long contentLength, String contentType)
          Constructs with an associated request content input stream, content length and content type.
 
Method Summary
 long getContentLength()
          Gets the content length (in bytes) to be provided in the HTTP request header.
 String getContentType()
          Gets the content type to be provided in the HTTP request header.
 boolean isRepeatable()
          Tests if the HTTP request content can be written to the output stream more than once.
 void writeRequest(HttpClientRequest request, OutputStream destination)
          Writes the content of the HTTP request body to an output stream.
 
Methods inherited from class com.esri.gpt.framework.http.ContentProvider
asBytes, ensureContentTypeEncoding, prepareForWrite
 
Methods inherited from class com.esri.gpt.framework.http.ContentBase
executeIO, executeIO, getInitialBufferlength, getLoggableContent, setInitialBufferLength
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamProvider

public StreamProvider(InputStream content,
                      long contentLength,
                      String contentType)
Constructs with an associated request content input stream, content length and content type.

Parameters:
content - the input stream providing the content of the HTTP request body
contentLength - the length (in bytes) of the HTTP request body, use -1 if the length is unknown
contentType - the content type of the HTTP request body, use null if unknown, include a charset if applicable, e.g. text/xml; charset=UTF-8
Method Detail

getContentLength

public long getContentLength()
Gets the content length (in bytes) to be provided in the HTTP request header.

Specified by:
getContentLength in class ContentProvider
Returns:
the request content length (in bytes, use -1 if unknown);

getContentType

public String getContentType()
Gets the content type to be provided in the HTTP request header.
Include a charset if applicable, e.g. text/xml; charset=UTF-8

Specified by:
getContentType in class ContentProvider
Returns:
the request content type

isRepeatable

public boolean isRepeatable()
Tests if the HTTP request content can be written to the output stream more than once.

Specified by:
isRepeatable in class ContentProvider
Returns:
always false (override if necessary)

writeRequest

public void writeRequest(HttpClientRequest request,
                         OutputStream destination)
                  throws IOException
Writes the content of the HTTP request body to an output stream.

Specified by:
writeRequest in class ContentProvider
Parameters:
request - the HTTP request that is executing
destination - the output stream to which data will be written
Throws:
IOException - if an exception occurs

Esri Geoportal Server
1.0

Copyright 2011 Environmental Systems Research Institute. All rights reserved. Use is subject to license terms.