Java Code Examples for com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil#getElementText()

The following examples show how to use com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil#getElementText() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HandlerChainsModel.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * reader should be on <handler-chains> element
 */
public static HandlerChainsModel parseHandlerConfigFile(Class annotatedClass, XMLStreamReader reader) {
    ensureProperName(reader,QNAME_HANDLER_CHAINS);
    HandlerChainsModel handlerModel = new HandlerChainsModel(annotatedClass);
    List<HandlerChainType> hChains = handlerModel.getHandlerChain();
    XMLStreamReaderUtil.nextElementContent(reader);

    while (reader.getName().equals(QNAME_HANDLER_CHAIN)) {
        HandlerChainType hChain = new HandlerChainType();
        XMLStreamReaderUtil.nextElementContent(reader);

        if (reader.getName().equals(QNAME_CHAIN_PORT_PATTERN)) {
            QName portNamePattern = XMLStreamReaderUtil.getElementQName(reader);
            hChain.setPortNamePattern(portNamePattern);
            XMLStreamReaderUtil.nextElementContent(reader);
        } else if (reader.getName().equals(QNAME_CHAIN_PROTOCOL_BINDING)) {
            String bindingList = XMLStreamReaderUtil.getElementText(reader);
            StringTokenizer stk = new StringTokenizer(bindingList);
            while(stk.hasMoreTokens()) {
                String token = stk.nextToken();
                // This will convert tokens into Binding URI
                hChain.addProtocolBinding(token);
            }
            XMLStreamReaderUtil.nextElementContent(reader);
        } else if (reader.getName().equals(QNAME_CHAIN_SERVICE_PATTERN)) {
            QName serviceNamepattern = XMLStreamReaderUtil.getElementQName(reader);
            hChain.setServiceNamePattern(serviceNamepattern);
            XMLStreamReaderUtil.nextElementContent(reader);
        }
        List<HandlerType> handlers = hChain.getHandlers();
        // process all <handler> elements
        while (reader.getName().equals(QNAME_HANDLER)) {
            HandlerType handler = new HandlerType();

            XMLStreamReaderUtil.nextContent(reader);
            if (reader.getName().equals(QNAME_HANDLER_NAME)) {
                String handlerName =
                        XMLStreamReaderUtil.getElementText(reader).trim();
                handler.setHandlerName(handlerName);
                XMLStreamReaderUtil.nextContent(reader);
            }

            // handler class
            ensureProperName(reader, QNAME_HANDLER_CLASS);
            String handlerClass =
                    XMLStreamReaderUtil.getElementText(reader).trim();
            handler.setHandlerClass(handlerClass);
            XMLStreamReaderUtil.nextContent(reader);

            // init params (ignored)
            while (reader.getName().equals(QNAME_HANDLER_PARAM)) {
                skipInitParamElement(reader);
            }

            // headers (ignored)
            while (reader.getName().equals(QNAME_HANDLER_HEADER)) {
                skipTextElement(reader);
            }

            // roles (not stored per handler)
            while (reader.getName().equals(QNAME_HANDLER_ROLE)) {
                List<String> soapRoles = handler.getSoapRoles();
                soapRoles.add(XMLStreamReaderUtil.getElementText(reader));
                XMLStreamReaderUtil.nextContent(reader);
            }

            handlers.add(handler);

            // move past </handler>
            ensureProperName(reader, QNAME_HANDLER);
            XMLStreamReaderUtil.nextContent(reader);
        }

        // move past </handler-chain>
        ensureProperName(reader, QNAME_HANDLER_CHAIN);
        hChains.add(hChain);
        XMLStreamReaderUtil.nextContent(reader);
    }

    return handlerModel;
}
 
Example 2
Source File: HandlerChainsModel.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * reader should be on <handler-chains> element
 */
public static HandlerChainsModel parseHandlerConfigFile(Class annotatedClass, XMLStreamReader reader) {
    ensureProperName(reader,QNAME_HANDLER_CHAINS);
    HandlerChainsModel handlerModel = new HandlerChainsModel(annotatedClass);
    List<HandlerChainType> hChains = handlerModel.getHandlerChain();
    XMLStreamReaderUtil.nextElementContent(reader);

    while (reader.getName().equals(QNAME_HANDLER_CHAIN)) {
        HandlerChainType hChain = new HandlerChainType();
        XMLStreamReaderUtil.nextElementContent(reader);

        if (reader.getName().equals(QNAME_CHAIN_PORT_PATTERN)) {
            QName portNamePattern = XMLStreamReaderUtil.getElementQName(reader);
            hChain.setPortNamePattern(portNamePattern);
            XMLStreamReaderUtil.nextElementContent(reader);
        } else if (reader.getName().equals(QNAME_CHAIN_PROTOCOL_BINDING)) {
            String bindingList = XMLStreamReaderUtil.getElementText(reader);
            StringTokenizer stk = new StringTokenizer(bindingList);
            while(stk.hasMoreTokens()) {
                String token = stk.nextToken();
                // This will convert tokens into Binding URI
                hChain.addProtocolBinding(token);
            }
            XMLStreamReaderUtil.nextElementContent(reader);
        } else if (reader.getName().equals(QNAME_CHAIN_SERVICE_PATTERN)) {
            QName serviceNamepattern = XMLStreamReaderUtil.getElementQName(reader);
            hChain.setServiceNamePattern(serviceNamepattern);
            XMLStreamReaderUtil.nextElementContent(reader);
        }
        List<HandlerType> handlers = hChain.getHandlers();
        // process all <handler> elements
        while (reader.getName().equals(QNAME_HANDLER)) {
            HandlerType handler = new HandlerType();

            XMLStreamReaderUtil.nextContent(reader);
            if (reader.getName().equals(QNAME_HANDLER_NAME)) {
                String handlerName =
                        XMLStreamReaderUtil.getElementText(reader).trim();
                handler.setHandlerName(handlerName);
                XMLStreamReaderUtil.nextContent(reader);
            }

            // handler class
            ensureProperName(reader, QNAME_HANDLER_CLASS);
            String handlerClass =
                    XMLStreamReaderUtil.getElementText(reader).trim();
            handler.setHandlerClass(handlerClass);
            XMLStreamReaderUtil.nextContent(reader);

            // init params (ignored)
            while (reader.getName().equals(QNAME_HANDLER_PARAM)) {
                skipInitParamElement(reader);
            }

            // headers (ignored)
            while (reader.getName().equals(QNAME_HANDLER_HEADER)) {
                skipTextElement(reader);
            }

            // roles (not stored per handler)
            while (reader.getName().equals(QNAME_HANDLER_ROLE)) {
                List<String> soapRoles = handler.getSoapRoles();
                soapRoles.add(XMLStreamReaderUtil.getElementText(reader));
                XMLStreamReaderUtil.nextContent(reader);
            }

            handlers.add(handler);

            // move past </handler>
            ensureProperName(reader, QNAME_HANDLER);
            XMLStreamReaderUtil.nextContent(reader);
        }

        // move past </handler-chain>
        ensureProperName(reader, QNAME_HANDLER_CHAIN);
        hChains.add(hChain);
        XMLStreamReaderUtil.nextContent(reader);
    }

    return handlerModel;
}
 
Example 3
Source File: HandlerChainsModel.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * reader should be on <handler-chains> element
 */
public static HandlerChainsModel parseHandlerConfigFile(Class annotatedClass, XMLStreamReader reader) {
    ensureProperName(reader,QNAME_HANDLER_CHAINS);
    HandlerChainsModel handlerModel = new HandlerChainsModel(annotatedClass);
    List<HandlerChainType> hChains = handlerModel.getHandlerChain();
    XMLStreamReaderUtil.nextElementContent(reader);

    while (reader.getName().equals(QNAME_HANDLER_CHAIN)) {
        HandlerChainType hChain = new HandlerChainType();
        XMLStreamReaderUtil.nextElementContent(reader);

        if (reader.getName().equals(QNAME_CHAIN_PORT_PATTERN)) {
            QName portNamePattern = XMLStreamReaderUtil.getElementQName(reader);
            hChain.setPortNamePattern(portNamePattern);
            XMLStreamReaderUtil.nextElementContent(reader);
        } else if (reader.getName().equals(QNAME_CHAIN_PROTOCOL_BINDING)) {
            String bindingList = XMLStreamReaderUtil.getElementText(reader);
            StringTokenizer stk = new StringTokenizer(bindingList);
            while(stk.hasMoreTokens()) {
                String token = stk.nextToken();
                // This will convert tokens into Binding URI
                hChain.addProtocolBinding(token);
            }
            XMLStreamReaderUtil.nextElementContent(reader);
        } else if (reader.getName().equals(QNAME_CHAIN_SERVICE_PATTERN)) {
            QName serviceNamepattern = XMLStreamReaderUtil.getElementQName(reader);
            hChain.setServiceNamePattern(serviceNamepattern);
            XMLStreamReaderUtil.nextElementContent(reader);
        }
        List<HandlerType> handlers = hChain.getHandlers();
        // process all <handler> elements
        while (reader.getName().equals(QNAME_HANDLER)) {
            HandlerType handler = new HandlerType();

            XMLStreamReaderUtil.nextContent(reader);
            if (reader.getName().equals(QNAME_HANDLER_NAME)) {
                String handlerName =
                        XMLStreamReaderUtil.getElementText(reader).trim();
                handler.setHandlerName(handlerName);
                XMLStreamReaderUtil.nextContent(reader);
            }

            // handler class
            ensureProperName(reader, QNAME_HANDLER_CLASS);
            String handlerClass =
                    XMLStreamReaderUtil.getElementText(reader).trim();
            handler.setHandlerClass(handlerClass);
            XMLStreamReaderUtil.nextContent(reader);

            // init params (ignored)
            while (reader.getName().equals(QNAME_HANDLER_PARAM)) {
                skipInitParamElement(reader);
            }

            // headers (ignored)
            while (reader.getName().equals(QNAME_HANDLER_HEADER)) {
                skipTextElement(reader);
            }

            // roles (not stored per handler)
            while (reader.getName().equals(QNAME_HANDLER_ROLE)) {
                List<String> soapRoles = handler.getSoapRoles();
                soapRoles.add(XMLStreamReaderUtil.getElementText(reader));
                XMLStreamReaderUtil.nextContent(reader);
            }

            handlers.add(handler);

            // move past </handler>
            ensureProperName(reader, QNAME_HANDLER);
            XMLStreamReaderUtil.nextContent(reader);
        }

        // move past </handler-chain>
        ensureProperName(reader, QNAME_HANDLER_CHAIN);
        hChains.add(hChain);
        XMLStreamReaderUtil.nextContent(reader);
    }

    return handlerModel;
}
 
Example 4
Source File: HandlerChainsModel.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * reader should be on <handler-chains> element
 */
public static HandlerChainsModel parseHandlerConfigFile(Class annotatedClass, XMLStreamReader reader) {
    ensureProperName(reader,QNAME_HANDLER_CHAINS);
    HandlerChainsModel handlerModel = new HandlerChainsModel(annotatedClass);
    List<HandlerChainType> hChains = handlerModel.getHandlerChain();
    XMLStreamReaderUtil.nextElementContent(reader);

    while (reader.getName().equals(QNAME_HANDLER_CHAIN)) {
        HandlerChainType hChain = new HandlerChainType();
        XMLStreamReaderUtil.nextElementContent(reader);

        if (reader.getName().equals(QNAME_CHAIN_PORT_PATTERN)) {
            QName portNamePattern = XMLStreamReaderUtil.getElementQName(reader);
            hChain.setPortNamePattern(portNamePattern);
            XMLStreamReaderUtil.nextElementContent(reader);
        } else if (reader.getName().equals(QNAME_CHAIN_PROTOCOL_BINDING)) {
            String bindingList = XMLStreamReaderUtil.getElementText(reader);
            StringTokenizer stk = new StringTokenizer(bindingList);
            while(stk.hasMoreTokens()) {
                String token = stk.nextToken();
                // This will convert tokens into Binding URI
                hChain.addProtocolBinding(token);
            }
            XMLStreamReaderUtil.nextElementContent(reader);
        } else if (reader.getName().equals(QNAME_CHAIN_SERVICE_PATTERN)) {
            QName serviceNamepattern = XMLStreamReaderUtil.getElementQName(reader);
            hChain.setServiceNamePattern(serviceNamepattern);
            XMLStreamReaderUtil.nextElementContent(reader);
        }
        List<HandlerType> handlers = hChain.getHandlers();
        // process all <handler> elements
        while (reader.getName().equals(QNAME_HANDLER)) {
            HandlerType handler = new HandlerType();

            XMLStreamReaderUtil.nextContent(reader);
            if (reader.getName().equals(QNAME_HANDLER_NAME)) {
                String handlerName =
                        XMLStreamReaderUtil.getElementText(reader).trim();
                handler.setHandlerName(handlerName);
                XMLStreamReaderUtil.nextContent(reader);
            }

            // handler class
            ensureProperName(reader, QNAME_HANDLER_CLASS);
            String handlerClass =
                    XMLStreamReaderUtil.getElementText(reader).trim();
            handler.setHandlerClass(handlerClass);
            XMLStreamReaderUtil.nextContent(reader);

            // init params (ignored)
            while (reader.getName().equals(QNAME_HANDLER_PARAM)) {
                skipInitParamElement(reader);
            }

            // headers (ignored)
            while (reader.getName().equals(QNAME_HANDLER_HEADER)) {
                skipTextElement(reader);
            }

            // roles (not stored per handler)
            while (reader.getName().equals(QNAME_HANDLER_ROLE)) {
                List<String> soapRoles = handler.getSoapRoles();
                soapRoles.add(XMLStreamReaderUtil.getElementText(reader));
                XMLStreamReaderUtil.nextContent(reader);
            }

            handlers.add(handler);

            // move past </handler>
            ensureProperName(reader, QNAME_HANDLER);
            XMLStreamReaderUtil.nextContent(reader);
        }

        // move past </handler-chain>
        ensureProperName(reader, QNAME_HANDLER_CHAIN);
        hChains.add(hChain);
        XMLStreamReaderUtil.nextContent(reader);
    }

    return handlerModel;
}
 
Example 5
Source File: HandlerChainsModel.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * reader should be on <handler-chains> element
 */
public static HandlerChainsModel parseHandlerConfigFile(Class annotatedClass, XMLStreamReader reader) {
    ensureProperName(reader,QNAME_HANDLER_CHAINS);
    HandlerChainsModel handlerModel = new HandlerChainsModel(annotatedClass);
    List<HandlerChainType> hChains = handlerModel.getHandlerChain();
    XMLStreamReaderUtil.nextElementContent(reader);

    while (reader.getName().equals(QNAME_HANDLER_CHAIN)) {
        HandlerChainType hChain = new HandlerChainType();
        XMLStreamReaderUtil.nextElementContent(reader);

        if (reader.getName().equals(QNAME_CHAIN_PORT_PATTERN)) {
            QName portNamePattern = XMLStreamReaderUtil.getElementQName(reader);
            hChain.setPortNamePattern(portNamePattern);
            XMLStreamReaderUtil.nextElementContent(reader);
        } else if (reader.getName().equals(QNAME_CHAIN_PROTOCOL_BINDING)) {
            String bindingList = XMLStreamReaderUtil.getElementText(reader);
            StringTokenizer stk = new StringTokenizer(bindingList);
            while(stk.hasMoreTokens()) {
                String token = stk.nextToken();
                // This will convert tokens into Binding URI
                hChain.addProtocolBinding(token);
            }
            XMLStreamReaderUtil.nextElementContent(reader);
        } else if (reader.getName().equals(QNAME_CHAIN_SERVICE_PATTERN)) {
            QName serviceNamepattern = XMLStreamReaderUtil.getElementQName(reader);
            hChain.setServiceNamePattern(serviceNamepattern);
            XMLStreamReaderUtil.nextElementContent(reader);
        }
        List<HandlerType> handlers = hChain.getHandlers();
        // process all <handler> elements
        while (reader.getName().equals(QNAME_HANDLER)) {
            HandlerType handler = new HandlerType();

            XMLStreamReaderUtil.nextContent(reader);
            if (reader.getName().equals(QNAME_HANDLER_NAME)) {
                String handlerName =
                        XMLStreamReaderUtil.getElementText(reader).trim();
                handler.setHandlerName(handlerName);
                XMLStreamReaderUtil.nextContent(reader);
            }

            // handler class
            ensureProperName(reader, QNAME_HANDLER_CLASS);
            String handlerClass =
                    XMLStreamReaderUtil.getElementText(reader).trim();
            handler.setHandlerClass(handlerClass);
            XMLStreamReaderUtil.nextContent(reader);

            // init params (ignored)
            while (reader.getName().equals(QNAME_HANDLER_PARAM)) {
                skipInitParamElement(reader);
            }

            // headers (ignored)
            while (reader.getName().equals(QNAME_HANDLER_HEADER)) {
                skipTextElement(reader);
            }

            // roles (not stored per handler)
            while (reader.getName().equals(QNAME_HANDLER_ROLE)) {
                List<String> soapRoles = handler.getSoapRoles();
                soapRoles.add(XMLStreamReaderUtil.getElementText(reader));
                XMLStreamReaderUtil.nextContent(reader);
            }

            handlers.add(handler);

            // move past </handler>
            ensureProperName(reader, QNAME_HANDLER);
            XMLStreamReaderUtil.nextContent(reader);
        }

        // move past </handler-chain>
        ensureProperName(reader, QNAME_HANDLER_CHAIN);
        hChains.add(hChain);
        XMLStreamReaderUtil.nextContent(reader);
    }

    return handlerModel;
}
 
Example 6
Source File: HandlerChainsModel.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * reader should be on <handler-chains> element
 */
public static HandlerChainsModel parseHandlerConfigFile(Class annotatedClass, XMLStreamReader reader) {
    ensureProperName(reader,QNAME_HANDLER_CHAINS);
    HandlerChainsModel handlerModel = new HandlerChainsModel(annotatedClass);
    List<HandlerChainType> hChains = handlerModel.getHandlerChain();
    XMLStreamReaderUtil.nextElementContent(reader);

    while (reader.getName().equals(QNAME_HANDLER_CHAIN)) {
        HandlerChainType hChain = new HandlerChainType();
        XMLStreamReaderUtil.nextElementContent(reader);

        if (reader.getName().equals(QNAME_CHAIN_PORT_PATTERN)) {
            QName portNamePattern = XMLStreamReaderUtil.getElementQName(reader);
            hChain.setPortNamePattern(portNamePattern);
            XMLStreamReaderUtil.nextElementContent(reader);
        } else if (reader.getName().equals(QNAME_CHAIN_PROTOCOL_BINDING)) {
            String bindingList = XMLStreamReaderUtil.getElementText(reader);
            StringTokenizer stk = new StringTokenizer(bindingList);
            while(stk.hasMoreTokens()) {
                String token = stk.nextToken();
                // This will convert tokens into Binding URI
                hChain.addProtocolBinding(token);
            }
            XMLStreamReaderUtil.nextElementContent(reader);
        } else if (reader.getName().equals(QNAME_CHAIN_SERVICE_PATTERN)) {
            QName serviceNamepattern = XMLStreamReaderUtil.getElementQName(reader);
            hChain.setServiceNamePattern(serviceNamepattern);
            XMLStreamReaderUtil.nextElementContent(reader);
        }
        List<HandlerType> handlers = hChain.getHandlers();
        // process all <handler> elements
        while (reader.getName().equals(QNAME_HANDLER)) {
            HandlerType handler = new HandlerType();

            XMLStreamReaderUtil.nextContent(reader);
            if (reader.getName().equals(QNAME_HANDLER_NAME)) {
                String handlerName =
                        XMLStreamReaderUtil.getElementText(reader).trim();
                handler.setHandlerName(handlerName);
                XMLStreamReaderUtil.nextContent(reader);
            }

            // handler class
            ensureProperName(reader, QNAME_HANDLER_CLASS);
            String handlerClass =
                    XMLStreamReaderUtil.getElementText(reader).trim();
            handler.setHandlerClass(handlerClass);
            XMLStreamReaderUtil.nextContent(reader);

            // init params (ignored)
            while (reader.getName().equals(QNAME_HANDLER_PARAM)) {
                skipInitParamElement(reader);
            }

            // headers (ignored)
            while (reader.getName().equals(QNAME_HANDLER_HEADER)) {
                skipTextElement(reader);
            }

            // roles (not stored per handler)
            while (reader.getName().equals(QNAME_HANDLER_ROLE)) {
                List<String> soapRoles = handler.getSoapRoles();
                soapRoles.add(XMLStreamReaderUtil.getElementText(reader));
                XMLStreamReaderUtil.nextContent(reader);
            }

            handlers.add(handler);

            // move past </handler>
            ensureProperName(reader, QNAME_HANDLER);
            XMLStreamReaderUtil.nextContent(reader);
        }

        // move past </handler-chain>
        ensureProperName(reader, QNAME_HANDLER_CHAIN);
        hChains.add(hChain);
        XMLStreamReaderUtil.nextContent(reader);
    }

    return handlerModel;
}
 
Example 7
Source File: HandlerChainsModel.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * reader should be on <handler-chains> element
 */
public static HandlerChainsModel parseHandlerConfigFile(Class annotatedClass, XMLStreamReader reader) {
    ensureProperName(reader,QNAME_HANDLER_CHAINS);
    HandlerChainsModel handlerModel = new HandlerChainsModel(annotatedClass);
    List<HandlerChainType> hChains = handlerModel.getHandlerChain();
    XMLStreamReaderUtil.nextElementContent(reader);

    while (reader.getName().equals(QNAME_HANDLER_CHAIN)) {
        HandlerChainType hChain = new HandlerChainType();
        XMLStreamReaderUtil.nextElementContent(reader);

        if (reader.getName().equals(QNAME_CHAIN_PORT_PATTERN)) {
            QName portNamePattern = XMLStreamReaderUtil.getElementQName(reader);
            hChain.setPortNamePattern(portNamePattern);
            XMLStreamReaderUtil.nextElementContent(reader);
        } else if (reader.getName().equals(QNAME_CHAIN_PROTOCOL_BINDING)) {
            String bindingList = XMLStreamReaderUtil.getElementText(reader);
            StringTokenizer stk = new StringTokenizer(bindingList);
            while(stk.hasMoreTokens()) {
                String token = stk.nextToken();
                // This will convert tokens into Binding URI
                hChain.addProtocolBinding(token);
            }
            XMLStreamReaderUtil.nextElementContent(reader);
        } else if (reader.getName().equals(QNAME_CHAIN_SERVICE_PATTERN)) {
            QName serviceNamepattern = XMLStreamReaderUtil.getElementQName(reader);
            hChain.setServiceNamePattern(serviceNamepattern);
            XMLStreamReaderUtil.nextElementContent(reader);
        }
        List<HandlerType> handlers = hChain.getHandlers();
        // process all <handler> elements
        while (reader.getName().equals(QNAME_HANDLER)) {
            HandlerType handler = new HandlerType();

            XMLStreamReaderUtil.nextContent(reader);
            if (reader.getName().equals(QNAME_HANDLER_NAME)) {
                String handlerName =
                        XMLStreamReaderUtil.getElementText(reader).trim();
                handler.setHandlerName(handlerName);
                XMLStreamReaderUtil.nextContent(reader);
            }

            // handler class
            ensureProperName(reader, QNAME_HANDLER_CLASS);
            String handlerClass =
                    XMLStreamReaderUtil.getElementText(reader).trim();
            handler.setHandlerClass(handlerClass);
            XMLStreamReaderUtil.nextContent(reader);

            // init params (ignored)
            while (reader.getName().equals(QNAME_HANDLER_PARAM)) {
                skipInitParamElement(reader);
            }

            // headers (ignored)
            while (reader.getName().equals(QNAME_HANDLER_HEADER)) {
                skipTextElement(reader);
            }

            // roles (not stored per handler)
            while (reader.getName().equals(QNAME_HANDLER_ROLE)) {
                List<String> soapRoles = handler.getSoapRoles();
                soapRoles.add(XMLStreamReaderUtil.getElementText(reader));
                XMLStreamReaderUtil.nextContent(reader);
            }

            handlers.add(handler);

            // move past </handler>
            ensureProperName(reader, QNAME_HANDLER);
            XMLStreamReaderUtil.nextContent(reader);
        }

        // move past </handler-chain>
        ensureProperName(reader, QNAME_HANDLER_CHAIN);
        hChains.add(hChain);
        XMLStreamReaderUtil.nextContent(reader);
    }

    return handlerModel;
}
 
Example 8
Source File: HandlerChainsModel.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * reader should be on <handler-chains> element
 */
public static HandlerChainsModel parseHandlerConfigFile(Class annotatedClass, XMLStreamReader reader) {
    ensureProperName(reader,QNAME_HANDLER_CHAINS);
    HandlerChainsModel handlerModel = new HandlerChainsModel(annotatedClass);
    List<HandlerChainType> hChains = handlerModel.getHandlerChain();
    XMLStreamReaderUtil.nextElementContent(reader);

    while (reader.getName().equals(QNAME_HANDLER_CHAIN)) {
        HandlerChainType hChain = new HandlerChainType();
        XMLStreamReaderUtil.nextElementContent(reader);

        if (reader.getName().equals(QNAME_CHAIN_PORT_PATTERN)) {
            QName portNamePattern = XMLStreamReaderUtil.getElementQName(reader);
            hChain.setPortNamePattern(portNamePattern);
            XMLStreamReaderUtil.nextElementContent(reader);
        } else if (reader.getName().equals(QNAME_CHAIN_PROTOCOL_BINDING)) {
            String bindingList = XMLStreamReaderUtil.getElementText(reader);
            StringTokenizer stk = new StringTokenizer(bindingList);
            while(stk.hasMoreTokens()) {
                String token = stk.nextToken();
                // This will convert tokens into Binding URI
                hChain.addProtocolBinding(token);
            }
            XMLStreamReaderUtil.nextElementContent(reader);
        } else if (reader.getName().equals(QNAME_CHAIN_SERVICE_PATTERN)) {
            QName serviceNamepattern = XMLStreamReaderUtil.getElementQName(reader);
            hChain.setServiceNamePattern(serviceNamepattern);
            XMLStreamReaderUtil.nextElementContent(reader);
        }
        List<HandlerType> handlers = hChain.getHandlers();
        // process all <handler> elements
        while (reader.getName().equals(QNAME_HANDLER)) {
            HandlerType handler = new HandlerType();

            XMLStreamReaderUtil.nextContent(reader);
            if (reader.getName().equals(QNAME_HANDLER_NAME)) {
                String handlerName =
                        XMLStreamReaderUtil.getElementText(reader).trim();
                handler.setHandlerName(handlerName);
                XMLStreamReaderUtil.nextContent(reader);
            }

            // handler class
            ensureProperName(reader, QNAME_HANDLER_CLASS);
            String handlerClass =
                    XMLStreamReaderUtil.getElementText(reader).trim();
            handler.setHandlerClass(handlerClass);
            XMLStreamReaderUtil.nextContent(reader);

            // init params (ignored)
            while (reader.getName().equals(QNAME_HANDLER_PARAM)) {
                skipInitParamElement(reader);
            }

            // headers (ignored)
            while (reader.getName().equals(QNAME_HANDLER_HEADER)) {
                skipTextElement(reader);
            }

            // roles (not stored per handler)
            while (reader.getName().equals(QNAME_HANDLER_ROLE)) {
                List<String> soapRoles = handler.getSoapRoles();
                soapRoles.add(XMLStreamReaderUtil.getElementText(reader));
                XMLStreamReaderUtil.nextContent(reader);
            }

            handlers.add(handler);

            // move past </handler>
            ensureProperName(reader, QNAME_HANDLER);
            XMLStreamReaderUtil.nextContent(reader);
        }

        // move past </handler-chain>
        ensureProperName(reader, QNAME_HANDLER_CHAIN);
        hChains.add(hChain);
        XMLStreamReaderUtil.nextContent(reader);
    }

    return handlerModel;
}