wheel
Interface IEngine

All Known Implementing Classes:
AbstractEngine, EngineImpl, MockEngine, MultipartEngineImpl

public interface IEngine

An implementation of this interface handles the request-cycle.

  1. Request is recieved.
  2. A new instance of IEngine-implementation is created.
  3. Request, response, context, session etc. are set to the instance.
  4. processRequest() is called.

Author:
Henri Frilund

Method Summary
 java.util.Set _getAvailableCssFiles()
          Intended for internal use.
 java.util.Set _getAvailableJsFiles()
          Intended for internal use.
 IMessagesSource _getMessagesSource()
          Intended for internal use.
 org.xmlpull.v1.XmlSerializer _getXmlSerializer()
          Intended for internal use.
 void _setMessagesSource(IMessagesSource messagesSource)
          Intended for internal use.
 void addErrorMapping(java.lang.String exceptionClassName, java.lang.String errorPageName)
          Adds a mapping that will map exception classnames to page names.
 java.lang.String getBasePackage()
          The base package name for page loading.
 javax.servlet.ServletContext getContext()
          The ServletContext instance.
 java.lang.String getCssPath()
          Server root-based path to css-files.
 java.lang.String getEncoding()
          The encoding used during this request cycle for all output as well as URL encoding.
 java.lang.Throwable getError()
          Active error for this request process cycle.
 StandaloneComponent getErrorPage()
          The error page to render if an exception is caugth.
 java.lang.String getJsPath()
          Server root-based path to js-files.
 java.util.Locale getLocale()
           
 IObjectStore getObjectStore()
          Gives access to the internal object store that is used with automatic persistence.
 StandaloneComponent getpage()
           
 javax.servlet.http.HttpServletRequest getRequest()
          The active HttpSerlvetRequest for this request.
 IResourceManager getResourceManager()
           
 javax.servlet.http.HttpServletResponse getResponse()
          The active HttpServletResponse for this request.
 javax.servlet.http.HttpSession getSession()
           
 boolean isAjaxRequest()
           
 StandaloneComponent loadPage(java.lang.String pagePath)
          This method can be used to load Page-classes when the page path is known.
 void processRequest()
          Calling this method will start the request handling process.
 void setEncoding(java.lang.String encoding)
          Sets the encoding to use during this request cycle.
 void setError(java.lang.Throwable error)
          Sets the error that will be accessible to an error page.
 void setErrorPage(StandaloneComponent errorPage)
          Sets the page to render if an exception is caught.
 void setLocale(java.util.Locale locale)
          Sets the Locale for this request cycle.
 

Method Detail

_getXmlSerializer

org.xmlpull.v1.XmlSerializer _getXmlSerializer()
                                               throws org.xmlpull.v1.XmlPullParserException,
                                                      java.io.IOException
Intended for internal use.

Returns:
An Xpp3 serializer for rendering output.
Throws:
org.xmlpull.v1.XmlPullParserException
java.io.IOException

getContext

javax.servlet.ServletContext getContext()
The ServletContext instance.

Returns:

getRequest

javax.servlet.http.HttpServletRequest getRequest()
The active HttpSerlvetRequest for this request.

Returns:

getResponse

javax.servlet.http.HttpServletResponse getResponse()
The active HttpServletResponse for this request.

Returns:

_getAvailableCssFiles

java.util.Set _getAvailableCssFiles()
Intended for internal use.

Returns:

_getAvailableJsFiles

java.util.Set _getAvailableJsFiles()
Intended for internal use.

Returns:

getEncoding

java.lang.String getEncoding()
The encoding used during this request cycle for all output as well as URL encoding. Value encoding is UTF-8.

Returns:

setEncoding

void setEncoding(java.lang.String encoding)
Sets the encoding to use during this request cycle.

Parameters:
encoding -

getSession

javax.servlet.http.HttpSession getSession()

processRequest

void processRequest()
Calling this method will start the request handling process. Typically this method is called from a Servlet.


getObjectStore

IObjectStore getObjectStore()
Gives access to the internal object store that is used with automatic persistence.

Returns:
An IObjectStore implementation.

getBasePackage

java.lang.String getBasePackage()
The base package name for page loading. Example: com.foo.bar.pages (pagename FrontPage from URL will be translated to com.foo.bar.pages.FrontPage).

Returns:

getCssPath

java.lang.String getCssPath()
Server root-based path to css-files. Example: /contextname/css/

Returns:

getJsPath

java.lang.String getJsPath()
Server root-based path to js-files. Example: /contextname/js/

Returns:

setError

void setError(java.lang.Throwable error)
Sets the error that will be accessible to an error page.

Parameters:
error -

getError

java.lang.Throwable getError()
Active error for this request process cycle.

Returns:

getLocale

java.util.Locale getLocale()
Returns:
Locale for this request cycle. By default will delegate to HttpServletRequest.getLocale();

setLocale

void setLocale(java.util.Locale locale)
Sets the Locale for this request cycle. Note that this setting is not persistent and will have to be set for every request separately.

Parameters:
locale -

_getMessagesSource

IMessagesSource _getMessagesSource()
Intended for internal use.

Returns:
Returns an implementation of IMessageSource.

_setMessagesSource

void _setMessagesSource(IMessagesSource messagesSource)
Intended for internal use. Sets the used IMessageSource implementation.

Parameters:
messagesSource -

loadPage

StandaloneComponent loadPage(java.lang.String pagePath)
This method can be used to load Page-classes when the page path is known. Useful for example when you need to return a Page from an action method, ie. forward internally to another page. Will delegate the loading to IPageLoader.

Parameters:
pagePath - The path to wanted page in the URL-format, ie. stripped of basePackageForPages. Example: "FrontPage" or "admin/TestPage".
Returns:
An instance of the desired Page-class with this IEngine-instance attached.
Throws:
WheelException - if loading the page fails.

getErrorPage

StandaloneComponent getErrorPage()
The error page to render if an exception is caugth.

Returns:

setErrorPage

void setErrorPage(StandaloneComponent errorPage)
Sets the page to render if an exception is caught.

Parameters:
errorPage -

addErrorMapping

void addErrorMapping(java.lang.String exceptionClassName,
                     java.lang.String errorPageName)
Adds a mapping that will map exception classnames to page names. Example: addErrorMapping("java.io.IOException", "MyErrorPage"); would cause MyErrorPage to be rendered whenever an IOException is thrown.

Parameters:
exceptionClassName - The full classname of the mapped exception.
errorPageName - Name of the page to render.

isAjaxRequest

boolean isAjaxRequest()

getResourceManager

IResourceManager getResourceManager()

getpage

StandaloneComponent getpage()


Copyright © 2007-2008. All Rights Reserved.