org.springframework.extensions.webscripts
Class AbstractRuntime

java.lang.Object
  extended by org.springframework.extensions.webscripts.AbstractRuntime
All Implemented Interfaces:
Runtime
Direct Known Subclasses:
LocalWebScriptRuntime, WebScriptServletRuntime

public abstract class AbstractRuntime
extends Object
implements Runtime

Encapsulates the execution of a single Web Script. Sub-classes of WebScriptRuntime maintain the execution environment e.g. servlet request & response. A new instance of WebScriptRuntime is required for each invocation.

Author:
davidc

Field Summary
protected  RuntimeContainer container
          Component Dependencies
protected static org.apache.commons.logging.Log logger
           
 
Constructor Summary
AbstractRuntime(RuntimeContainer container)
          Construct
 
Method Summary
protected abstract  Authenticator createAuthenticator()
          Create a Web Script Authenticator
protected abstract  WebScriptRequest createRequest(Match match)
          Create a Web Script Request
protected abstract  WebScriptResponse createResponse()
          Create a Web Script Response
 void executeScript()
          Execute the Web Script encapsulated by this Web Script Runtime
protected  void executeScript(WebScriptRequest scriptReq, WebScriptResponse scriptRes, Authenticator auth)
          Execute script given the specified context
 Container getContainer()
          Gets the Web Script Container within which this Runtime is hosted
protected static WebScriptRequest getRealWebScriptRequest(WebScriptRequest request)
          Helper to retrieve real (last) Web Script Request in a stack of wrapped Web Script requests
protected static WebScriptResponse getRealWebScriptResponse(WebScriptResponse response)
          Helper to retrieve real (last) Web Script Response in a stack of wrapped Web Script responses
protected abstract  String getScriptMethod()
          Get the Web Script Method e.g.
 Map<String,Object> getScriptParameters()
          Gets script parameters
protected abstract  String getScriptUrl()
          Get the Web Script Url
protected  StatusTemplate getStatusCodeTemplate(int statusCode)
          Get code specific Status Template path
protected  StatusTemplate getStatusTemplate()
          Get Status Template path
 Map<String,Object> getTemplateParameters()
          Gets template parameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.extensions.webscripts.Runtime
getName
 

Field Detail

logger

protected static final org.apache.commons.logging.Log logger

container

protected RuntimeContainer container
Component Dependencies

Constructor Detail

AbstractRuntime

public AbstractRuntime(RuntimeContainer container)
Construct

Parameters:
container - web script context
Method Detail

getContainer

public Container getContainer()
Description copied from interface: Runtime
Gets the Web Script Container within which this Runtime is hosted

Specified by:
getContainer in interface Runtime
Returns:
web script container

executeScript

public final void executeScript()
Execute the Web Script encapsulated by this Web Script Runtime


executeScript

protected void executeScript(WebScriptRequest scriptReq,
                             WebScriptResponse scriptRes,
                             Authenticator auth)
                      throws IOException
Execute script given the specified context

Parameters:
scriptReq -
scriptRes -
auth -
Throws:
IOException

getStatusCodeTemplate

protected StatusTemplate getStatusCodeTemplate(int statusCode)
Get code specific Status Template path

Parameters:
statusCode -
Returns:
path

getStatusTemplate

protected StatusTemplate getStatusTemplate()
Get Status Template path

Returns:
path

getScriptParameters

public Map<String,Object> getScriptParameters()
Description copied from interface: Runtime
Gets script parameters

Specified by:
getScriptParameters in interface Runtime
Returns:
script parameters provided by the runtime

getTemplateParameters

public Map<String,Object> getTemplateParameters()
Description copied from interface: Runtime
Gets template parameters

Specified by:
getTemplateParameters in interface Runtime
Returns:
template parameters provided by the runtime

getScriptMethod

protected abstract String getScriptMethod()
Get the Web Script Method e.g. get, post

Returns:
web script method

getScriptUrl

protected abstract String getScriptUrl()
Get the Web Script Url

Returns:
web script url

createRequest

protected abstract WebScriptRequest createRequest(Match match)
Create a Web Script Request

Parameters:
match - web script matching the script method and url
Returns:
web script request

createResponse

protected abstract WebScriptResponse createResponse()
Create a Web Script Response

Returns:
web script response

createAuthenticator

protected abstract Authenticator createAuthenticator()
Create a Web Script Authenticator

Returns:
web script authenticator

getRealWebScriptRequest

protected static WebScriptRequest getRealWebScriptRequest(WebScriptRequest request)
Helper to retrieve real (last) Web Script Request in a stack of wrapped Web Script requests

Parameters:
request -
Returns:

getRealWebScriptResponse

protected static WebScriptResponse getRealWebScriptResponse(WebScriptResponse response)
Helper to retrieve real (last) Web Script Response in a stack of wrapped Web Script responses

Parameters:
response -
Returns:


Copyright © 2009 SpringSource, Inc. All Rights Reserved.