1 /* 2 * Copyright (c) 1997, 2010, 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 23 * questions. 24 */ 25 26 package com.sun.xml.internal.ws.api.addressing; 27 28 import java.net.URL; 29 30 import com.sun.istack.internal.NotNull; 31 import com.sun.istack.internal.Nullable; 32 import com.sun.xml.internal.ws.api.FeatureConstructor; 33 import com.sun.xml.internal.ws.api.message.HeaderList; 34 35 import javax.xml.ws.WebServiceFeature; 36 37 import com.sun.org.glassfish.gmbal.ManagedAttribute; 38 import com.sun.org.glassfish.gmbal.ManagedData; 39 40 /** 41 * Unsupported RI extension to work around an issue in WSIT. 42 * 43 * <p> 44 * <b>This feature is not meant to be used by a common Web service developer</b> as there 45 * is no need to send the above mentioned header for a one-way operation. But these 46 * properties may need to be sent in certain middleware Web services. 47 * 48 * <p> 49 * This feature allows ReplyTo, From and RelatesTo Message Addressing Properties 50 * to be added for all messages that are sent from the port configured with 51 * this annotation. All operations are assumed to be one-way, and 52 * this feature should be used for one-way 53 * operations only. 54 * 55 * If a non-null ReplyTo is specified, then MessageID property is also added. 56 * 57 * @author Arun Gupta 58 */ 59 @ManagedData 60 public class OneWayFeature extends WebServiceFeature { 61 /** 62 * Constant value identifying the {@link OneWayFeature} 63 */ 64 public static final String ID = "http://java.sun.com/xml/ns/jaxws/addressing/oneway"; 65 66 private WSEndpointReference replyTo; 67 private WSEndpointReference sslReplyTo; 68 private WSEndpointReference from; 69 private WSEndpointReference faultTo; 70 private WSEndpointReference sslFaultTo; 71 private String relatesToID; 72 private boolean useAsyncWithSyncInvoke = false; 73 74 /** 75 * Create an {@link OneWayFeature}. The instance created will be enabled. 76 */ 77 public OneWayFeature() { 78 this.enabled = true; 79 } 80 81 /** 82 * Create an {@link OneWayFeature} 83 * 84 * @param enabled specifies whether this feature should 85 * be enabled or not. 96 */ 97 public OneWayFeature(boolean enabled, WSEndpointReference replyTo) { 98 this.enabled = enabled; 99 this.replyTo = replyTo; 100 } 101 102 /** 103 * Create an {@link OneWayFeature} 104 * 105 * @param enabled specifies whether this feature should be enabled or not. 106 * @param replyTo specifies the {@link WSEndpointReference} of wsa:ReplyTo header. 107 * @param from specifies the {@link WSEndpointReference} of wsa:From header. 108 * @param relatesTo specifies the MessageID to be used for wsa:RelatesTo header. 109 */ 110 @FeatureConstructor({"enabled","replyTo","from","relatesTo"}) 111 public OneWayFeature(boolean enabled, WSEndpointReference replyTo, WSEndpointReference from, String relatesTo) { 112 this.enabled = enabled; 113 this.replyTo = replyTo; 114 this.from = from; 115 this.relatesToID = relatesTo; 116 } 117 118 /** 119 * {@inheritDoc} 120 */ 121 @ManagedAttribute 122 public String getID() { 123 return ID; 124 } 125 126 public boolean 127 hasSslEprs() { 128 return sslReplyTo != null || sslFaultTo != null; 129 } 130 131 /** 132 * Getter for wsa:ReplyTo header {@link WSEndpointReference} . 133 * 134 * @return address of the wsa:ReplyTo header 135 */ | 1 /* 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. 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 23 * questions. 24 */ 25 26 package com.sun.xml.internal.ws.api.addressing; 27 28 import java.net.URL; 29 30 import com.sun.istack.internal.NotNull; 31 import com.sun.istack.internal.Nullable; 32 import com.sun.xml.internal.ws.api.FeatureConstructor; 33 34 import javax.xml.ws.WebServiceFeature; 35 36 import com.sun.org.glassfish.gmbal.ManagedAttribute; 37 import com.sun.org.glassfish.gmbal.ManagedData; 38 39 /** 40 * Unsupported RI extension to work around an issue in WSIT. 41 * 42 * <p> 43 * <b>This feature is not meant to be used by a common Web service developer</b> as there 44 * is no need to send the above mentioned header for a one-way operation. But these 45 * properties may need to be sent in certain middleware Web services. 46 * 47 * <p> 48 * This feature allows ReplyTo, From and RelatesTo Message Addressing Properties 49 * to be added for all messages that are sent from the port configured with 50 * this annotation. All operations are assumed to be one-way, and 51 * this feature should be used for one-way 52 * operations only. 53 * 54 * If a non-null ReplyTo is specified, then MessageID property is also added. 55 * 56 * @author Arun Gupta 57 */ 58 @ManagedData 59 public class OneWayFeature extends WebServiceFeature { 60 /** 61 * Constant value identifying the {@link OneWayFeature} 62 */ 63 public static final String ID = "http://java.sun.com/xml/ns/jaxws/addressing/oneway"; 64 65 private String messageId; 66 private WSEndpointReference replyTo; 67 private WSEndpointReference sslReplyTo; 68 private WSEndpointReference from; 69 private WSEndpointReference faultTo; 70 private WSEndpointReference sslFaultTo; 71 private String relatesToID; 72 private boolean useAsyncWithSyncInvoke = false; 73 74 /** 75 * Create an {@link OneWayFeature}. The instance created will be enabled. 76 */ 77 public OneWayFeature() { 78 this.enabled = true; 79 } 80 81 /** 82 * Create an {@link OneWayFeature} 83 * 84 * @param enabled specifies whether this feature should 85 * be enabled or not. 96 */ 97 public OneWayFeature(boolean enabled, WSEndpointReference replyTo) { 98 this.enabled = enabled; 99 this.replyTo = replyTo; 100 } 101 102 /** 103 * Create an {@link OneWayFeature} 104 * 105 * @param enabled specifies whether this feature should be enabled or not. 106 * @param replyTo specifies the {@link WSEndpointReference} of wsa:ReplyTo header. 107 * @param from specifies the {@link WSEndpointReference} of wsa:From header. 108 * @param relatesTo specifies the MessageID to be used for wsa:RelatesTo header. 109 */ 110 @FeatureConstructor({"enabled","replyTo","from","relatesTo"}) 111 public OneWayFeature(boolean enabled, WSEndpointReference replyTo, WSEndpointReference from, String relatesTo) { 112 this.enabled = enabled; 113 this.replyTo = replyTo; 114 this.from = from; 115 this.relatesToID = relatesTo; 116 } 117 118 public OneWayFeature(final AddressingPropertySet a, AddressingVersion v) { 119 this.enabled = true; 120 this.messageId = a.getMessageId(); 121 this.relatesToID = a.getRelatesTo(); 122 this.replyTo = makeEPR(a.getReplyTo(), v); 123 this.faultTo = makeEPR(a.getFaultTo(), v); 124 } 125 126 private WSEndpointReference makeEPR(final String x, final AddressingVersion v) { 127 if (x == null) { return null; } 128 return new WSEndpointReference(x, v); 129 } 130 131 public String getMessageId() { 132 return messageId; 133 } 134 135 /** 136 * {@inheritDoc} 137 */ 138 @ManagedAttribute 139 public String getID() { 140 return ID; 141 } 142 143 public boolean 144 hasSslEprs() { 145 return sslReplyTo != null || sslFaultTo != null; 146 } 147 148 /** 149 * Getter for wsa:ReplyTo header {@link WSEndpointReference} . 150 * 151 * @return address of the wsa:ReplyTo header 152 */ |