• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java XMLStreamReaderUtil类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil的典型用法代码示例。如果您正苦于以下问题:Java XMLStreamReaderUtil类的具体用法?Java XMLStreamReaderUtil怎么用?Java XMLStreamReaderUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



XMLStreamReaderUtil类属于com.sun.xml.internal.ws.streaming包,在下文中一共展示了XMLStreamReaderUtil类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: readPayload

import com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil; //导入依赖的package包/类
@Override
public XMLStreamReader readPayload() throws XMLStreamException {
   try {
        if(infoset==null) {
                            if (rawContext != null) {
                    XMLStreamBufferResult sbr = new XMLStreamBufferResult();
                                    Marshaller m = rawContext.createMarshaller();
                                    m.setProperty("jaxb.fragment", Boolean.TRUE);
                                    m.marshal(jaxbObject, sbr);
                    infoset = sbr.getXMLStreamBuffer();
                            } else {
                                MutableXMLStreamBuffer buffer = new MutableXMLStreamBuffer();
                                writePayloadTo(buffer.createFromXMLStreamWriter());
                                infoset = buffer;
                            }
        }
        XMLStreamReader reader = infoset.readAsXMLStreamReader();
        if(reader.getEventType()== START_DOCUMENT)
            XMLStreamReaderUtil.nextElementContent(reader);
        return reader;
    } catch (JAXBException e) {
       // bug 6449684, spec 4.3.4
       throw new WebServiceException(e);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:JAXBMessage.java


示例2: readResponse

import com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil; //导入依赖的package包/类
final Object readResponse(Object[] args, XMLStreamReader r, AttachmentSet att) throws JAXBException {
    Object obj;
    AttachmentUnmarshallerImpl au = (att != null)?new AttachmentUnmarshallerImpl(att):null;
    if (bridge instanceof RepeatedElementBridge) {
        RepeatedElementBridge rbridge = (RepeatedElementBridge)bridge;
        ArrayList list = new ArrayList();
        QName name = r.getName();
        while (r.getEventType()==XMLStreamReader.START_ELEMENT && name.equals(r.getName())) {
            list.add(rbridge.unmarshal(r, au));
            XMLStreamReaderUtil.toNextTag(r, name);
        }
        obj = rbridge.collectionHandler().convert(list);
    } else {
        obj = bridge.unmarshal(r, au);
    }
    return setter.put(obj,args);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:ResponseBuilder.java


示例3: setHandlersAndRoles

import com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:DeploymentDescriptorParser.java


示例4: readRequest

import com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil; //导入依赖的package包/类
void readRequest( Object[] args, XMLStreamReader r, AttachmentSet att) throws JAXBException {
    Object obj = null;
    AttachmentUnmarshallerImpl au = (att != null)?new AttachmentUnmarshallerImpl(att):null;
    if (bridge instanceof RepeatedElementBridge) {
        RepeatedElementBridge rbridge = (RepeatedElementBridge)bridge;
        ArrayList list = new ArrayList();
        QName name = r.getName();
        while (r.getEventType()==XMLStreamReader.START_ELEMENT && name.equals(r.getName())) {
            list.add(rbridge.unmarshal(r, au));
            XMLStreamReaderUtil.toNextTag(r, name);
        }
        obj = rbridge.collectionHandler().convert(list);
    } else {
        obj = bridge.unmarshal(r, au);
    }
    setter.put(obj,args);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:EndpointArgumentsBuilder.java


示例5: readWrappedRequest

import com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil; //导入依赖的package包/类
protected void readWrappedRequest(Message msg, Object[] args) throws JAXBException, XMLStreamException {
    if (!msg.hasPayload()) {
        throw new WebServiceException("No payload. Expecting payload with "+wrapperName+" element");
    }
    XMLStreamReader reader = msg.readPayload();
    XMLStreamReaderUtil.verifyTag(reader,wrapperName);
    reader.nextTag();
    while(reader.getEventType()==XMLStreamReader.START_ELEMENT) {
        // TODO: QName has a performance issue
        QName name = reader.getName();
        WrappedPartBuilder part = wrappedParts.get(name);
        if(part==null) {
            // no corresponding part found. ignore
            XMLStreamReaderUtil.skipElement(reader);
            reader.nextTag();
        } else {
            part.readRequest(args,reader, msg.getAttachments());
        }
        XMLStreamReaderUtil.toNextTag(reader, name);
    }

    // we are done with the body
    reader.close();
    XMLStreamReaderFactory.recycle(reader);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:EndpointArgumentsBuilder.java


示例6: parseService

import com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil; //导入依赖的package包/类
private void parseService(XMLStreamReader reader) {
    service_nsdecl.putAll(wsdldef_nsdecl);
    readNSDecl(service_nsdecl,reader);

    String serviceName = ParserUtil.getMandatoryNonEmptyAttribute(reader, WSDLConstants.ATTR_NAME);
    EditableWSDLService service = new WSDLServiceImpl(reader,wsdlDoc,new QName(targetNamespace, serviceName));
    extensionFacade.serviceAttributes(service, reader);
    while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) {
        QName name = reader.getName();
        if (WSDLConstants.QNAME_PORT.equals(name)) {
            parsePort(reader, service);
            if (reader.getEventType() != XMLStreamConstants.END_ELEMENT) {
                XMLStreamReaderUtil.next(reader);
            }
        } else {
            extensionFacade.serviceElements(service, reader);
        }
    }
    wsdlDoc.addService(service);
    service_nsdecl =  new HashMap<String, String>();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:RuntimeWSDLParser.java


示例7: parseInputBinding

import com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil; //导入依赖的package包/类
private void parseInputBinding(XMLStreamReader reader, EditableWSDLBoundOperation bindingOp) {
    boolean bodyFound = false;
    extensionFacade.bindingOperationInputAttributes(bindingOp, reader);
    while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) {
        QName name = reader.getName();
        if ((SOAPConstants.QNAME_BODY.equals(name) || SOAPConstants.QNAME_SOAP12BODY.equals(name)) && !bodyFound) {
            bodyFound = true;
            bindingOp.setInputExplicitBodyParts(parseSOAPBodyBinding(reader, bindingOp, BindingMode.INPUT));
            goToEnd(reader);
        } else if ((SOAPConstants.QNAME_HEADER.equals(name) || SOAPConstants.QNAME_SOAP12HEADER.equals(name))) {
            parseSOAPHeaderBinding(reader, bindingOp.getInputParts());
        } else if (MIMEConstants.QNAME_MULTIPART_RELATED.equals(name)) {
            parseMimeMultipartBinding(reader, bindingOp, BindingMode.INPUT);
        } else {
            extensionFacade.bindingOperationInputElements(bindingOp, reader);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:RuntimeWSDLParser.java


示例8: parseOutputBinding

import com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil; //导入依赖的package包/类
private void parseOutputBinding(XMLStreamReader reader, EditableWSDLBoundOperation bindingOp) {
    boolean bodyFound = false;
    extensionFacade.bindingOperationOutputAttributes(bindingOp, reader);
    while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) {
        QName name = reader.getName();
        if ((SOAPConstants.QNAME_BODY.equals(name) || SOAPConstants.QNAME_SOAP12BODY.equals(name)) && !bodyFound) {
            bodyFound = true;
            bindingOp.setOutputExplicitBodyParts(parseSOAPBodyBinding(reader, bindingOp, BindingMode.OUTPUT));
            goToEnd(reader);
        } else if ((SOAPConstants.QNAME_HEADER.equals(name) || SOAPConstants.QNAME_SOAP12HEADER.equals(name))) {
            parseSOAPHeaderBinding(reader, bindingOp.getOutputParts());
        } else if (MIMEConstants.QNAME_MULTIPART_RELATED.equals(name)) {
            parseMimeMultipartBinding(reader, bindingOp, BindingMode.OUTPUT);
        } else {
            extensionFacade.bindingOperationOutputElements(bindingOp, reader);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:RuntimeWSDLParser.java


示例9: parsePortType

import com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil; //导入依赖的package包/类
private void parsePortType(XMLStreamReader reader) {
    String portTypeName = ParserUtil.getMandatoryNonEmptyAttribute(reader, WSDLConstants.ATTR_NAME);
    if (portTypeName == null) {
        //TODO: throw exception?
        //skip wsdl:portType element for now
        XMLStreamReaderUtil.skipElement(reader);
        return;
    }
    EditableWSDLPortType portType = new WSDLPortTypeImpl(reader,wsdlDoc, new QName(targetNamespace, portTypeName));
    extensionFacade.portTypeAttributes(portType, reader);
    wsdlDoc.addPortType(portType);
    while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) {
        QName name = reader.getName();
        if (WSDLConstants.QNAME_OPERATION.equals(name)) {
            parsePortTypeOperation(reader, portType);
        } else {
            extensionFacade.portTypeElements(portType, reader);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:RuntimeWSDLParser.java


示例10: parseBindings

import com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil; //导入依赖的package包/类
/**
 * Exposing it as a public method to allow external tools such as NB to read from wsdl model and work on it.
 * TODO: WSDL model needs to be exposed - basically at tool time we need to use the runtimw wsdl model
 *
 * Binding files could be jaxws or jaxb. This method identifies jaxws and jaxb binding files and keeps them separately. jaxb binding files are given separately
 * to JAXB in {@link com.sun.tools.internal.ws.processor.modeler.wsdl.JAXBModelBuilder}
 *
 * @param receiver {@link ErrorReceiver}
 */
public final void parseBindings(ErrorReceiver receiver){
    for (InputSource is : bindingFiles) {
        XMLStreamReader reader =
                XMLStreamReaderFactory.create(is,true);
        XMLStreamReaderUtil.nextElementContent(reader);
        if (reader.getName().equals(JAXWSBindingsConstants.JAXWS_BINDINGS)) {
            jaxwsCustomBindings.add(new RereadInputSource(is));
        } else if (reader.getName().equals(JAXWSBindingsConstants.JAXB_BINDINGS) ||
                reader.getName().equals(new QName(SchemaConstants.NS_XSD, "schema"))) {
            jaxbCustomBindings.add(new RereadInputSource(is));
        } else {
            LocatorImpl locator = new LocatorImpl();
            locator.setSystemId(reader.getLocation().getSystemId());
            locator.setPublicId(reader.getLocation().getPublicId());
            locator.setLineNumber(reader.getLocation().getLineNumber());
            locator.setColumnNumber(reader.getLocation().getColumnNumber());
            receiver.warning(locator, ConfigurationMessages.CONFIGURATION_NOT_BINDING_FILE(is.getSystemId()));
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:WsimportOptions.java



注:本文中的com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ParseException类代码示例发布时间:2022-05-23
下一篇:
Java XSAttributeDecl类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap