public class QuickStartDescriptorGenerator
extends java.lang.Object
Generate an effective web.xml from a WebAppContext, including all components from web.xml, web-fragment.xmls annotations etc.
If generating quickstart for a different java platform than the current running platform, then the org.eclipse.jetty.annotations.javaTargetPlatform attribute should be set on the Context with the platform number of the target JVM (eg 8).
Modifier and Type | Field and Description |
---|---|
protected int |
_count |
protected java.lang.String |
_extraXML |
protected boolean |
_generateOrigin |
protected java.lang.String |
_originAttribute |
protected WebAppContext |
_webApp |
static java.lang.String |
DEFAULT_ORIGIN_ATTRIBUTE_NAME |
static java.lang.String |
DEFAULT_QUICKSTART_DESCRIPTOR_NAME |
private static Logger |
LOG |
static java.lang.String |
ORIGIN |
Constructor and Description |
---|
QuickStartDescriptorGenerator(WebAppContext w,
java.lang.String extraXML,
java.lang.String originAttribute,
boolean generateOrigin) |
Modifier and Type | Method and Description |
---|---|
private void |
addContextParamFromAttribute(XmlAppendable out,
java.lang.String attribute)
Turn attribute into context-param to store.
|
private void |
addContextParamFromAttribute(XmlAppendable out,
java.lang.String attribute,
AttributeNormalizer normalizer)
Turn context attribute into context-param to store.
|
void |
generateQuickStartWebXml(java.io.OutputStream stream)
Perform the generation of the xml file
|
java.util.Map<java.lang.String,java.lang.String> |
origin(MetaData md,
java.lang.String name)
Find the origin (web.xml, fragment, annotation etc) of a web artifact from MetaData.
|
private void |
outholder(XmlAppendable out,
MetaData md,
FilterHolder holder)
Generate xml for a Holder (Filter/Servlet)
|
private void |
outholder(XmlAppendable out,
MetaData md,
ServletHolder holder) |
private static final Logger LOG
public static final java.lang.String ORIGIN
public static final java.lang.String DEFAULT_QUICKSTART_DESCRIPTOR_NAME
public static final java.lang.String DEFAULT_ORIGIN_ATTRIBUTE_NAME
protected WebAppContext _webApp
protected java.lang.String _extraXML
protected java.lang.String _originAttribute
protected boolean _generateOrigin
protected int _count
public QuickStartDescriptorGenerator(WebAppContext w, java.lang.String extraXML, java.lang.String originAttribute, boolean generateOrigin)
w
- the source WebAppContextextraXML
- any extra xml snippet to appendoriginAttribute
- param value to use for the context param origin attributegenerateOrigin
- true
to generate the origin attributepublic void generateQuickStartWebXml(java.io.OutputStream stream) throws java.io.FileNotFoundException, java.io.IOException
stream
- the stream to generate the quickstart-web.xml tojava.io.IOException
- if unable to generate the quickstart-web.xmljava.io.FileNotFoundException
- if unable to find the fileprivate void addContextParamFromAttribute(XmlAppendable out, java.lang.String attribute) throws java.io.IOException
out
- attribute
- java.io.IOException
private void addContextParamFromAttribute(XmlAppendable out, java.lang.String attribute, AttributeNormalizer normalizer) throws java.io.IOException
out
- attribute
- resourceBase
- java.io.IOException
private void outholder(XmlAppendable out, MetaData md, FilterHolder holder) throws java.io.IOException
out
- md
- tag
- holder
- java.io.IOException
private void outholder(XmlAppendable out, MetaData md, ServletHolder holder) throws java.io.IOException
java.io.IOException
public java.util.Map<java.lang.String,java.lang.String> origin(MetaData md, java.lang.String name)
md
- the metadataname
- the name