Class ImplicitObjectELResolver
- java.lang.Object
-
- jakarta.el.ELResolver
-
- jakarta.servlet.jsp.el.ImplicitObjectELResolver
-
public class ImplicitObjectELResolver extends ELResolver
Defines variable resolution behavior for the EL implicit objects defined in the JSP specification.The following variables are resolved by this
ELResolver, as per the JSP specification:pageContext- thePageContextobject.pageScope- aMapthat maps page-scoped attribute names to their values.requestScope- aMapthat maps request-scoped attribute names to their values.sessionScope- aMapthat maps session-scoped attribute names to their values.applicationScope- aMapthat maps application-scoped attribute names to their values.param- aMapthat maps parameter names to a single String parameter value (obtained by callingServletRequest.getParameter(String name)).paramValues- aMapthat maps parameter names to aString[]of all values for that parameter (obtained by callingServletRequest.getParameterValues(String name)).header- aMapthat maps header names to a single String header value (obtained by callingHttpServletRequest.getHeader(String name)).headerValues- aMapthat maps header names to aString[]of all values for that header (obtained by callingHttpServletRequest.getHeaders(String)).cookie- aMapthat maps cookie names to a singleCookieobject. Cookies are retrieved according to the semantics ofHttpServletRequest.getCookies(). If the same name is shared by multiple cookies, an implementation must use the first one encountered in the array ofCookieobjects returned by thegetCookies()method. However, users of the cookie implicit object must be aware that the ordering of cookies is currently unspecified in the servlet specification.initParam- aMapthat maps context initialization parameter names to their String parameter value (obtained by callingServletContext.getInitParameter(String name)).
- Since:
- JSP 2.1
- See Also:
ELResolver
-
-
Field Summary
-
Fields inherited from class jakarta.el.ELResolver
RESOLVABLE_AT_DESIGN_TIME, TYPE
-
-
Constructor Summary
Constructors Constructor Description ImplicitObjectELResolver()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Class<String>getCommonPropertyType(ELContext context, Object base)If the base object isnull, returnsString.class.Iterator<FeatureDescriptor>getFeatureDescriptors(ELContext context, Object base)Deprecated, for removal: This API element is subject to removal in a future version.This method is deprecated as of EL 5.0 and will be removed in EL 6.0 (Jakarta EE 11).Class<?>getType(ELContext context, Object base, Object property)If the base object isnull, and the property matches the name of a JSP implicit object, returnsnullto indicate that no types are ever accepted tosetValue().ObjectgetValue(ELContext context, Object base, Object property)If the base object isnull, and the property matches the name of a JSP implicit object, returns the implicit object.booleanisReadOnly(ELContext context, Object base, Object property)If the base object isnull, and the property matches the name of a JSP implicit object, returnstrueto indicate that implicit objects cannot be overwritten.voidsetValue(ELContext context, Object base, Object property, Object val)If the base object isnull, and the property matches the name of a JSP implicit object, throwsPropertyNotWritableExceptionto indicate that implicit objects cannot be overwritten.-
Methods inherited from class jakarta.el.ELResolver
convertToType, invoke
-
-
-
-
Method Detail
-
getValue
public Object getValue(ELContext context, Object base, Object property)
If the base object isnull, and the property matches the name of a JSP implicit object, returns the implicit object.The
propertyResolvedproperty of theELContextobject must be set totrueby this resolver before returning if an implicit object is matched. If this property is nottrueafter this method is called, the caller should ignore the return value.- Specified by:
getValuein classELResolver- Parameters:
context- The context of this evaluation.base- Onlynullis handled by this resolver. Other values will result in an immediate return.property- The name of the implicit object to resolve.- Returns:
- If the
propertyResolvedproperty ofELContextwas set totrue, then the implicit object; otherwise undefined. - Throws:
NullPointerException- if context isnull
-
getType
public Class<?> getType(ELContext context, Object base, Object property)
If the base object isnull, and the property matches the name of a JSP implicit object, returnsnullto indicate that no types are ever accepted tosetValue().The
propertyResolvedproperty of theELContextobject must be set totrueby this resolver before returning if an implicit object is matched. If this property is nottrueafter this method is called, the caller should ignore the return value.- Specified by:
getTypein classELResolver- Parameters:
context- The context of this evaluation.base- Onlynullis handled by this resolver. Other values will result in an immediate return.property- The name of the implicit object to resolve.- Returns:
- If the
propertyResolvedproperty ofELContextwas set totrue, thennull; otherwise undefined. - Throws:
NullPointerException- if context isnull
-
setValue
public void setValue(ELContext context, Object base, Object property, Object val)
If the base object isnull, and the property matches the name of a JSP implicit object, throwsPropertyNotWritableExceptionto indicate that implicit objects cannot be overwritten.The
propertyResolvedproperty of theELContextobject must be set totrueby this resolver before returning if an implicit object is matched. If this property is nottrueafter this method is called, the caller should ignore the return value.- Specified by:
setValuein classELResolver- Parameters:
context- The context of this evaluation.base- Onlynullis handled by this resolver. Other values will result in an immediate return.property- The name of the implicit object.val- The value to be associated with the implicit object.- Throws:
NullPointerException- if context isnull.PropertyNotWritableException- always thrown, if the implicit object name is recognized by this resolver.
-
isReadOnly
public boolean isReadOnly(ELContext context, Object base, Object property)
If the base object isnull, and the property matches the name of a JSP implicit object, returnstrueto indicate that implicit objects cannot be overwritten.The
propertyResolvedproperty of theELContextobject must be set totrueby this resolver before returning if an implicit object is matched. If this property is nottrueafter this method is called, the caller should ignore the return value.- Specified by:
isReadOnlyin classELResolver- Parameters:
context- The context of this evaluation.base- Onlynullis handled by this resolver. Other values will result in an immediate return.property- The name of the implicit object.- Returns:
- If the
propertyResolvedproperty ofELContextwas set totrue, thentrue; otherwise undefined. - Throws:
NullPointerException- if context isnull.
-
getFeatureDescriptors
@Deprecated(forRemoval=true, since="JSP 3.1") public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base)
Deprecated, for removal: This API element is subject to removal in a future version.This method is deprecated as of EL 5.0 and will be removed in EL 6.0 (Jakarta EE 11). Therefore it will be removed here in JSP 4.0.If the base object isnull, and the property matches the name of a JSP implicit object, returns anIteratorcontainingFeatureDescriptorobjects with information about each JSP implicit object resolved by this resolver. Otherwise, returnsnull.The
Iteratorreturned must contain one instance ofFeatureDescriptorfor each of the EL implicit objects defined by the JSP spec. Each info object contains information about a single implicit object, and is initialized as follows:- displayName
- - The name of the implicit object.
- name
- - Same as displayName property.
- shortDescription
- - A suitable description for the implicit object. Will vary by implementation.
- expert
- -
false - hidden
- -
false - preferred
- -
true
FeatureDescriptors:ELResolver.TYPE- - The runtime type of the implicit object.
ELResolver.RESOLVABLE_AT_DESIGN_TIME- -
true.
- Overrides:
getFeatureDescriptorsin classELResolver- Parameters:
context- The context of this evaluation.base- Onlynullis handled by this resolver. Other values will result in anullreturn value.- Returns:
- An
Iteratorcontaining oneFeatureDescriptorobject for each implicit object, ornullifbaseis notnull. - See Also:
FeatureDescriptor
-
getCommonPropertyType
public Class<String> getCommonPropertyType(ELContext context, Object base)
If the base object isnull, returnsString.class. Otherwise, returnsnull.- Specified by:
getCommonPropertyTypein classELResolver- Parameters:
context- The context of this evaluation.base- Onlynullis handled by this resolver. Other values will result in anullreturn value.- Returns:
nullif base is notnull; otherwiseString.class.
-
-