JNDI names may or may not include the "java:comp/env/" prefix expected by Jakarta EE applications when accessing a locally mapped (ENC - Environmental Naming Context) resource. If it doesn't, the "java:comp/env/" prefix will be prepended if the "resourceRef" property is true (the default is false) and no other scheme (e.g. "java:") is given.
setJndiTemplate, setJndiEnvironment, setResourceRef
| Modifier and Type | Field and Description |
|---|---|
| public static final String | CONTAINER_PREFIX
JNDI prefix used in a Jakarta EE container. |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected String | Returns: the JNDI name to usethe original JNDI name jndiName)Convert the given JNDI name into the actual JNDI name to use. |
| public boolean | |
| protected Object | |
| protected <T> T | |
| public void | setResourceRef(boolean resourceRef)
Set whether the lookup occurs in a Jakarta EE container, i.e. if the prefix "java:comp/env/" needs to be added if the JNDI name doesn't already contain it. |
| CONTAINER_PREFIX | back to summary |
|---|---|
| public static final String CONTAINER_PREFIX JNDI prefix used in a Jakarta EE container. | |
| resourceRef | back to summary |
|---|---|
| private boolean resourceRef | |
| JndiLocatorSupport | back to summary |
|---|---|
| public JndiLocatorSupport() | |
| convertJndiName | back to summary |
|---|---|
| protected String convertJndiName(String jndiName) Convert the given JNDI name into the actual JNDI name to use. The default implementation applies the "java:comp/env/" prefix if "resourceRef" is "true" and no other scheme (e.g. "java:") is given.
| |
| isResourceRef | back to summary |
|---|---|
| public boolean isResourceRef() Return whether the lookup occurs in a Jakarta EE container. | |
| lookup | back to summary |
|---|---|
| protected Object lookup(String jndiName) throws NamingException Perform an actual JNDI lookup for the given name via the JndiTemplate. If the name doesn't begin with "java:comp/env/", this prefix is added if "resourceRef" is set to "true".
| |
| lookup | back to summary |
|---|---|
| protected <T> T lookup(String jndiName, Class<T> requiredType) throws NamingException Perform an actual JNDI lookup for the given name via the JndiTemplate. If the name doesn't begin with "java:comp/env/", this prefix is added if "resourceRef" is set to "true".
| |
| setResourceRef | back to summary |
|---|---|
| public void setResourceRef(boolean resourceRef) Set whether the lookup occurs in a Jakarta EE container, i.e. if the prefix "java:comp/env/" needs to be added if the JNDI name doesn't already contain it. Default is "false". Note Will only get applied if no other scheme (e.g. "java:") is given. | |