org.springframework.extensions.webscripts.servlet
Class WebScriptServletRequest

java.lang.Object
  extended by org.springframework.extensions.webscripts.WebScriptRequestImpl
      extended by org.springframework.extensions.webscripts.servlet.WebScriptServletRequest
All Implemented Interfaces:
WebScriptRequest
Direct Known Subclasses:
WebScriptServletRequest

public class WebScriptServletRequest
extends WebScriptRequestImpl

HTTP Servlet Web Script Request

Author:
davidc

Constructor Summary
WebScriptServletRequest(Runtime container, javax.servlet.http.HttpServletRequest req, Match serviceMatch, ServerProperties serverProperties)
          Construct
 
Method Summary
 boolean forceSuccessStatus()
          Force response to return SUCCESS (200) code Note: This is to support clients who cannot support non-success codes e.g.
 String getAgent()
          Get User Agent TODO: Expand on known agents
 Content getContent()
          Gets the request body as content
 String getContentType()
          Gets the mimetype of the request
 String getContextPath()
          Gets the Alfresco Context Path
 FormData.FormField getFileField(String name)
          Returns the FormField bject representing a file uploaded via a multipart form.
 String getHeader(String name)
          Gets the value of the named header
 String[] getHeaderNames()
          Gets the names of all headers for this request
 String[] getHeaderValues(String name)
          Gets the (array) value of the named header Note: An array of one item is returned when a "single value" named header is requested
 javax.servlet.http.HttpServletRequest getHttpServletRequest()
          Gets the HTTP Servlet Request
 String getParameter(String name)
          Gets the value of the named parameter
 String[] getParameterNames()
          Gets the names of all parameters on the Url
 String[] getParameterValues(String name)
          Gets the (array) value of the named parameter Note: An array of one item is returned when a "single value" named parameter is requested
 String getPathInfo()
          Gets the service specific path
 String getQueryString()
          Gets the query String
 String getServerPath()
          Get server portion of the request e.g.
 String getServiceContextPath()
          Gets the Alfresco Web Script Context Path
 Match getServiceMatch()
          Gets the matching API Service for this request
 String getServicePath()
          Gets the Alfresco Service Path
 String getURL()
          Gets the full request URL
static String resolveUserAgent(String userAgent)
          Helper to resolve common user agent strings from Http request header
 String toString()
           
 
Methods inherited from class org.springframework.extensions.webscripts.WebScriptRequestImpl
getExtensionPath, getFormat, getFormatStyle, getJSONCallback, getRuntime, isGuest, parseContent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WebScriptServletRequest

public WebScriptServletRequest(Runtime container,
                               javax.servlet.http.HttpServletRequest req,
                               Match serviceMatch,
                               ServerProperties serverProperties)
Construct

Parameters:
container - request generator
req -
serviceMatch -
Method Detail

getHttpServletRequest

public javax.servlet.http.HttpServletRequest getHttpServletRequest()
Gets the HTTP Servlet Request

Returns:
HTTP Servlet Request

getServiceMatch

public Match getServiceMatch()
Description copied from interface: WebScriptRequest
Gets the matching API Service for this request

Returns:
the service match

getServerPath

public String getServerPath()
Description copied from interface: WebScriptRequest
Get server portion of the request e.g. scheme://host:port

Returns:
server path

getContextPath

public String getContextPath()
Description copied from interface: WebScriptRequest
Gets the Alfresco Context Path

Returns:
context url e.g. /alfresco

getServiceContextPath

public String getServiceContextPath()
Description copied from interface: WebScriptRequest
Gets the Alfresco Web Script Context Path

Returns:
service url e.g. /alfresco/service

getServicePath

public String getServicePath()
Description copied from interface: WebScriptRequest
Gets the Alfresco Service Path

Returns:
service url e.g. /alfresco/service/search/keyword

getURL

public String getURL()
Description copied from interface: WebScriptRequest
Gets the full request URL

Returns:
request url e.g. /alfresco/service/search/keyword?q=term

getPathInfo

public String getPathInfo()
Description copied from interface: WebScriptRequest
Gets the service specific path

Returns:
request path e.g. /search/keyword

getQueryString

public String getQueryString()
Description copied from interface: WebScriptRequest
Gets the query String

Returns:
query string e.g. q=alfresco&format=atom

getParameterNames

public String[] getParameterNames()
Description copied from interface: WebScriptRequest
Gets the names of all parameters on the Url

Returns:
the names (empty, if none)

getParameter

public String getParameter(String name)
Description copied from interface: WebScriptRequest
Gets the value of the named parameter

Parameters:
name - parameter name
Returns:
parameter value (or null, if parameter does not exist)

getParameterValues

public String[] getParameterValues(String name)
Description copied from interface: WebScriptRequest
Gets the (array) value of the named parameter Note: An array of one item is returned when a "single value" named parameter is requested

Parameters:
name - parameter name
Returns:
array of values (or null, if parameter does not exist)

getHeaderNames

public String[] getHeaderNames()
Description copied from interface: WebScriptRequest
Gets the names of all headers for this request

Returns:
the names (empty, if none)

getHeader

public String getHeader(String name)
Description copied from interface: WebScriptRequest
Gets the value of the named header

Parameters:
name - header name
Returns:
header value (or null, if header does not exist)

getHeaderValues

public String[] getHeaderValues(String name)
Description copied from interface: WebScriptRequest
Gets the (array) value of the named header Note: An array of one item is returned when a "single value" named header is requested

Parameters:
name - header name
Returns:
array of values (or null, if header does not exist)

getAgent

public String getAgent()
Description copied from interface: WebScriptRequest
Get User Agent TODO: Expand on known agents

Returns:
MSIE / Firefox

resolveUserAgent

public static String resolveUserAgent(String userAgent)
Helper to resolve common user agent strings from Http request header


getContent

public Content getContent()
Description copied from interface: WebScriptRequest
Gets the request body as content

Returns:
request content (or null, if none)

getContentType

public String getContentType()
Description copied from interface: WebScriptRequest
Gets the mimetype of the request

Specified by:
getContentType in interface WebScriptRequest
Overrides:
getContentType in class WebScriptRequestImpl
Returns:
request content mimetype

getFileField

public FormData.FormField getFileField(String name)
Returns the FormField bject representing a file uploaded via a multipart form.

Parameters:
name - The name of the field containing the content
Returns:
FormField bject representing a file uploaded via a multipart form or null if the field does not exist or is not a file field.

forceSuccessStatus

public boolean forceSuccessStatus()
Description copied from interface: WebScriptRequest
Force response to return SUCCESS (200) code Note: This is to support clients who cannot support non-success codes e.g. Flash player

Specified by:
forceSuccessStatus in interface WebScriptRequest
Overrides:
forceSuccessStatus in class WebScriptRequestImpl
Returns:
true => force return of 200, otherwise return status explicitly set

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009 SpringSource, Inc. All Rights Reserved.