< prev index next >

src/java.xml.ws/share/classes/javax/xml/ws/wsaddressing/W3CEndpointReference.java

Print this page


   1 /*
   2  * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  73 
  74     // should be changed to package private, keeping original modifier to keep backwards compatibility
  75     protected static final String NS = "http://www.w3.org/2005/08/addressing";
  76 
  77     // default constructor forbidden ...
  78     // should be private, keeping original modifier to keep backwards compatibility
  79     protected W3CEndpointReference() {
  80     }
  81 
  82     /**
  83      * Creates an EPR from infoset representation
  84      *
  85      * @param source A source object containing valid XmlInfoset
  86      * instance consistent with the W3C WS-Addressing Core
  87      * recommendation.
  88      *
  89      * @throws WebServiceException
  90      *   If the source does NOT contain a valid W3C WS-Addressing
  91      *   EndpointReference.
  92      * @throws NullPointerException
  93      *   If the <code>null</code> <code>source</code> value is given
  94      */
  95     public W3CEndpointReference(Source source) {
  96         try {
  97             W3CEndpointReference epr = w3cjc.createUnmarshaller().unmarshal(source,W3CEndpointReference.class).getValue();
  98             this.address = epr.address;
  99             this.metadata = epr.metadata;
 100             this.referenceParameters = epr.referenceParameters;
 101             this.elements = epr.elements;
 102             this.attributes = epr.attributes;
 103         } catch (JAXBException e) {
 104             throw new WebServiceException("Error unmarshalling W3CEndpointReference " ,e);
 105         } catch (ClassCastException e) {
 106             throw new WebServiceException("Source did not contain W3CEndpointReference", e);
 107         }
 108     }
 109 
 110     /**
 111      * {@inheritDoc}
 112      */
 113     public void writeTo(Result result){


   1 /*
   2  * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  73 
  74     // should be changed to package private, keeping original modifier to keep backwards compatibility
  75     protected static final String NS = "http://www.w3.org/2005/08/addressing";
  76 
  77     // default constructor forbidden ...
  78     // should be private, keeping original modifier to keep backwards compatibility
  79     protected W3CEndpointReference() {
  80     }
  81 
  82     /**
  83      * Creates an EPR from infoset representation
  84      *
  85      * @param source A source object containing valid XmlInfoset
  86      * instance consistent with the W3C WS-Addressing Core
  87      * recommendation.
  88      *
  89      * @throws WebServiceException
  90      *   If the source does NOT contain a valid W3C WS-Addressing
  91      *   EndpointReference.
  92      * @throws NullPointerException
  93      *   If the {@code null} {@code source} value is given
  94      */
  95     public W3CEndpointReference(Source source) {
  96         try {
  97             W3CEndpointReference epr = w3cjc.createUnmarshaller().unmarshal(source,W3CEndpointReference.class).getValue();
  98             this.address = epr.address;
  99             this.metadata = epr.metadata;
 100             this.referenceParameters = epr.referenceParameters;
 101             this.elements = epr.elements;
 102             this.attributes = epr.attributes;
 103         } catch (JAXBException e) {
 104             throw new WebServiceException("Error unmarshalling W3CEndpointReference " ,e);
 105         } catch (ClassCastException e) {
 106             throw new WebServiceException("Source did not contain W3CEndpointReference", e);
 107         }
 108     }
 109 
 110     /**
 111      * {@inheritDoc}
 112      */
 113     public void writeTo(Result result){


< prev index next >