railo.commons.net
Class HTTPUtil

java.lang.Object
  extended by railo.commons.net.HTTPUtil

public final class HTTPUtil
extends Object


Field Summary
static short ACTION_GET
          Field ACTION_GET
static short ACTION_POST
          Field ACTION_POST
static int MAX_REDIRECT
           
static int STATUS_OK
          Field STATUS_OK
 
Constructor Summary
HTTPUtil()
           
 
Method Summary
static String encode(String realpath)
           
static String escapeQSValue(String str)
           
static void forward(PageContext pc, String realPath)
           
static int getPort(URL url)
           
static void include(PageContext pc, javax.servlet.ServletRequest req, javax.servlet.ServletResponse rsp, String realPath)
           
static void include(PageContext pc, String realPath)
           
static boolean isSecure(URL url)
           
static boolean isTextMimeType(MimeType mimetype)
           
static boolean isTextMimeType(String mimetype)
           
static long length(URL url)
          return the length of a file defined by a url.
static String optimizeRealPath(PageContext pc, String realPath)
           
static Map<String,String> parseParameterList(String _str, boolean decode, String charset)
           
static String removeRef(String url)
           
static URL removeRef(URL url)
           
static javax.servlet.ServletRequest removeWrap(javax.servlet.ServletRequest req)
           
static String[] splitMimeTypeAndCharset(String mimetype, String[] defaultValue)
           
static String[] splitTypeAndSubType(String mimetype)
           
static ContentType toContentType(String str, ContentType defaultValue)
           
static URI toURI(String strUrl)
           
static URI toURI(String strUrl, int port)
           
static URL toURL(String strUrl)
          cast a string to a url
static URL toURL(String strUrl, int port)
          cast a string to a url
static URL toURL(String strUrl, URL defaultValue)
           
static String validateURL(String strUrl, String defaultValue)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACTION_POST

public static final short ACTION_POST
Field ACTION_POST

See Also:
Constant Field Values

ACTION_GET

public static final short ACTION_GET
Field ACTION_GET

See Also:
Constant Field Values

STATUS_OK

public static final int STATUS_OK
Field STATUS_OK

See Also:
Constant Field Values

MAX_REDIRECT

public static final int MAX_REDIRECT
See Also:
Constant Field Values
Constructor Detail

HTTPUtil

public HTTPUtil()
Method Detail

toURL

public static URL toURL(String strUrl)
                 throws MalformedURLException
cast a string to a url

Parameters:
strUrl - string represent a url
Returns:
url from string
Throws:
MalformedURLException

toURL

public static URL toURL(String strUrl,
                        URL defaultValue)

validateURL

public static String validateURL(String strUrl,
                                 String defaultValue)

toURL

public static URL toURL(String strUrl,
                        int port)
                 throws MalformedURLException
cast a string to a url

Parameters:
strUrl - string represent a url
Returns:
url from string
Throws:
MalformedURLException

toURI

public static URI toURI(String strUrl)
                 throws URISyntaxException
Throws:
URISyntaxException

toURI

public static URI toURI(String strUrl,
                        int port)
                 throws URISyntaxException
Throws:
URISyntaxException

escapeQSValue

public static String escapeQSValue(String str)

removeRef

public static URL removeRef(URL url)
                     throws MalformedURLException
Throws:
MalformedURLException

removeRef

public static String removeRef(String url)
                        throws MalformedURLException
Throws:
MalformedURLException

optimizeRealPath

public static String optimizeRealPath(PageContext pc,
                                      String realPath)

forward

public static void forward(PageContext pc,
                           String realPath)
                    throws javax.servlet.ServletException,
                           IOException
Throws:
javax.servlet.ServletException
IOException

removeWrap

public static javax.servlet.ServletRequest removeWrap(javax.servlet.ServletRequest req)

include

public static void include(PageContext pc,
                           String realPath)
                    throws javax.servlet.ServletException,
                           IOException
Throws:
javax.servlet.ServletException
IOException

include

public static void include(PageContext pc,
                           javax.servlet.ServletRequest req,
                           javax.servlet.ServletResponse rsp,
                           String realPath)
                    throws javax.servlet.ServletException,
                           IOException
Throws:
javax.servlet.ServletException
IOException

encode

public static String encode(String realpath)

getPort

public static int getPort(URL url)

length

public static long length(URL url)
                   throws IOException
return the length of a file defined by a url.

Parameters:
dataUrl -
Returns:
Throws:
IOException

parseParameterList

public static Map<String,String> parseParameterList(String _str,
                                                    boolean decode,
                                                    String charset)

toContentType

public static ContentType toContentType(String str,
                                        ContentType defaultValue)

splitMimeTypeAndCharset

public static String[] splitMimeTypeAndCharset(String mimetype,
                                               String[] defaultValue)

splitTypeAndSubType

public static String[] splitTypeAndSubType(String mimetype)

isTextMimeType

public static boolean isTextMimeType(String mimetype)

isTextMimeType

public static boolean isTextMimeType(MimeType mimetype)

isSecure

public static boolean isSecure(URL url)


Copyright © 2012 Railo