info.aduna.gee.publication.net
Class MultiPartFormData

java.lang.Object
  extended by info.aduna.gee.publication.net.MultiPartFormData

public class MultiPartFormData
extends Object

A quick-and-dirty, Zpad specific, implementation of multipart/form-data creation. This class is compatible with the quick-and-dirty, Zpad specific, implementation of multipart/form-data decoding at the server side.


Field Summary
protected static String _boundary
          The boundary used.
 
Constructor Summary
MultiPartFormData()
           
 
Method Summary
protected static byte[] _getBytes(String s)
          Convert String to byte array.
static byte[] createMpFormData(WProperties headers, WProperties options)
           
static byte[] createMpFormData(WProperties headers, WProperties options, String fileFieldName, String fileName, byte[] fileContents)
          Encode (optional) name/value pairs and an (optional) file into a byte array using the multipart/form-data encoding.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_boundary

protected static String _boundary
The boundary used.

Constructor Detail

MultiPartFormData

public MultiPartFormData()
Method Detail

createMpFormData

public static byte[] createMpFormData(WProperties headers,
                                      WProperties options)
See Also:
full createMpFormData

createMpFormData

public static byte[] createMpFormData(WProperties headers,
                                      WProperties options,
                                      String fileFieldName,
                                      String fileName,
                                      byte[] fileContents)
Encode (optional) name/value pairs and an (optional) file into a byte array using the multipart/form-data encoding. The headers to be set (urlConn.setRequestProperty()) are returned in the headers parameter. Note: the resulting multipart/form-data should contain at least one option or a file part, it's unlegal when it's completely empty.

Parameters:
headers - "return parameter": headers are returned
options - the name/value pairs to be set, or null
fileFieldName - the name of the form field of the file, or null
fileName - the name of the file (ignored in case fileFieldName is null)
fileContents - the contents of the file (ignored in case fileFieldName is null)

_getBytes

protected static byte[] _getBytes(String s)
Convert String to byte array.



Copyright © 1997-2008 Aduna. All Rights Reserved.