com.tirsen.angkor
Class RenderContext

java.lang.Object
  |
  +--com.tirsen.angkor.RenderContext

public class RenderContext
extends java.lang.Object

The RenderContext encapsulates the current processing state of the request, the partitioning of responsibilities between Application, RenderContext and ExecuteContext is not yet fully resolved and this needs some refactoring. This is the main engine of Angkor responsible for invoking and mainting the rest of the framework, it's name may be a little inaccurate by now since it ended up being the main engine while refactoring. It will become instantiated now and then to do some work. It can actually only keep cached state since the same instance will not be used at all times (not even within one request). To get around this save its state in the request (for state only maintained within one request) or within the session (for state with a lifetime spanning several requests). To avoid name-clashes (several applications may be running within the same servlet-context) it prefixes each name with the path to the application. TODO well, it actually doesn't do this yet, but it's a good idea! It relies on the ApplicationFilter to instantiate an application accessible via the session and for call backs for the parse phase. For this reason the ApplicationFilter need to filter all pages using angkor. TODO refactoring: This class has too many responsibities. Move many of the processing attributes that doesn't directly have to do with rendering and put them as attributes into ExecuteContext, implement much of the functionality in Valves instead.

Version:
$Revision: 1.5 $
Author:
$Author: tirsen $

Field Summary
protected  int indent
           
 
Constructor Summary
RenderContext(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
RenderContext(javax.servlet.jsp.PageContext pageContext)
           
 
Method Summary
 void afterRequest()
           
 void beforeRequest()
           
 void emptyTag(java.lang.String tag)
           
 java.lang.String encodeURL(java.lang.String url)
           
 void endTag(java.lang.String tag)
           
 void ensureApplicationInit(java.lang.Class applicationClass)
           
 Application getApplication()
           
 EventQueue getEventQueue()
           
static RenderContext getRenderContext()
          Gets the render context of the currently running pipeline.
 javax.servlet.http.HttpServletRequest getRequest()
           
protected  java.lang.Object getRequestAttribute(java.lang.String name)
           
 java.lang.String getRequestParameter(java.lang.String name)
           
 java.lang.String getRequestPath()
          Returns an absolute uri useful for sending requests which should end up in an action.
 javax.servlet.http.HttpServletResponse getResponse()
           
protected  java.lang.Object getSessionAttribute(java.lang.String attribute)
           
 java.io.PrintWriter getWriter()
           
protected  void indent()
           
 java.util.Iterator iterateParsingComponents()
          Returns a tread-safe iterator of the parsing components.
 java.lang.String nextUniqueID()
           
 void println(java.lang.String line)
           
 void registerParsingComponent(View view)
           
 java.lang.String requestURL(java.lang.String url)
          Constructs an url used to send requests back to the originating component.
 void resetParsingComponents()
           
protected  void setRequestAttribute(java.lang.String name, java.lang.Object value)
           
protected  void setSessionAttribute(java.lang.String attribute, java.lang.Object value)
           
 void startTag(java.lang.String tag)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

indent

protected int indent
Constructor Detail

RenderContext

public RenderContext(javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response)

RenderContext

public RenderContext(javax.servlet.jsp.PageContext pageContext)
Method Detail

getEventQueue

public EventQueue getEventQueue()

getApplication

public Application getApplication()

ensureApplicationInit

public void ensureApplicationInit(java.lang.Class applicationClass)
                           throws java.io.IOException,
                                  javax.servlet.ServletException
java.io.IOException
javax.servlet.ServletException

setRequestAttribute

protected void setRequestAttribute(java.lang.String name,
                                   java.lang.Object value)

getRequestAttribute

protected java.lang.Object getRequestAttribute(java.lang.String name)

getRequest

public javax.servlet.http.HttpServletRequest getRequest()

getResponse

public javax.servlet.http.HttpServletResponse getResponse()

indent

protected void indent()
               throws java.io.IOException
java.io.IOException

getWriter

public java.io.PrintWriter getWriter()
                              throws java.io.IOException
java.io.IOException

emptyTag

public void emptyTag(java.lang.String tag)
              throws java.io.IOException
java.io.IOException

startTag

public void startTag(java.lang.String tag)
              throws java.io.IOException
java.io.IOException

endTag

public void endTag(java.lang.String tag)
            throws java.io.IOException
java.io.IOException

println

public void println(java.lang.String line)
             throws java.io.IOException
java.io.IOException

getRequestPath

public java.lang.String getRequestPath()
Returns an absolute uri useful for sending requests which should end up in an action. The angkor:header-tag renders a HTML base-tag to make all urls in angkor is relative to the application. For that reason links that should end up to be processed correctly by the ApplicationFilter also need to be relative to the context-root.


requestURL

public java.lang.String requestURL(java.lang.String url)
Constructs an url used to send requests back to the originating component.


encodeURL

public java.lang.String encodeURL(java.lang.String url)

resetParsingComponents

public void resetParsingComponents()

iterateParsingComponents

public java.util.Iterator iterateParsingComponents()
Returns a tread-safe iterator of the parsing components. Parsing components can be registered while using the returned iterator.


registerParsingComponent

public void registerParsingComponent(View view)

setSessionAttribute

protected void setSessionAttribute(java.lang.String attribute,
                                   java.lang.Object value)

getSessionAttribute

protected java.lang.Object getSessionAttribute(java.lang.String attribute)

nextUniqueID

public java.lang.String nextUniqueID()

getRequestParameter

public java.lang.String getRequestParameter(java.lang.String name)

beforeRequest

public void beforeRequest()
                   throws java.io.IOException,
                          javax.servlet.ServletException
java.io.IOException
javax.servlet.ServletException

afterRequest

public void afterRequest()
                  throws java.io.IOException,
                         javax.servlet.ServletException
java.io.IOException
javax.servlet.ServletException

getRenderContext

public static RenderContext getRenderContext()
Gets the render context of the currently running pipeline.



Copyright © 2002-2002 . All Rights Reserved.