Esri Geoportal Server
1.2.9

com.esri.gpt.framework.http.multipart
Class MultiPartContentProvider

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.multipart.MultiPartContentProvider

public class MultiPartContentProvider
extends ContentProvider

Multi-part provider. Use any of 'add' method to add suitable content part.


Constructor Summary
MultiPartContentProvider()
           
 
Method Summary
 void add(String name, byte[] bytes, String fileName, String contentType, String charset)
          Adds bytes attribute.
 void add(String name, File file, String fileName, String contentType, String charset, boolean deleteAfterUpload)
          Adds file attribute.
 void add(String name, String value)
          Adds string attribute.
 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 writeParts(PartWriter partWriter)
          Writes all parts.
 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

MultiPartContentProvider

public MultiPartContentProvider()
Method Detail

getContentLength

public long getContentLength()
Description copied from class: ContentProvider
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()
Description copied from class: ContentProvider
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()
Description copied from class: ContentProvider
Tests if the HTTP request content can be written to the output stream more than once.

Specified by:
isRepeatable in class ContentProvider
Returns:
true if the content can written more than once (typically via a cache)

writeRequest

public void writeRequest(HttpClientRequest request,
                         OutputStream destination)
                  throws IOException
Description copied from class: ContentProvider
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

writeParts

public void writeParts(PartWriter partWriter)
                throws IOException
Writes all parts.

Parameters:
partWriter - part writer
Throws:
IOException - if writing part fails

add

public void add(String name,
                String value)
         throws IOException
Adds string attribute.

Parameters:
name - attribute name
value - attribute value
Throws:
IOException - if error setting attribute

add

public void add(String name,
                File file,
                String fileName,
                String contentType,
                String charset,
                boolean deleteAfterUpload)
         throws IOException
Adds file attribute.

Parameters:
name - attribute name
file - file
fileName - disposition file name
contentType - content type
charset - character set
deleteAfterUpload - true to delete file after being uploaded
Throws:
IOException - if error setting attribute

add

public void add(String name,
                byte[] bytes,
                String fileName,
                String contentType,
                String charset)
         throws IOException
Adds bytes attribute.

Parameters:
name - name
bytes - bytes
fileName - disposition file name
contentType - content type
charset - character set
Throws:
IOException - if error setting attribute

Esri Geoportal Server
1.2.9

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