public static void parseHandlers(
     XMLExtendedStreamReader reader, PathAddress parentAddress, List<ModelNode> list)
     throws XMLStreamException {
   Map<String, Handler> handlerMap = HandlerFactory.getHandlerMap();
   while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
     String tagName = reader.getLocalName();
     Handler handler = handlerMap.get(tagName);
     if (handler != null) {
       handler.parse(reader, parentAddress, list);
     } else {
       throw UndertowMessages.MESSAGES.unknownHandler(tagName, reader.getLocation());
     }
   }
 }
 public static void persistHandlers(XMLExtendedStreamWriter writer, ModelNode model, boolean wrap)
     throws XMLStreamException {
   if (model.hasDefined(Constants.HANDLER)) {
     if (wrap) {
       writer.writeStartElement(Constants.HANDLERS);
     }
     Map<String, Handler> handlerMap = HandlerFactory.getHandlerMap();
     for (final Property handlerProp : model.get(Constants.HANDLER).asPropertyList()) {
       Handler handler = handlerMap.get(handlerProp.getName());
       handler.persist(writer, handlerProp);
     }
     if (wrap) {
       writer.writeEndElement();
     }
   }
 }