Top Description Fields Constructors Methods
org.eclipse.jetty.ee10.plus.webapp

public Class PlusDescriptorProcessor

extends IterativeDescriptorProcessor
Class Inheritance
Imports
java.util.Iterator, .Objects, javax.naming.Context, .InitialContext, .NameNotFoundException, org.eclipse.jetty.ee10.webapp.Descriptor, .FragmentDescriptor, .IterativeDescriptorProcessor, .Origin, .WebAppContext, org.eclipse.jetty.plus.annotation.Injection, .InjectionCollection, .LifeCycleCallback, .LifeCycleCallbackCollection, .PostConstructCallback, .PreDestroyCallback, org.eclipse.jetty.plus.jndi.EnvEntry, .Link, .NamingEntry, .NamingEntryUtil, org.eclipse.jetty.util.StringUtil, .TypeUtil, org.eclipse.jetty.util.jndi.NamingUtil, org.eclipse.jetty.xml.XmlParser, org.slf4j.Logger, .LoggerFactory

PlusDescriptorProcessor

Field Summary

Modifier and TypeField and Description
private static final Logger
Inherited from org.eclipse.jetty.ee10.webapp.IterativeDescriptorProcessor:
__signature_visitors

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addInjections(WebAppContext
the context
context
,
Descriptor
the descriptor
descriptor
,
XmlParser.Node
the xml node
node
,
String
the jndi name
jndiName
,
Class<?>
the value class
valueClass
)

Iterate over the <injection-target> entries for a node

protected void
bindEntry(WebAppContext
the context
context
,
String
name of the resource from web.xml
name
,
Class<?>
the type class
typeClass
)

Bind a resource with the given name from web.xml of the given type with a jndi resource from either the server or the webapp's naming environment.

public void
bindEnvEntry(String
the jndi name
name
,
Object
the value
value
)

public void
bindMessageDestinationRef(WebAppContext context, String name, Class<?> typeClass)

public void
bindResourceEnvRef(WebAppContext context, String name, Class<?> typeClass)

public void
bindResourceRef(WebAppContext
the context
context
,
String
the jndi name
name
,
Class<?>
the type class
typeClass
)

Bind a resource reference.

public void
public void
makeEnvEntryInjectionsAndBindings(WebAppContext
the WebAppContext of the env-entry
context
,
Descriptor
the web.xml, web-default.xml, web-override.xml or web-fragment.xml
descriptor
,
XmlParser.Node
the parsed xml representation of the env-entry declaration
node
,
String
the name field of the env-entry
name
,
String
the type field of the env-entry
type
,
String
the value field of the env-entry
value
)

Make injections and any java:comp/env bindings necessary given an env-entry declaration.

public void
public void
visitEnvEntry(WebAppContext
the context
context
,
Descriptor
the descriptor
descriptor
,
XmlParser.Node
the xml node
node
)

JavaEE 5.4.1.3

public void
visitMessageDestinationRef(WebAppContext
the context
context
,
Descriptor
the descriptor
descriptor
,
XmlParser.Node
the xml node
node
)

Common Annotations Spec section 2.3:

message-destination-ref is for:

  • javax.jms.Queue
  • javax.jms.Topic
public void
visitPostConstruct(WebAppContext
the context
context
,
Descriptor
the descriptor
descriptor
,
XmlParser.Node
the xml node
node
)

If web.xml has at least 1 post-construct, then all post-constructs in fragments are ignored.

public void
visitPreDestroy(WebAppContext
the context
context
,
Descriptor
the descriptor
descriptor
,
XmlParser.Node
the xml node
node
)

pre-destroy is the name of a class and method to call just as the instance is being destroyed

public void
visitResourceEnvRef(WebAppContext
the context
context
,
Descriptor
the descriptor
descriptor
,
XmlParser.Node
the xml node
node
)

Common Annotations Spec section 2.3:

resource-env-ref is for:

  • javax.transaction.UserTransaction
  • javax.resource.cci.InteractionSpec
  • anything else that is not a connection factory
public void
visitResourceRef(WebAppContext
the context
context
,
Descriptor
the descriptor
descriptor
,
XmlParser.Node
the xml node
node
)

Common Annotations Spec section 2.3:

resource-ref is for:

  • javax.sql.DataSource
  • javax.jms.ConnectionFactory
  • javax.jms.QueueConnectionFactory
  • javax.jms.TopicConnectionFactory
  • jakarta.mail.Session
  • java.net.URL
  • javax.resource.cci.ConnectionFactory
  • org.omg.CORBA_2_3.ORB
  • any other connection factory defined by a resource adapter
Inherited from org.eclipse.jetty.ee10.webapp.IterativeDescriptorProcessor:
processregisterVisitorvisit

Field Detail

LOGback to summary
private static final Logger LOG

Constructor Detail

PlusDescriptorProcessorback to summary
public PlusDescriptorProcessor()

Method Detail

addInjectionsback to summary
public void addInjections(WebAppContext context, Descriptor descriptor, XmlParser.Node node, String jndiName, Class<?> valueClass)

Iterate over the <injection-target> entries for a node

Parameters
context:WebAppContext

the context

descriptor:Descriptor

the descriptor

node:XmlParser.Node

the xml node

jndiName:String

the jndi name

valueClass:Class<?>

the value class

bindEntryback to summary
protected void bindEntry(WebAppContext context, String name, Class<?> typeClass) throws Exception

Bind a resource with the given name from web.xml of the given type with a jndi resource from either the server or the webapp's naming environment.

As the servlet spec does not cover the mapping of names in web.xml with names from the execution environment, jetty uses the concept of a Link, which is a subclass of the NamingEntry class. A Link defines a mapping of a name from web.xml with a name from the execution environment (ie either the server or the webapp's naming environment).

Parameters
context:WebAppContext

the context

name:String

name of the resource from web.xml

typeClass:Class<?>

the type class

Exceptions
Exception:
the exception
bindEnvEntryback to summary
public void bindEnvEntry(String name, Object value) throws Exception
Parameters
name:String

the jndi name

value:Object

the value

Exceptions
Exception:
if unable to bind entry
bindMessageDestinationRefback to summary
public void bindMessageDestinationRef(WebAppContext context, String name, Class<?> typeClass) throws Exception
bindResourceEnvRefback to summary
public void bindResourceEnvRef(WebAppContext context, String name, Class<?> typeClass) throws Exception
bindResourceRefback to summary
public void bindResourceRef(WebAppContext context, String name, Class<?> typeClass) throws Exception

Bind a resource reference.

If a resource reference with the same name is in a jetty-env.xml file, it will already have been bound.

Parameters
context:WebAppContext

the context

name:String

the jndi name

typeClass:Class<?>

the type class

Exceptions
Exception:
if unable to bind resource
endback to summary
public void end(WebAppContext context, Descriptor descriptor)

Implements abstract org.eclipse.jetty.ee10.webapp.IterativeDescriptorProcessor.end.

Annotations
@Override
makeEnvEntryInjectionsAndBindingsback to summary
public void makeEnvEntryInjectionsAndBindings(WebAppContext context, Descriptor descriptor, XmlParser.Node node, String name, String type, String value) throws Exception

Make injections and any java:comp/env bindings necessary given an env-entry declaration. The handling of env-entries is different to other resource declarations like resource-ref, resource-env-ref etc because we allow the EnvEntry org.eclipse.jetty.plus.jndi.EnvEntry class that is configured externally to the webapp to specify a value that can override a value present in a web.xml descriptor.

Parameters
context:WebAppContext

the WebAppContext of the env-entry

descriptor:Descriptor

the web.xml, web-default.xml, web-override.xml or web-fragment.xml

node:XmlParser.Node

the parsed xml representation of the env-entry declaration

name:String

the name field of the env-entry

type:String

the type field of the env-entry

value:String

the value field of the env-entry

Exceptions
Exception:
if there is an unspecified problem
startback to summary
public void start(WebAppContext context, Descriptor descriptor)

Implements abstract org.eclipse.jetty.ee10.webapp.IterativeDescriptorProcessor.start.

Annotations
@Override
visitEnvEntryback to summary
public void visitEnvEntry(WebAppContext context, Descriptor descriptor, XmlParser.Node node) throws Exception

JavaEE 5.4.1.3

Parameters
context:WebAppContext

the context

descriptor:Descriptor

the descriptor

node:XmlParser.Node

the xml node

Exceptions
Exception:
if unable to process jndi bindings
visitMessageDestinationRefback to summary
public void visitMessageDestinationRef(WebAppContext context, Descriptor descriptor, XmlParser.Node node) throws Exception

Common Annotations Spec section 2.3:

message-destination-ref is for:

  • javax.jms.Queue
  • javax.jms.Topic
Parameters
context:WebAppContext

the context

descriptor:Descriptor

the descriptor

node:XmlParser.Node

the xml node

Exceptions
Exception:
if unable to load classes or bind jndi entries
visitPostConstructback to summary
public void visitPostConstruct(WebAppContext context, Descriptor descriptor, XmlParser.Node node)

If web.xml has at least 1 post-construct, then all post-constructs in fragments are ignored. Otherwise, post-constructs from fragments are merged. post-construct is the name of a class and method to call after all resources have been setup but before the class is put into use

Parameters
context:WebAppContext

the context

descriptor:Descriptor

the descriptor

node:XmlParser.Node

the xml node

visitPreDestroyback to summary
public void visitPreDestroy(WebAppContext context, Descriptor descriptor, XmlParser.Node node)

pre-destroy is the name of a class and method to call just as the instance is being destroyed

Parameters
context:WebAppContext

the context

descriptor:Descriptor

the descriptor

node:XmlParser.Node

the xml node

visitResourceEnvRefback to summary
public void visitResourceEnvRef(WebAppContext context, Descriptor descriptor, XmlParser.Node node) throws Exception

Common Annotations Spec section 2.3:

resource-env-ref is for:

  • javax.transaction.UserTransaction
  • javax.resource.cci.InteractionSpec
  • anything else that is not a connection factory
Parameters
context:WebAppContext

the context

descriptor:Descriptor

the descriptor

node:XmlParser.Node

the xml node

Exceptions
Exception:
if unable to load classes, or bind jndi entries
visitResourceRefback to summary
public void visitResourceRef(WebAppContext context, Descriptor descriptor, XmlParser.Node node) throws Exception

Common Annotations Spec section 2.3:

resource-ref is for:

  • javax.sql.DataSource
  • javax.jms.ConnectionFactory
  • javax.jms.QueueConnectionFactory
  • javax.jms.TopicConnectionFactory
  • jakarta.mail.Session
  • java.net.URL
  • javax.resource.cci.ConnectionFactory
  • org.omg.CORBA_2_3.ORB
  • any other connection factory defined by a resource adapter
If web.xml contains a resource-ref with injection targets, all resource-ref entries of the same name are ignored in web fragments. If web.xml does not contain any injection-targets, then they are merged from all the fragments. If web.xml does not contain a resource-ref element of same name, but 2 fragments declare the same name it is an error. resource-ref entries are ONLY for connection factories the resource-ref says how the app will reference the jndi lookup relative to java:comp/env, but it is up to the deployer to map this reference to a real resource in the environment. At the moment, we insist that the jetty.xml file name of the resource has to be exactly the same as the name in web.xml deployment descriptor, but it shouldn't have to be

Maintenance update 3.0a to spec:

Update Section 8.2.3.h.ii with the following - If a resource reference element is specified in two fragments, while absent from the main web.xml, and all the attributes and child elements of the resource reference element are identical, the resource reference will be merged into the main web.xml. It is considered an error if a resource reference element has the same name specified in two fragments, while absent from the main web.xml and the attributes and child elements are not identical in the two fragments. For example, if two web fragments declare a <resource-ref> with the same <resource-ref-name> element but the type in one is specified as javax.sql.DataSource while the type in the other is that of a java mail resource, then an error must be reported and the application MUST fail to deploy.

Parameters
context:WebAppContext

the context

descriptor:Descriptor

the descriptor

node:XmlParser.Node

the xml node

Exceptions
Exception:
if unable to bind nodes, or load classes