RichRequest

org.scalatra.servlet.RichRequest
See theRichRequest companion object
case class RichRequest(r: HttpServletRequest) extends AttributesMap

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Type members

Classlikes

object headers

A map of headers. Multiple header values are separated by a ',' character. The keys of this map are case-insensitive.

A map of headers. Multiple header values are separated by a ',' character. The keys of this map are case-insensitive.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
headers.type
object parameters extends MultiMapHeadView[String, String]

Attributes

Supertypes
trait MultiMapHeadView[String, String]
class Object
trait Matchable
class Any
Self type
parameters.type

Value members

Concrete methods

def body: String

Caches and returns the body of the request. The method is idempotent for any given request. The result is cached in memory regardless of size, so be careful. Calling this method consumes the request's input stream.

Caches and returns the body of the request. The method is idempotent for any given request. The result is cached in memory regardless of size, so be careful. Calling this method consumes the request's input stream.

Also note that this method gets data from the input stream of the request, so it may be already consumed according to the servlet specification 3.1.1.

Attributes

Returns

the message body as a string according to the request's encoding (default ISO-8859-1).

def characterEncoding: Option[String]

Returns the name of the character encoding of the body, or None if no character encoding is specified.

Returns the name of the character encoding of the body, or None if no character encoding is specified.

Attributes

def characterEncoding_=(encoding: Option[String]): Unit
def contentLength: Option[Long]

Returns the length, in bytes, of the body, or None if not known.

Returns the length, in bytes, of the body, or None if not known.

Attributes

def contentType: Option[String]

The content of the Content-Type header, or None if absent.

The content of the Content-Type header, or None if absent.

Attributes

def cookies: MultiMapHeadView[String, String]

Returns a map of cookie names to values. If multiple values are present for a given cookie, the value is the first cookie of that name.

Returns a map of cookie names to values. If multiple values are present for a given cookie, the value is the first cookie of that name.

Attributes

def header(name: String): Option[String]
def inputStream: InputStream

The input stream is an InputStream which contains the raw HTTP POST data. The caller should not close this stream.

The input stream is an InputStream which contains the raw HTTP POST data. The caller should not close this stream.

In contrast to Rack, this stream is not rewindable.

Attributes

def isAjax: Boolean

Returns true if the request is an AJAX request

Returns true if the request is an AJAX request

Attributes

def isWrite: Boolean

Returns true if the request's method is not "safe" per RFC 2616.

Returns true if the request's method is not "safe" per RFC 2616.

Attributes

def locale: Locale
def locales: Seq[Locale]

Returns a map of cookie names to lists of their values. The default value of the map is the empty sequence.

Returns a map of cookie names to lists of their values. The default value of the map is the empty sequence.

Attributes

A Map of the parameters of this request. Parameters are contained in the query string or posted form data.

A Map of the parameters of this request. Parameters are contained in the query string or posted form data.

Attributes

def pathInfo: String

The remainder of the request URL's "path", designating the virtual "location" of the request's target within the application. This may be an empty string, if the request URL targets the application root and does not have a trailing slash.

The remainder of the request URL's "path", designating the virtual "location" of the request's target within the application. This may be an empty string, if the request URL targets the application root and does not have a trailing slash.

Attributes

def queryString: String

The portion of the request URL that follows the ?, if any. May be empty, but is always required!

The portion of the request URL that follows the ?, if any. May be empty, but is always required!

Attributes

def referrer: Option[String]

Optionally returns the HTTP referrer.

Optionally returns the HTTP referrer.

Attributes

Returns

the Referer header, or None if not set

def remoteAddress: String

The remote address the client is connected from. This takes the load balancing header X-Forwarded-For into account

The remote address the client is connected from. This takes the load balancing header X-Forwarded-For into account

Attributes

Returns

the client ip address

The HTTP request method, such as GET or POST

The HTTP request method, such as GET or POST

Attributes

def scriptName: String

The initial portion of the request URL's "path" that corresponds to the application object, so that the application knows its virtual "location". This may be an empty string, if the application corresponds to the "root" of the server.

The initial portion of the request URL's "path" that corresponds to the application object, so that the application knows its virtual "location". This may be an empty string, if the application corresponds to the "root" of the server.

Attributes

def serverName: String

When combined with scriptName, pathInfo, and serverPort, can be used to complete the URL. Note, however, that the "Host" header, if present, should be used in preference to serverName for reconstructing the request URL.

When combined with scriptName, pathInfo, and serverPort, can be used to complete the URL. Note, however, that the "Host" header, if present, should be used in preference to serverName for reconstructing the request URL.

Attributes

def serverPort: Int

When combined with scriptName, pathInfo, and serverName, can be used to complete the URL. See serverName for more details.

When combined with scriptName, pathInfo, and serverName, can be used to complete the URL. See serverName for more details.

Attributes

The version of the protocol the client used to send the request. Typically this will be something like "HTTP/1.0" or "HTTP/1.1" and may be used by the application to determine how to treat any HTTP request headers.

The version of the protocol the client used to send the request. Typically this will be something like "HTTP/1.0" or "HTTP/1.1" and may be used by the application to determine how to treat any HTTP request headers.

Attributes

def uri: URI

Http or Https, depending on the request URL.

Http or Https, depending on the request URL.

Attributes

Inherited methods

def +=(kv: (String, Any)): AttributesMap.this.type

Sets an attribute on the underlying servlet object.

Sets an attribute on the underlying servlet object.

Value parameters

kv

the key/value pair. If the value is null, has the same effect as calling -=(kv._1).

Attributes

Returns

the map itself

Inherited from:
AttributesMap
def -=(key: String): AttributesMap.this.type

Removes an attribute from the underlying servlet object.

Removes an attribute from the underlying servlet object.

Value parameters

key

the key to remove

Attributes

Returns

the map itself

Inherited from:
AttributesMap
def apply(key: String): Any

Returns the attribute associated with the key or throw an exception when nothing found

Returns the attribute associated with the key or throw an exception when nothing found

Value parameters

key

The key to find

Attributes

Returns

an value for the attributed associated with the key in the underlying servlet object, or throw an exception if the key doesn't exist

Inherited from:
AttributesMap
def as[T](key: String)(implicit converter: TypeConverter[Any, T]): T

Returns the attribute associated with the key or throw an exception when nothing found

Returns the attribute associated with the key or throw an exception when nothing found

Type parameters

T

The type of the value

Value parameters

key

The key to find

Attributes

Returns

an value for the attributed associated with the key in the underlying servlet object, or throw an exception if the key doesn't exist

Inherited from:
AttributesMap
def contains(key: String): Boolean

Returns whether the specified key exists

Returns whether the specified key exists

Attributes

Returns

whether the specified key exists

Inherited from:
AttributesMap
def dumpAll: String

dumps all keys and values

dumps all keys and values

Attributes

Inherited from:
AttributesMap
def foreach[U](f: ((String, Any)) => U): Unit

Applies a function f to add attribute elements

Applies a function f to add attribute elements

Attributes

Inherited from:
AttributesMap
def get(key: String): Option[Any]

Optionally returns the attribute associated with the key

Optionally returns the attribute associated with the key

Value parameters

key

The key to find

Attributes

Returns

an option value containing the attribute associated with the key in the underlying servlet object, or None if none exists.

Inherited from:
AttributesMap
def getAs[T](key: String)(implicit converter: TypeConverter[Any, T]): Option[T]

Optionally returns and type cast the attribute associated with the key

Optionally returns and type cast the attribute associated with the key

Type parameters

T

The type of the value

Value parameters

key

The key to find

Attributes

Returns

an option value containing the attributed associated with the key in the underlying servlet object, or None if none exists

Inherited from:
AttributesMap
def getAsOrElse[T](key: String, default: => T)(implicit converter: TypeConverter[Any, T]): T

Returns the attribute associated with the key or default value

Returns the attribute associated with the key or default value

Type parameters

T

The type of the value

Value parameters

default

The default value, it will be returned when the key does not exist

key

The key to find

Attributes

Returns

an value for the attributed associated with the key in the underlying servlet object, or the default value if the key doesn't exist

Inherited from:
AttributesMap
def getOrElse(key: String, default: => Any): Any

Returns the attribute associated with the key or default value

Returns the attribute associated with the key or default value

Value parameters

default

The default value, it will be returned when the key does not exist

key

The key to find

Attributes

Returns

an value for the attributed associated with the key in the underlying servlet object, or the default value if the key doesn't exist

Inherited from:
AttributesMap
def getOrElseUpdate(key: String, value: => Any): Any

Returns the attribute associated with the key or update attributes with the specified value

Returns the attribute associated with the key or update attributes with the specified value

Value parameters

key

The key to find

value

The value that will be updated the attribute associated with the key when the key does not exist

Attributes

Returns

an value for the attributed associated with the key in the underlying servlet object, or the updated value if the key doesn't exist

Inherited from:
AttributesMap
def iterator: Iterator[(String, Any)]

Creates a new iterator over all attributes in the underlying servlet object.

Creates a new iterator over all attributes in the underlying servlet object.

Attributes

Returns

the new iterator

Inherited from:
AttributesMap
def keys: Iterator[String]

Returns an attributes keys

Returns an attributes keys

Attributes

Inherited from:
AttributesMap
def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product
def update(key: String, value: Any): Unit

Updates the attribute associated with the key

Updates the attribute associated with the key

Value parameters

key

The key to update

value

The value to update

Attributes

Inherited from:
AttributesMap