de.tuberlin.cs.flp.jspwiki.util


Class MultipartFormData


public class MultipartFormData
Namespace: util
Has stereotypes: << utility >>


Utility-class for handling multipart-form-data, used for uploading files with a web-browser.
Authors:
Jens Gulden
Version:
0.1.0


Method Summary
public static Map   getMultipartFormData(HttpServletRequest request)
Get POSTed file-upload data from request. (HttpRequest still does not support this on its own.)  
public static Map   getMultipartFormData(HttpServletRequest request, String encoding)
Get POSTed file-upload data from request. (HttpRequest still does not support this on its own.)  
public static boolean  isMultipartFormData(HttpServletRequest request)
Get POSTed file-upload data from request. (It is a little shame that HttpRequest still does not support this on its own.)  
private static Properties   parseKeyValuePairs(String s)
Parse key/value pairs in a string. Key and value are sperated by '='. the pairs are seperated by whitespace or ';'. Multiple occurrences of the same key will result in a String[]-array parse result for that key.  
public static void  parseMultiPartFormData(byte[] b, Map parameters, String encoding)
Parse multipart-formdata from data sent via POST method. Does not support multiple parameters with the same name (delivering an array).  
private static void  putMulti(Map m, String key, String val)
Puts a string value into a map, if an entry alreeady exists, uses a string[]-array to collect multiple values.  

Tagged Values
static false
documentation#author Jens Gulden
documentation#version 0.1.0

Method Detail

getMultipartFormData

public static Map getMultipartFormData(HttpServletRequest request)


Get POSTed file-upload data from request. (HttpRequest still does not support this on its own.)
Parameters:
request - The request.
Returns:
Map containing key/value pairs sent via multipart/form-data, values are Strings. Null if an error occurs or if the browser did not send a content-length entry.


getMultipartFormData

public static Map getMultipartFormData(HttpServletRequest request, String encoding)


Get POSTed file-upload data from request. (HttpRequest still does not support this on its own.)
Parameters:
request - The request.
encoding - the string encoding charset to use
Returns:
Map containing key/value pairs sent via multipart/form-data, values are Strings. Null if an error occurs or if the browser did not send a content-length entry.


isMultipartFormData

public static boolean isMultipartFormData(HttpServletRequest request)


Get POSTed file-upload data from request. (It is a little shame that HttpRequest still does not support this on its own.)
Parameters:
request - The request.
Returns:
Map containing key/value pairs sent via multipart/form-data, values are Strings. Null if an error occurs or if the browser did not send a content-length entry.


parseKeyValuePairs

private static Properties parseKeyValuePairs(String s)


Parse key/value pairs in a string. Key and value are sperated by '='. the pairs are seperated by whitespace or ';'. Multiple occurrences of the same key will result in a String[]-array parse result for that key.
Parameters:
s - The string to parse.
Returns:
Properties, with value entries either of type String or String[]


parseMultiPartFormData

public static void parseMultiPartFormData(byte[] b, Map parameters, String encoding)


Parse multipart-formdata from data sent via POST method. Does not support multiple parameters with the same name (delivering an array).
Method Tagged Values
documentation#throws IOException if an i/o error occurs

Parameters:
b - data bytes
parameters - The parameters.
encoding - The encoding.
Exceptions:
IOException if an i/o error occurs


putMulti

private static void putMulti(Map m, String key, String val)


Puts a string value into a map, if an entry alreeady exists, uses a string[]-array to collect multiple values.
Parameters:
m - The map to put a key/value-pair into.
key - The key.
val - The value.

previous   TOC   next

Generated with Poseidon for UMLTM.
Poseidon is a registered trademark of Gentleware AG in the USA and other countries. Copyright 2003-2006 Gentleware AG, Ludwigstr. 12, 20357 Hamburg, Germany. All Rights Reserved.
UML is a trademark or registered trademark of Object Management Group, Inc. in the U.S. and other countries.