| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectccs.http.HUtil
public class HUtil
Utilities for webapps (HTML as much as HTTP).
| Method Summary | |
|---|---|
static java.lang.String | 
forceGetBrowserCmd()
 | 
static java.lang.String | 
getBrowserCmd()
 | 
static void | 
launchURL(java.lang.String url)
Launch the external browser with the specified URL string.  | 
static java.lang.String | 
multipartName(HeaderedEntity he)
For a HeaderedEntity that is part of a multipart form, extract the name of the control for which this part contains the value.  | 
static java.lang.String | 
multipartStringValue(HeaderedEntity he,
                     java.lang.String charset)
For a HeaderedEntity that is part of a multipart form, extract the information which the user placed in the control - the "value" - provided that value is a text string.  | 
static java.util.HashMap | 
parseMultipartForm(java.io.InputStream src,
                   int len,
                   java.lang.String contentTypeRaw,
                   java.lang.String charset)
Deprecated. All webapps should be using Pasiphae now rather than trying to do this themselves. Pasiphae handles input type=file too, which this doesn't.  | 
static void | 
registerURLHandlerPackage(java.lang.String pkg)
Utility function to register a URL handler package.  | 
static java.lang.String | 
sanex(java.lang.String src,
      java.lang.String loseMsg)
Returns a version of the source string which has been sanitised. | 
static java.lang.String | 
sanitise(java.lang.String src)
Returns a trimmed version of the source from which any characters which we have deemed objectionable have been removed.  | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Method Detail | 
|---|
public static java.util.HashMap parseMultipartForm(java.io.InputStream src,
                                                   int len,
                                                   java.lang.String contentTypeRaw,
                                                   java.lang.String charset)
                                            throws java.io.IOException
src - The raw form data which was POSTed to you.len - The length of the form data in src, if known (otherwise the whole
        stream is assumed; this can hang under some conditions, persistent connections
        in paticular).contentTypeRaw - The complete body of the "Content-Type" header which
        came as part of the HTTP request.charset - The charset of the form; unless specified otherwise, this is the
        charset of the page the form is on. If the decoding fails, the method will try again
        under ISO-8859-1. This is a workaround for bugs in certain current browsers we
        have decided to support (notably Opera 5.12). NB. Restrict input names to
        US-ASCII; internationalised names are not supported (although internationalised
        content is fine).
java.io.IOException
public static java.lang.String multipartName(HeaderedEntity he)
                                      throws java.io.IOException
parseMultipartForm, which converts the entire form into
        an easy-to-use hashmap. The only place you can't do this is where your form
        contains an input of type file; in this case, you must use
        rawMultipartSet to obtain the HeaderedEntity list,
        and then use this to extract the names. For all elements that aren't of type
        file, you can then use multipartStringValue to obtain the value
        - this is exactly what parseMultipartForm does. For the ones that
        are files, use HeaderedEntity.writeContentTo to obtain the
        file contents. This does not return null - if there is no name, it throws
        HException.
he - The HeaderedEntity from which to extract the control's name.
java.io.IOException
public static java.lang.String multipartStringValue(HeaderedEntity he,
                                                    java.lang.String charset)
                                             throws java.io.IOException
parseMultipartForm, which converts the entire form into an
        easy-to-use hashmap. The only place you can't do this is where your form
        contains an input of type file; in this case, you must use
        rawMultipartSet to obtain the HeaderedEntity list,
        and then use this to extract the values of all elements that aren't files -
        this is exactly what parseMultipartForm does. For the ones that
        are files, use HeaderedEntity.writeContentTo to obtain the
        file contents.
he - The HeaderedEntity from which to extract the control's value.charset - The charset of the form; unless specified otherwise, this is the
        charset of the page the form is on. If the decoding fails, the method will try again
        under ISO-8859-1. This is a workaround for bugs in certain current browsers we
        have decided to support (notably Opera 5.12). NB. Restrict input names to
        US-ASCII; internationalised names are not supported (although internationalised
        content is fine).
java.io.IOExceptionpublic static java.lang.String sanitise(java.lang.String src)
src - The source string.
public static java.lang.String sanex(java.lang.String src,
                                     java.lang.String loseMsg)
                              throws LoseException
sanitised.
        If this string is zero-length, throws LoseException with the
        specified error message.
LoseExceptionpublic static void registerURLHandlerPackage(java.lang.String pkg)
pkg - The parent package of your handler.URL.URL(java.lang.String, java.lang.String, int, java.lang.String)
public static void launchURL(java.lang.String url)
                      throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String getBrowserCmd()
public static java.lang.String forceGetBrowserCmd()
getBrowserCmd instead; it has better performance.
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||