private void writeContainerConfig(XMLExtendedStreamWriter writer, ModelNode config)
     throws XMLStreamException {
   boolean containerConfigStartWritten = false;
   if (config.hasDefined(STATIC_RESOURCES)) {
     containerConfigStartWritten = writeStaticResources(writer, config.get(STATIC_RESOURCES));
   }
   if (config.hasDefined(JSP_CONFIGURATION)) {
     containerConfigStartWritten =
         writeJSPConfiguration(writer, config.get(JSP_CONFIGURATION), containerConfigStartWritten)
             || containerConfigStartWritten;
   }
   ModelNode container = config;
   if (config.hasDefined(CONTAINER)) {
     // this has been added to get the stuff manageable
     container = config.get(CONTAINER);
   }
   if (container.hasDefined(MIME_MAPPING)) {
     if (!containerConfigStartWritten) {
       writer.writeStartElement(Element.CONTAINER_CONFIG.getLocalName());
       containerConfigStartWritten = true;
     }
     for (final Property entry : container.get(MIME_MAPPING).asPropertyList()) {
       writer.writeEmptyElement(Element.MIME_MAPPING.getLocalName());
       writer.writeAttribute(Attribute.NAME.getLocalName(), entry.getName());
       writer.writeAttribute(Attribute.VALUE.getLocalName(), entry.getValue().asString());
     }
   }
   if (container.hasDefined(WELCOME_FILE)) {
     if (!containerConfigStartWritten) {
       writer.writeStartElement(Element.CONTAINER_CONFIG.getLocalName());
       containerConfigStartWritten = true;
     }
     for (final ModelNode file : container.get(WELCOME_FILE).asList()) {
       writer.writeStartElement(Element.WELCOME_FILE.getLocalName());
       writer.writeCharacters(file.asString());
       writer.writeEndElement();
     }
   }
   if (containerConfigStartWritten) {
     writer.writeEndElement();
   }
 }
 private boolean writeStaticResourceAttribute(
     XMLExtendedStreamWriter writer, String attribute, ModelNode config, boolean startWritten)
     throws XMLStreamException {
   if (DefaultStaticResources.hasNotDefault(config, attribute)) {
     if (!startWritten) {
       writer.writeStartElement(Element.CONTAINER_CONFIG.getLocalName());
       writer.writeStartElement(Element.STATIC_RESOURCES.getLocalName());
     }
     writer.writeAttribute(attribute, config.get(attribute).asString());
     return true;
   }
   return false;
 }
 private boolean writeJspConfigAttribute(
     XMLExtendedStreamWriter writer,
     String attribute,
     ModelNode config,
     boolean startWritten,
     boolean containerConfigStartWritten)
     throws XMLStreamException {
   if (DefaultJspConfig.hasNotDefault(config, attribute)) {
     if (!startWritten) {
       if (!containerConfigStartWritten) {
         writer.writeStartElement(Element.CONTAINER_CONFIG.getLocalName());
       }
       writer.writeStartElement(Element.JSP_CONFIGURATION.getLocalName());
     }
     writer.writeAttribute(attribute, config.get(attribute).asString());
     return true;
   }
   return false;
 }