jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/message/jaxb/JAXBHeader.java
changeset 19645 36f707905f2b
parent 16791 fe5141eabb0e
equal deleted inserted replaced
19257:30a1d677a20c 19645:36f707905f2b
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    26 package com.sun.xml.internal.ws.message.jaxb;
    26 package com.sun.xml.internal.ws.message.jaxb;
    27 
    27 
    28 import com.sun.istack.internal.NotNull;
    28 import com.sun.istack.internal.NotNull;
    29 import com.sun.istack.internal.XMLStreamException2;
    29 import com.sun.istack.internal.XMLStreamException2;
    30 import com.sun.xml.internal.bind.api.Bridge;
    30 import com.sun.xml.internal.bind.api.Bridge;
       
    31 import com.sun.xml.internal.stream.buffer.MutableXMLStreamBuffer;
    31 import com.sun.xml.internal.stream.buffer.XMLStreamBuffer;
    32 import com.sun.xml.internal.stream.buffer.XMLStreamBuffer;
    32 import com.sun.xml.internal.stream.buffer.XMLStreamBufferResult;
    33 import com.sun.xml.internal.stream.buffer.XMLStreamBufferResult;
    33 import com.sun.xml.internal.ws.api.message.Header;
    34 import com.sun.xml.internal.ws.api.message.Header;
    34 import com.sun.xml.internal.ws.encoding.SOAPBindingCodec;
    35 import com.sun.xml.internal.ws.encoding.SOAPBindingCodec;
    35 import com.sun.xml.internal.ws.message.AbstractHeaderImpl;
    36 import com.sun.xml.internal.ws.message.AbstractHeaderImpl;
   140             parse();
   141             parse();
   141         return atts.getValue(nsUri,localName);
   142         return atts.getValue(nsUri,localName);
   142     }
   143     }
   143 
   144 
   144     public XMLStreamReader readHeader() throws XMLStreamException {
   145     public XMLStreamReader readHeader() throws XMLStreamException {
   145         try {
   146         if(infoset==null) {
   146             if(infoset==null) {
   147             MutableXMLStreamBuffer buffer = new MutableXMLStreamBuffer();
   147                 XMLStreamBufferResult sbr = new XMLStreamBufferResult();
   148             writeTo(buffer.createFromXMLStreamWriter());
   148                 bridge.marshal(jaxbObject,sbr);
   149             infoset = buffer;
   149                 infoset = sbr.getXMLStreamBuffer();
   150         }
   150             }
   151         return infoset.readAsXMLStreamReader();
   151             return infoset.readAsXMLStreamReader();
       
   152         } catch (JAXBException e) {
       
   153             throw new XMLStreamException2(e);
       
   154         }
       
   155     }
   152     }
   156 
   153 
   157     public <T> T readAsJAXB(Unmarshaller unmarshaller) throws JAXBException {
   154     public <T> T readAsJAXB(Unmarshaller unmarshaller) throws JAXBException {
   158         try {
   155         try {
   159             JAXBResult r = new JAXBResult(unmarshaller);
   156             JAXBResult r = new JAXBResult(unmarshaller);