Implementation of a JSP Context Wrapper.
The JSP Context Wrapper is a JspContext created and maintained by a tag
handler implementation. It wraps the Invoking JSP Context, that is, the
JspContext instance passed to the tag handler by the invoking page via
setJspContext().
| Method from org.apache.jasper.runtime.JspContextWrapper Detail: |
public Object findAttribute(String name) {
if (name == null) {
throw new NullPointerException(Localizer
.getMessage("jsp.error.attribute.null_name"));
}
Object o = pageAttributes.get(name);
if (o == null) {
o = invokingJspCtxt.getAttribute(name, REQUEST_SCOPE);
if (o == null) {
if (getSession() != null) {
o = invokingJspCtxt.getAttribute(name, SESSION_SCOPE);
}
if (o == null) {
o = invokingJspCtxt.getAttribute(name, APPLICATION_SCOPE);
}
}
}
return o;
}
|
public void forward(String relativeUrlPath) throws IOException, ServletException {
invokingJspCtxt.forward(relativeUrlPath);
}
|
public Object getAttribute(String name) {
if (name == null) {
throw new NullPointerException(Localizer
.getMessage("jsp.error.attribute.null_name"));
}
return pageAttributes.get(name);
}
|
public Object getAttribute(String name,
int scope) {
if (name == null) {
throw new NullPointerException(Localizer
.getMessage("jsp.error.attribute.null_name"));
}
if (scope == PAGE_SCOPE) {
return pageAttributes.get(name);
}
return invokingJspCtxt.getAttribute(name, scope);
}
|
public Enumeration getAttributeNamesInScope(int scope) {
if (scope == PAGE_SCOPE) {
return new Enumerator(pageAttributes.keySet().iterator());
}
return invokingJspCtxt.getAttributeNamesInScope(scope);
}
|
public int getAttributesScope(String name) {
if (name == null) {
throw new NullPointerException(Localizer
.getMessage("jsp.error.attribute.null_name"));
}
if (pageAttributes.get(name) != null) {
return PAGE_SCOPE;
} else {
return invokingJspCtxt.getAttributesScope(name);
}
}
|
public ELContext getELContext() {
// instead decorate!!!
return this.invokingJspCtxt.getELContext();
/*
if (this.elContext != null) {
JspFactory jspFact = JspFactory.getDefaultFactory();
ServletContext servletContext = this.getServletContext();
JspApplicationContextImpl jspCtx = (JspApplicationContextImpl) jspFact
.getJspApplicationContext(servletContext);
this.elContext = jspCtx.createELContext(this);
}
return this.elContext;
*/
}
|
public Exception getException() {
return invokingJspCtxt.getException();
}
|
public ExpressionEvaluator getExpressionEvaluator() {
return invokingJspCtxt.getExpressionEvaluator();
}
|
public JspWriter getOut() {
return invokingJspCtxt.getOut();
}
|
public Object getPage() {
return invokingJspCtxt.getPage();
}
|
public ServletRequest getRequest() {
return invokingJspCtxt.getRequest();
}
|
public ServletResponse getResponse() {
return invokingJspCtxt.getResponse();
}
|
public ServletConfig getServletConfig() {
return invokingJspCtxt.getServletConfig();
}
|
public ServletContext getServletContext() {
return invokingJspCtxt.getServletContext();
}
|
public HttpSession getSession() {
return invokingJspCtxt.getSession();
}
|
public VariableResolver getVariableResolver() {
return this;
}
|
public void handlePageException(Exception ex) throws IOException, ServletException {
// Should never be called since handleException() called with a
// Throwable in the generated servlet.
handlePageException((Throwable) ex);
}
|
public void handlePageException(Throwable t) throws IOException, ServletException {
invokingJspCtxt.handlePageException(t);
}
|
public void include(String relativeUrlPath) throws IOException, ServletException {
invokingJspCtxt.include(relativeUrlPath);
}
|
public void include(String relativeUrlPath,
boolean flush) throws IOException, ServletException {
include(relativeUrlPath, false); // XXX
}
|
public void initialize(Servlet servlet,
ServletRequest request,
ServletResponse response,
String errorPageURL,
boolean needsSession,
int bufferSize,
boolean autoFlush) throws IllegalArgumentException, IOException, IllegalStateException {
}
|
public JspWriter popBody() {
return invokingJspCtxt.popBody();
}
|
public BodyContent pushBody() {
return invokingJspCtxt.pushBody();
}
|
public JspWriter pushBody(Writer writer) {
return invokingJspCtxt.pushBody(writer);
}
|
public void release() {
invokingJspCtxt.release();
}
|
public void removeAttribute(String name) {
if (name == null) {
throw new NullPointerException(Localizer
.getMessage("jsp.error.attribute.null_name"));
}
pageAttributes.remove(name);
invokingJspCtxt.removeAttribute(name, REQUEST_SCOPE);
if (getSession() != null) {
invokingJspCtxt.removeAttribute(name, SESSION_SCOPE);
}
invokingJspCtxt.removeAttribute(name, APPLICATION_SCOPE);
}
|
public void removeAttribute(String name,
int scope) {
if (name == null) {
throw new NullPointerException(Localizer
.getMessage("jsp.error.attribute.null_name"));
}
if (scope == PAGE_SCOPE) {
pageAttributes.remove(name);
} else {
invokingJspCtxt.removeAttribute(name, scope);
}
}
|
public Object resolveVariable(String pName) throws ELException {
ELContext ctx = this.getELContext();
return ctx.getELResolver().getValue(ctx, null, pName);
}
VariableResolver interface |
public void setAttribute(String name,
Object value) {
if (name == null) {
throw new NullPointerException(Localizer
.getMessage("jsp.error.attribute.null_name"));
}
if (value != null) {
pageAttributes.put(name, value);
} else {
removeAttribute(name, PAGE_SCOPE);
}
}
|
public void setAttribute(String name,
Object value,
int scope) {
if (name == null) {
throw new NullPointerException(Localizer
.getMessage("jsp.error.attribute.null_name"));
}
if (scope == PAGE_SCOPE) {
if (value != null) {
pageAttributes.put(name, value);
} else {
removeAttribute(name, PAGE_SCOPE);
}
} else {
invokingJspCtxt.setAttribute(name, value, scope);
}
}
|
public void syncBeforeInvoke() {
copyTagToPageScope(VariableInfo.NESTED);
copyTagToPageScope(VariableInfo.AT_BEGIN);
}
Synchronize variables before fragment invokation |
public void syncBeginTagFile() {
saveNestedVariables();
}
Synchronize variables at begin of tag file |
public void syncEndTagFile() {
copyTagToPageScope(VariableInfo.AT_BEGIN);
copyTagToPageScope(VariableInfo.AT_END);
restoreNestedVariables();
}
Synchronize variables at end of tag file |