|
|||||||||
| Home >> All >> org >> scopemvc >> controller >> [ servlet overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.scopemvc.controller.servlet
Class ServletContext

java.lang.Objectorg.scopemvc.controller.basic.ViewContext
org.scopemvc.controller.servlet.ServletContext
- public abstract class ServletContext
- extends org.scopemvc.controller.basic.ViewContext
A ViewContext that handles showView(), hideView() and showError() for servlet implementations.
The showView() expects a ServletView that is asked to stream the currently visible Page to the HTTP Response's OutputStream.
Two interesting behaviours can be customized with a ServletContext subclass:
-
To handle errors with a global error page override
showError(java.lang.String, java.lang.String)55 to implement the required behaviour.
ScopeServlet.createServletContext(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.util.HashMap) 55 in the application's
ScopeServlet subclass to return an instance of the custom ServletContext.
- Version:
- $Revision: 1.9 $ $Date: 2002/01/27 12:01:06 $
| Field Summary | |
protected java.util.HashMap |
formParameters
|
private static org.apache.commons.logging.Log |
LOG
|
protected javax.servlet.http.HttpServletRequest |
request
|
protected javax.servlet.http.HttpServletResponse |
response
The HttpServletResponse to use on showView. |
protected ScopeServlet |
servlet
|
| Fields inherited from class org.scopemvc.controller.basic.ViewContext |
properties |
| Constructor Summary | |
ServletContext(ScopeServlet inServlet,
javax.servlet.http.HttpServletRequest inRequest,
javax.servlet.http.HttpServletResponse inResponse,
java.util.HashMap inFormParameters)
Create with an HttpServletResponse to use on a showView during initialisation, and a HttpServletRequest accessible to application code. |
|
| Method Summary | |
void |
exit()
Used by default BasicController's handler for the EXIT Control. |
protected java.lang.String |
formatMessageToHTML(java.lang.String inMessage)
Replace all low ASCII chars (<32) in the message with <BR />. |
java.util.HashMap |
getFormParameters()
|
javax.servlet.http.HttpServletRequest |
getHttpRequest()
Allow access to the request object. |
javax.servlet.http.HttpServletResponse |
getHttpResponse()
Allow access to the response object. |
ScopeServlet |
getServlet()
Return the ScopeServlet that handled this context's request. |
protected void |
handleInternalError(java.lang.Throwable t)
Got an error while streaming the view into the response OutputStream. |
boolean |
hasShownView()
|
void |
hideView(org.scopemvc.core.View inView)
Don't do anything in this impl. |
protected void |
setHttpResponse(javax.servlet.http.HttpServletResponse inResponse)
The response to use for showView. |
void |
showError(java.lang.String inErrorTitle,
java.lang.String inErrorMessage)
This is a very simple default error handler. |
abstract void |
showView(org.scopemvc.core.View inView)
Show the ServletView passed. |
void |
startProgress()
|
void |
stopProgress()
|
| Methods inherited from class org.scopemvc.controller.basic.ViewContext |
addProperty, clearProperties, clearThreadContext, getProperty, getViewContext, removeProperty, setGlobalContext, setThreadContext |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
LOG
private static final org.apache.commons.logging.Log LOG
response
protected javax.servlet.http.HttpServletResponse response
- The HttpServletResponse to use on showView.
Set on creation then nulled after showView/showError.
request
protected javax.servlet.http.HttpServletRequest request
formParameters
protected java.util.HashMap formParameters
servlet
protected ScopeServlet servlet
| Constructor Detail |
ServletContext
public ServletContext(ScopeServlet inServlet, javax.servlet.http.HttpServletRequest inRequest, javax.servlet.http.HttpServletResponse inResponse, java.util.HashMap inFormParameters)
- Create with an HttpServletResponse to use on a showView
during initialisation, and a HttpServletRequest accessible
to application code.
| Method Detail |
setHttpResponse
protected final void setHttpResponse(javax.servlet.http.HttpServletResponse inResponse)
- The response to use for showView. Set in ctor and then
nulled after showing a view.
getHttpResponse
public final javax.servlet.http.HttpServletResponse getHttpResponse()
- Allow access to the response object. Should rarely be used.
getHttpRequest
public final javax.servlet.http.HttpServletRequest getHttpRequest()
- Allow access to the request object. Can be used to get access
to cookies, session etc.
getServlet
public final ScopeServlet getServlet()
- Return the ScopeServlet that handled this context's request.
getFormParameters
public final java.util.HashMap getFormParameters()
showView
public abstract void showView(org.scopemvc.core.View inView)
- Show the ServletView passed.
handleInternalError
protected void handleInternalError(java.lang.Throwable t) throws java.io.IOException
- Got an error while streaming the view into the
response OutputStream. The stream could be corrupt by
this point, but it hasn't been closed so do the best you can.
formatMessageToHTML
protected java.lang.String formatMessageToHTML(java.lang.String inMessage)
- Replace all low ASCII chars (<32) in the message with
<BR />.
hideView
public void hideView(org.scopemvc.core.View inView)
- Don't do anything in this impl.
***** A nicer impl of this view manager would maintain a "stack" of shown views and implement "doHideView" to step back through the stack if available. Could be tied to some rudimentary state management in ScopeServlet.
showError
public void showError(java.lang.String inErrorTitle, java.lang.String inErrorMessage)
- This is a very simple default error handler. To implement
your own error handler, override this method and also
override
ScopeServlet.createServletContext(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.util.HashMap)55 to return an instance of your custom ServletContext that will handle servlet requests.
hasShownView
public final boolean hasShownView()
exit
public void exit()
- Used by default BasicController's handler for the EXIT Control.
Doesn't do anything in a servlet context.
startProgress
public void startProgress()
stopProgress
public void stopProgress()
|
|||||||||
| Home >> All >> org >> scopemvc >> controller >> [ servlet overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC