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

The following examples show how to use com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil#nextContent() . 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: DeploymentDescriptorParser.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Parses the handler and role information and sets it
 * on the {@link WSBinding}.
 *
 * @return true if <handler-chains> element present in DD
 *         false otherwise.
 */
protected boolean setHandlersAndRoles(WSBinding binding, XMLStreamReader reader, QName serviceName, QName portName) {

    if (reader.getEventType() == XMLStreamConstants.END_ELEMENT ||
            !reader.getName().equals(HandlerChainsModel.QNAME_HANDLER_CHAINS)) {
        return false;
    }

    HandlerAnnotationInfo handlerInfo = HandlerChainsModel.parseHandlerFile(
            reader, classLoader, serviceName, portName, binding);

    binding.setHandlerChain(handlerInfo.getHandlers());
    if (binding instanceof SOAPBinding) {
        ((SOAPBinding) binding).setRoles(handlerInfo.getRoles());
    }

    // move past </handler-chains>
    XMLStreamReaderUtil.nextContent(reader);
    return true;
}
 
Example 2
Source File: DeploymentDescriptorParser.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Parses the handler and role information and sets it
 * on the {@link WSBinding}.
 *
 * @return true if <handler-chains> element present in DD
 *         false otherwise.
 */
protected boolean setHandlersAndRoles(WSBinding binding, XMLStreamReader reader, QName serviceName, QName portName) {

    if (reader.getEventType() == XMLStreamConstants.END_ELEMENT ||
            !reader.getName().equals(HandlerChainsModel.QNAME_HANDLER_CHAINS)) {
        return false;
    }

    HandlerAnnotationInfo handlerInfo = HandlerChainsModel.parseHandlerFile(
            reader, classLoader, serviceName, portName, binding);

    binding.setHandlerChain(handlerInfo.getHandlers());
    if (binding instanceof SOAPBinding) {
        ((SOAPBinding) binding).setRoles(handlerInfo.getRoles());
    }

    // move past </handler-chains>
    XMLStreamReaderUtil.nextContent(reader);
    return true;
}
 
Example 3
Source File: DeploymentDescriptorParser.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Parses the handler and role information and sets it
 * on the {@link WSBinding}.
 *
 * @return true if <handler-chains> element present in DD
 *         false otherwise.
 */
protected boolean setHandlersAndRoles(WSBinding binding, XMLStreamReader reader, QName serviceName, QName portName) {

    if (reader.getEventType() == XMLStreamConstants.END_ELEMENT ||
            !reader.getName().equals(HandlerChainsModel.QNAME_HANDLER_CHAINS)) {
        return false;
    }

    HandlerAnnotationInfo handlerInfo = HandlerChainsModel.parseHandlerFile(
            reader, classLoader, serviceName, portName, binding);

    binding.setHandlerChain(handlerInfo.getHandlers());
    if (binding instanceof SOAPBinding) {
        ((SOAPBinding) binding).setRoles(handlerInfo.getRoles());
    }

    // move past </handler-chains>
    XMLStreamReaderUtil.nextContent(reader);
    return true;
}
 
Example 4
Source File: HandlerChainsModel.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static void skipInitParamElement(XMLStreamReader reader) {
    int state;
    do {
        state = XMLStreamReaderUtil.nextContent(reader);
    } while (state != XMLStreamReader.END_ELEMENT ||
            !reader.getName().equals(QNAME_HANDLER_PARAM));
    XMLStreamReaderUtil.nextElementContent(reader);
}
 
Example 5
Source File: HandlerChainsModel.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static void skipInitParamElement(XMLStreamReader reader) {
    int state;
    do {
        state = XMLStreamReaderUtil.nextContent(reader);
    } while (state != XMLStreamReader.END_ELEMENT ||
            !reader.getName().equals(QNAME_HANDLER_PARAM));
    XMLStreamReaderUtil.nextElementContent(reader);
}
 
Example 6
Source File: HandlerChainsModel.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static void skipInitParamElement(XMLStreamReader reader) {
    int state;
    do {
        state = XMLStreamReaderUtil.nextContent(reader);
    } while (state != XMLStreamReader.END_ELEMENT ||
            !reader.getName().equals(QNAME_HANDLER_PARAM));
    XMLStreamReaderUtil.nextElementContent(reader);
}
 
Example 7
Source File: HandlerChainsModel.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static void skipInitParamElement(XMLStreamReader reader) {
    int state;
    do {
        state = XMLStreamReaderUtil.nextContent(reader);
    } while (state != XMLStreamReader.END_ELEMENT ||
            !reader.getName().equals(QNAME_HANDLER_PARAM));
    XMLStreamReaderUtil.nextElementContent(reader);
}
 
Example 8
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 9
Source File: HandlerChainsModel.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private static void skipTextElement(XMLStreamReader reader) {
    XMLStreamReaderUtil.nextContent(reader);
    XMLStreamReaderUtil.nextElementContent(reader);
    XMLStreamReaderUtil.nextElementContent(reader);
}
 
Example 10
Source File: HandlerChainsModel.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private static void skipChain(XMLStreamReader reader) {
    while (XMLStreamReaderUtil.nextContent(reader) !=
            XMLStreamConstants.END_ELEMENT ||
            !reader.getName().equals(QNAME_HANDLER_CHAIN)) {}
    XMLStreamReaderUtil.nextElementContent(reader);
}
 
Example 11
Source File: HandlerChainsModel.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
private static void skipTextElement(XMLStreamReader reader) {
    XMLStreamReaderUtil.nextContent(reader);
    XMLStreamReaderUtil.nextElementContent(reader);
    XMLStreamReaderUtil.nextElementContent(reader);
}
 
Example 12
Source File: HandlerChainsModel.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private static void skipTextElement(XMLStreamReader reader) {
    XMLStreamReaderUtil.nextContent(reader);
    XMLStreamReaderUtil.nextElementContent(reader);
    XMLStreamReaderUtil.nextElementContent(reader);
}
 
Example 13
Source File: HandlerChainsModel.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private static void skipChain(XMLStreamReader reader) {
    while (XMLStreamReaderUtil.nextContent(reader) !=
            XMLStreamConstants.END_ELEMENT ||
            !reader.getName().equals(QNAME_HANDLER_CHAIN)) {}
    XMLStreamReaderUtil.nextElementContent(reader);
}
 
Example 14
Source File: HandlerChainsModel.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private static void skipTextElement(XMLStreamReader reader) {
    XMLStreamReaderUtil.nextContent(reader);
    XMLStreamReaderUtil.nextElementContent(reader);
    XMLStreamReaderUtil.nextElementContent(reader);
}
 
Example 15
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 16
Source File: HandlerChainsModel.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
private static void skipTextElement(XMLStreamReader reader) {
    XMLStreamReaderUtil.nextContent(reader);
    XMLStreamReaderUtil.nextElementContent(reader);
    XMLStreamReaderUtil.nextElementContent(reader);
}
 
Example 17
Source File: HandlerChainsModel.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private static void skipTextElement(XMLStreamReader reader) {
    XMLStreamReaderUtil.nextContent(reader);
    XMLStreamReaderUtil.nextElementContent(reader);
    XMLStreamReaderUtil.nextElementContent(reader);
}
 
Example 18
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 19
Source File: HandlerChainsModel.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
private static void skipChain(XMLStreamReader reader) {
    while (XMLStreamReaderUtil.nextContent(reader) !=
            XMLStreamConstants.END_ELEMENT ||
            !reader.getName().equals(QNAME_HANDLER_CHAIN)) {}
    XMLStreamReaderUtil.nextElementContent(reader);
}
 
Example 20
Source File: HandlerChainsModel.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private static void skipChain(XMLStreamReader reader) {
    while (XMLStreamReaderUtil.nextContent(reader) !=
            XMLStreamConstants.END_ELEMENT ||
            !reader.getName().equals(QNAME_HANDLER_CHAIN)) {}
    XMLStreamReaderUtil.nextElementContent(reader);
}