Package rife.engine
Interface Request
- All Known Implementing Classes:
HttpRequest
,MockRequest
public interface Request
This interface contains all the methods that the web engine needs to be
able to correctly handle incoming requests.
- Since:
- 1.0
-
Method Summary
Modifier and TypeMethodDescriptiongetAttribute
(String name) getBody()
Retrieves the body of this request as a string.byte[]
Retrieves the body of this request as a byte array.Retrieves a cookie.Cookie[]
long
getDateHeader
(String name) Retrieves an uploaded file.getFiles()
Retrieves the files that were uploaded in this request.Retrieves all files that have been uploaded for a particular name.getHeaders
(String name) Retrieves the underlyingHttpServletRequest
.int
getIntHeader
(String name) Retrieves the parameters that were sent in this request.int
getServerRootUrl
(int port) Returns the root URL of the server that is running this web applications.getSession
(boolean create) boolean
hasAttribute
(String name) Checks if a request attribute exists.boolean
Checks whether a cookie is present.boolean
Checks if a particular file has been uploaded in this request.boolean
isSecure()
void
removeAttribute
(String name) void
setAttribute
(String name, Object object)
-
Method Details
-
getMethod
RequestMethod getMethod()- Since:
- 1.0
-
getParameters
Retrieves the parameters that were sent in this request.- Returns:
- a
Map
with all the parameter names and values - Since:
- 1.0
-
getBody
String getBody()Retrieves the body of this request as a string.- Returns:
- the string of the request body
- Since:
- 1.0
- See Also:
-
getBodyAsBytes
byte[] getBodyAsBytes()Retrieves the body of this request as a byte array.- Returns:
- the byte array of the request body
- Since:
- 1.0
- See Also:
-
getFiles
Map<String,UploadedFile[]> getFiles()Retrieves the files that were uploaded in this request.- Returns:
- a
Map
with all the uploaded files - Since:
- 1.0
- See Also:
-
hasFile
Checks if a particular file has been uploaded in this request.- Parameters:
name
- the name of the file- Returns:
true
if the file was uploaded; orfalse
otherwise- Since:
- 1.0
- See Also:
-
getFile
Retrieves an uploaded file.- Parameters:
name
- the name of the file- Returns:
- the uploaded file; or
null
if no file was uploaded - Since:
- 1.0
- See Also:
-
getFiles
Retrieves all files that have been uploaded for a particular name.- Parameters:
name
- the name of the file- Returns:
- the uploaded files; or
null
if no files were uploaded for that name - Since:
- 1.0
- See Also:
-
getServerRootUrl
Returns the root URL of the server that is running this web applications.This includes the protocol, the server name and the server port, for example:
http://www.somehost.com:8080
.- Returns:
- the server's root url
- Since:
- 1.0
-
hasCookie
Checks whether a cookie is present.- Parameters:
name
- the name of the cookie- Returns:
true
if the cookie was present; orfalse
otherwise- Since:
- 1.0
- See Also:
-
getCookie
Retrieves a cookie.- Parameters:
name
- the name of the cookie.- Returns:
- the instance of the cookie; or
null
if no such cookie is present - Since:
- 1.0
- See Also:
-
getCookies
Cookie[] getCookies()- Since:
- 1.0
-
getAttribute
- Since:
- 1.0
-
hasAttribute
Checks if a request attribute exists.- Parameters:
name
- aString
specifying the name of the attributefalse
otherwise- Since:
- 1.0
-
getAttributeNames
Enumeration<String> getAttributeNames()- Since:
- 1.0
-
removeAttribute
- Since:
- 1.0
-
setAttribute
- Since:
- 1.0
-
getCharacterEncoding
String getCharacterEncoding()- Since:
- 1.0
-
getContentType
String getContentType()- Since:
- 1.0
-
getDateHeader
- Since:
- 1.0
-
getHeader
- Since:
- 1.0
-
getHeaderNames
Enumeration<String> getHeaderNames()- Since:
- 1.0
-
getHeaders
- Since:
- 1.0
-
getIntHeader
- Since:
- 1.0
-
getLocale
Locale getLocale()- Since:
- 1.0
-
getLocales
Enumeration<Locale> getLocales()- Since:
- 1.0
-
getProtocol
String getProtocol()- Since:
- 1.0
-
getRemoteAddr
String getRemoteAddr()- Since:
- 1.0
-
getRemoteUser
String getRemoteUser()- Since:
- 1.0
-
getRemoteHost
String getRemoteHost()- Since:
- 1.0
-
getRequestDispatcher
- Since:
- 1.0
-
getSession
HttpSession getSession()- Since:
- 1.0
-
getSession
- Since:
- 1.0
-
getServerPort
int getServerPort()- Since:
- 1.0
-
getScheme
String getScheme()- Since:
- 1.0
-
getServerName
String getServerName()- Since:
- 1.0
-
getContextPath
String getContextPath()- Since:
- 1.0
-
isSecure
boolean isSecure()- Since:
- 1.0
-
getHttpServletRequest
HttpServletRequest getHttpServletRequest()Retrieves the underlyingHttpServletRequest
.- Returns:
- the underlying
HttpServletRequest
instance; ornull
if this request isn't backed byHttpServletRequest
- Since:
- 1.0
-