railo.runtime.net.http
Class ReqRspUtil

java.lang.Object
  extended by railo.runtime.net.http.ReqRspUtil

public final class ReqRspUtil
extends Object


Constructor Summary
ReqRspUtil()
           
 
Method Summary
static Pair<String,Object>[] add(Pair<String,Object>[] items, String name, Object value)
           
static String decode(String str, String charset, boolean force)
           
static String encode(String str, String charset)
           
static String get(Pair<String,Object>[] items, String name)
           
static LinkedList<MimeType> getAccept(PageContext pc)
           
static MimeType getContentType(PageContext pc)
           
static String getContentTypeAsString(PageContext pc, String defaultValue)
           
static javax.servlet.http.Cookie[] getCookies(Config config, javax.servlet.http.HttpServletRequest req)
           
static String getHeader(javax.servlet.http.HttpServletRequest request, String name, String defaultValue)
           
static String getHeaderIgnoreCase(PageContext pc, String name, String defaultValue)
           
static List<String> getHeadersIgnoreCase(PageContext pc, String name)
           
static String getQueryString(javax.servlet.http.HttpServletRequest req)
           
static Object getRequestBody(PageContext pc, boolean deserialized, Object defaultValue)
          returns the body of the request
static String getRequestURL(javax.servlet.http.HttpServletRequest req, boolean includeQueryString)
          returns the full request URL
static String getRootPath(javax.servlet.ServletContext sc)
           
static String getScriptName(javax.servlet.http.HttpServletRequest req)
           
static boolean isThis(javax.servlet.http.HttpServletRequest req, String url)
           
static boolean isThis(javax.servlet.http.HttpServletRequest req, URL url)
           
static boolean needDecoding(String str)
           
static boolean needEncoding(String str, boolean allowPlus)
           
static String self(javax.servlet.http.HttpServletRequest req)
          return path to itself
static Pair<String,Object>[] set(Pair<String,Object>[] items, String name, Object value)
           
static void setCharacterEncoding(javax.servlet.http.HttpServletResponse rsp, String charset)
           
static void setContentLength(javax.servlet.http.HttpServletResponse rsp, int length)
           
static void setContentLength(javax.servlet.http.HttpServletResponse rsp, long length)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReqRspUtil

public ReqRspUtil()
Method Detail

get

public static String get(Pair<String,Object>[] items,
                         String name)

add

public static Pair<String,Object>[] add(Pair<String,Object>[] items,
                                        String name,
                                        Object value)

set

public static Pair<String,Object>[] set(Pair<String,Object>[] items,
                                        String name,
                                        Object value)

self

public static String self(javax.servlet.http.HttpServletRequest req)
return path to itself

Parameters:
req -

setContentLength

public static void setContentLength(javax.servlet.http.HttpServletResponse rsp,
                                    int length)

setContentLength

public static void setContentLength(javax.servlet.http.HttpServletResponse rsp,
                                    long length)

getCookies

public static javax.servlet.http.Cookie[] getCookies(Config config,
                                                     javax.servlet.http.HttpServletRequest req)

setCharacterEncoding

public static void setCharacterEncoding(javax.servlet.http.HttpServletResponse rsp,
                                        String charset)

getQueryString

public static String getQueryString(javax.servlet.http.HttpServletRequest req)

getHeader

public static String getHeader(javax.servlet.http.HttpServletRequest request,
                               String name,
                               String defaultValue)

getHeaderIgnoreCase

public static String getHeaderIgnoreCase(PageContext pc,
                                         String name,
                                         String defaultValue)

getHeadersIgnoreCase

public static List<String> getHeadersIgnoreCase(PageContext pc,
                                                String name)

getScriptName

public static String getScriptName(javax.servlet.http.HttpServletRequest req)

decode

public static String decode(String str,
                            String charset,
                            boolean force)

encode

public static String encode(String str,
                            String charset)

needEncoding

public static boolean needEncoding(String str,
                                   boolean allowPlus)

needDecoding

public static boolean needDecoding(String str)

isThis

public static boolean isThis(javax.servlet.http.HttpServletRequest req,
                             String url)

isThis

public static boolean isThis(javax.servlet.http.HttpServletRequest req,
                             URL url)

getAccept

public static LinkedList<MimeType> getAccept(PageContext pc)

getContentType

public static MimeType getContentType(PageContext pc)

getContentTypeAsString

public static String getContentTypeAsString(PageContext pc,
                                            String defaultValue)

getRequestBody

public static Object getRequestBody(PageContext pc,
                                    boolean deserialized,
                                    Object defaultValue)
returns the body of the request

Parameters:
pc -
deserialized - if true railo tries to deserialize the body based on the content-type, for example when the content type is "application/json"
defaultValue - value returned if there is no body
Returns:

getRequestURL

public static String getRequestURL(javax.servlet.http.HttpServletRequest req,
                                   boolean includeQueryString)
returns the full request URL

Parameters:
req - - the HttpServletRequest
includeQueryString - - if true, the QueryString will be appended if one exists

getRootPath

public static String getRootPath(javax.servlet.ServletContext sc)


Copyright © 2012 Railo