com.ideo.sweetdevria.mock
Class MockPageContextImpl

java.lang.Object
  extended by javax.servlet.jsp.JspContext
      extended by javax.servlet.jsp.PageContext
          extended by com.ideo.sweetdevria.mock.MockPageContextImpl

public final class MockPageContextImpl
extends javax.servlet.jsp.PageContext

Mock PageContext object used for "non web" context (exemple : the excel export in batch mode). This object implements only getter/setter methods for attributes.

Author:
Vitaliy Shevchuk, Gregory Paul

Field Summary
 
Fields inherited from class javax.servlet.jsp.PageContext
APPLICATION, APPLICATION_SCOPE, CONFIG, EXCEPTION, OUT, PAGE, PAGE_SCOPE, PAGECONTEXT, REQUEST, REQUEST_SCOPE, RESPONSE, SESSION, SESSION_SCOPE
 
Constructor Summary
MockPageContextImpl(javax.servlet.ServletContext context, javax.servlet.ServletRequest request)
          Default constructor.
 
Method Summary
 java.lang.Object findAttribute(java.lang.String name)
          Find an attribute.
 void forward(java.lang.String relativeUrlPath)
          Not implemented !
 java.lang.Object getAttribute(java.lang.String name)
          Get the attribute identified by name.
 java.lang.Object getAttribute(java.lang.String name, int scope)
          Get the attribute from specified scope.
 java.util.Enumeration getAttributeNamesInScope(int scope)
          Get attribute names in scope.
 int getAttributesScope(java.lang.String name)
          Get the scope from an attribute.
 java.lang.Exception getException()
          Get the exception.
 javax.servlet.jsp.el.ExpressionEvaluator getExpressionEvaluator()
          Not implemented !
 javax.servlet.jsp.JspWriter getOut()
          Not implemented !
 java.lang.Object getPage()
          Get the servlet.
 javax.servlet.ServletRequest getRequest()
          Get the request.
 javax.servlet.ServletResponse getResponse()
          Get the response.
 javax.servlet.Servlet getServlet()
          Get the servlet.
 javax.servlet.ServletConfig getServletConfig()
          Get the servlet config.
 javax.servlet.ServletContext getServletContext()
          Get the servlet context.
 javax.servlet.http.HttpSession getSession()
          Get the session.
 javax.servlet.jsp.el.VariableResolver getVariableResolver()
          Not implemented !
 void handlePageException(java.lang.Exception ex)
          Not implemented !
 void handlePageException(java.lang.Throwable t)
          Not implemented !
 void include(java.lang.String relativeUrlPath)
          Not implemented !
 void include(java.lang.String string, boolean b)
          Not implemented !
 void initialize(javax.servlet.Servlet servlet, javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, java.lang.String errorPageURL, boolean needsSession, int bufferSize, boolean autoFlush)
          Not implemented !
 javax.servlet.jsp.JspWriter popBody()
          Not implemented !
 javax.servlet.jsp.tagext.BodyContent pushBody()
          Not implemented !
 void release()
          Clear all attributes.
 void removeAttribute(java.lang.String name)
          Remove attribute.
 void removeAttribute(java.lang.String name, int scope)
          Remove the specified attribute.
 void setAttribute(java.lang.String name, java.lang.Object attribute)
          Set the attribute.
 void setAttribute(java.lang.String name, java.lang.Object attribute, int scope)
          Set the attribute.
 
Methods inherited from class javax.servlet.jsp.PageContext
getErrorData
 
Methods inherited from class javax.servlet.jsp.JspContext
pushBody
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockPageContextImpl

public MockPageContextImpl(javax.servlet.ServletContext context,
                           javax.servlet.ServletRequest request)
Default constructor.

Parameters:
context - servlet context
request - servlet request
Method Detail

initialize

public void initialize(javax.servlet.Servlet servlet,
                       javax.servlet.ServletRequest request,
                       javax.servlet.ServletResponse response,
                       java.lang.String errorPageURL,
                       boolean needsSession,
                       int bufferSize,
                       boolean autoFlush)
Not implemented !

Specified by:
initialize in class javax.servlet.jsp.PageContext
Parameters:
servlet - servlet
request - request
response - response
errorPageURL - errorPageURL
needsSession - needsSession
bufferSize - bufferSize
autoFlush - autoFlush

release

public void release()
Clear all attributes.

Specified by:
release in class javax.servlet.jsp.PageContext

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Get the attribute identified by name.

Specified by:
getAttribute in class javax.servlet.jsp.JspContext
Parameters:
name - Attribute name
Returns:
Attribute value

getAttribute

public java.lang.Object getAttribute(java.lang.String name,
                                     int scope)
Get the attribute from specified scope.

Specified by:
getAttribute in class javax.servlet.jsp.JspContext
Parameters:
name - Attribute name
scope - (page, request, session, application)
Returns:
Attribute value

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object attribute)
Set the attribute.

Specified by:
setAttribute in class javax.servlet.jsp.JspContext
Parameters:
name - Attribute name
attribute - Attribute value

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object attribute,
                         int scope)
Set the attribute.

Specified by:
setAttribute in class javax.servlet.jsp.JspContext
Parameters:
name - Attribute name
attribute - Attribute value
scope - (page, request, session, application)

removeAttribute

public void removeAttribute(java.lang.String name,
                            int scope)
Remove the specified attribute.

Specified by:
removeAttribute in class javax.servlet.jsp.JspContext
Parameters:
name - Attribute name
scope - (page, request, session, application)

getAttributesScope

public int getAttributesScope(java.lang.String name)
Get the scope from an attribute.

Specified by:
getAttributesScope in class javax.servlet.jsp.JspContext
Parameters:
name - Attribute name.
Returns:
scope (page, request, session, application)

findAttribute

public java.lang.Object findAttribute(java.lang.String name)
Find an attribute.

Specified by:
findAttribute in class javax.servlet.jsp.JspContext
Parameters:
name - Attribute name
Returns:
Attribute value

getAttributeNamesInScope

public java.util.Enumeration getAttributeNamesInScope(int scope)
Get attribute names in scope.

Specified by:
getAttributeNamesInScope in class javax.servlet.jsp.JspContext
Parameters:
scope - (page, request, session, application)
Returns:
enumeration

removeAttribute

public void removeAttribute(java.lang.String name)
Remove attribute.

Specified by:
removeAttribute in class javax.servlet.jsp.JspContext
Parameters:
name - Attribute name

getOut

public javax.servlet.jsp.JspWriter getOut()
Not implemented !

Specified by:
getOut in class javax.servlet.jsp.JspContext
Returns:
nothing (RuntimeException)

getExpressionEvaluator

public javax.servlet.jsp.el.ExpressionEvaluator getExpressionEvaluator()
Not implemented !

Specified by:
getExpressionEvaluator in class javax.servlet.jsp.JspContext
Returns:
nothing (RuntimeException)

getVariableResolver

public javax.servlet.jsp.el.VariableResolver getVariableResolver()
Not implemented !

Specified by:
getVariableResolver in class javax.servlet.jsp.JspContext
Returns:
nothing (RuntimeException)

getSession

public javax.servlet.http.HttpSession getSession()
Get the session.

Specified by:
getSession in class javax.servlet.jsp.PageContext
Returns:
session

getServlet

public javax.servlet.Servlet getServlet()
Get the servlet.

Returns:
servlet

getServletConfig

public javax.servlet.ServletConfig getServletConfig()
Get the servlet config.

Specified by:
getServletConfig in class javax.servlet.jsp.PageContext
Returns:
servlet config

getServletContext

public javax.servlet.ServletContext getServletContext()
Get the servlet context.

Specified by:
getServletContext in class javax.servlet.jsp.PageContext
Returns:
servlet context

getRequest

public javax.servlet.ServletRequest getRequest()
Get the request.

Specified by:
getRequest in class javax.servlet.jsp.PageContext
Returns:
request

getResponse

public javax.servlet.ServletResponse getResponse()
Get the response.

Specified by:
getResponse in class javax.servlet.jsp.PageContext
Returns:
response

getException

public java.lang.Exception getException()
Get the exception.

Specified by:
getException in class javax.servlet.jsp.PageContext
Returns:
exception

getPage

public java.lang.Object getPage()
Get the servlet.

Specified by:
getPage in class javax.servlet.jsp.PageContext
Returns:
servlet

include

public void include(java.lang.String relativeUrlPath)
             throws javax.servlet.ServletException,
                    java.io.IOException
Not implemented !

Specified by:
include in class javax.servlet.jsp.PageContext
Parameters:
relativeUrlPath - relative url path
Throws:
javax.servlet.ServletException
java.io.IOException

include

public void include(java.lang.String string,
                    boolean b)
             throws javax.servlet.ServletException,
                    java.io.IOException
Not implemented !

Specified by:
include in class javax.servlet.jsp.PageContext
Parameters:
string - string
b - boolean
Throws:
javax.servlet.ServletException
java.io.IOException

forward

public void forward(java.lang.String relativeUrlPath)
             throws javax.servlet.ServletException,
                    java.io.IOException
Not implemented !

Specified by:
forward in class javax.servlet.jsp.PageContext
Parameters:
relativeUrlPath - relative url path
Throws:
javax.servlet.ServletException
java.io.IOException

pushBody

public javax.servlet.jsp.tagext.BodyContent pushBody()
Not implemented !

Overrides:
pushBody in class javax.servlet.jsp.PageContext
Returns:
nothing (RuntimeException)

popBody

public javax.servlet.jsp.JspWriter popBody()
Not implemented !

Overrides:
popBody in class javax.servlet.jsp.JspContext
Returns:
nothing (RuntimeException)

handlePageException

public void handlePageException(java.lang.Exception ex)
                         throws java.io.IOException,
                                javax.servlet.ServletException
Not implemented !

Specified by:
handlePageException in class javax.servlet.jsp.PageContext
Parameters:
ex - exception
Throws:
java.io.IOException
javax.servlet.ServletException

handlePageException

public void handlePageException(java.lang.Throwable t)
                         throws java.io.IOException,
                                javax.servlet.ServletException
Not implemented !

Specified by:
handlePageException in class javax.servlet.jsp.PageContext
Parameters:
t - throwable
Throws:
java.io.IOException
javax.servlet.ServletException


Copyright © 2010 Ideo Technologies. All Rights Reserved.