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.developer;
  27 
  28 import com.sun.xml.internal.ws.api.message.HeaderList;
  29 import com.sun.xml.internal.ws.api.server.WSEndpoint;
  30 import com.sun.xml.internal.ws.api.addressing.WSEndpointReference;
  31 
  32 import javax.net.ssl.HostnameVerifier;
  33 import javax.net.ssl.HttpsURLConnection;
  34 import javax.net.ssl.SSLSocketFactory;
  35 import javax.xml.ws.BindingProvider;
  36 import javax.xml.ws.WebServiceContext;
  37 import javax.xml.ws.BindingType;
  38 import javax.xml.ws.http.HTTPBinding;
  39 import java.net.HttpURLConnection;
  40 
  41 public interface JAXWSProperties {
  42     // Content negotiation property: values "none", "pessimistic" and "optimistic"
  43     // It is split into two strings so that package renaming for
  44     // Java SE 6 doesn't alter the value. So do not combine them
  45     @Deprecated
  46     public static final String CONTENT_NEGOTIATION_PROPERTY = "com.sun."+"xml.ws.client.ContentNegotiation";
  47     public static final String MTOM_THRESHOLOD_VALUE =  "com.sun.xml.internal.ws.common.MtomThresholdValue";
  48     public static final String HTTP_EXCHANGE = "com.sun.xml.internal.ws.http.exchange";
  49 
  50     /**
  51      * Set this property on the {@link BindingProvider#getRequestContext()} to
  52      * enable {@link HttpURLConnection#setConnectTimeout(int)}
  53      *
  54      *<p>
  55      * int timeout = ...;
  56      * Map<String, Object> ctxt = ((BindingProvider)proxy).getRequestContext();
  57      * ctxt.put(CONNECT_TIMEOUT, timeout);
  58      */
  59     public static final String CONNECT_TIMEOUT =
  60         "com.sun.xml.internal.ws.connect.timeout";
  61 
  62     /**
  63      * Set this property on the {@link BindingProvider#getRequestContext()} to
  64      * enable {@link HttpURLConnection#setReadTimeout(int)}
  65      *
  66      *<p>
  67      * int timeout = ...;
  68      * Map<String, Object> ctxt = ((BindingProvider)proxy).getRequestContext();
  69      * ctxt.put(REQUEST_TIMEOUT, timeout);
  70      */
  71      public static final String REQUEST_TIMEOUT =
  72         "com.sun.xml.internal.ws.request.timeout";
  73 
  74     /**
  75      * Set this property on the {@link BindingProvider#getRequestContext()} to
  76      * enable {@link HttpURLConnection#setChunkedStreamingMode(int)}
  77      *
  78      *<p>
  79      * int chunkSize = ...;
  80      * Map<String, Object> ctxt = ((BindingProvider)proxy).getRequestContext();
  81      * ctxt.put(HTTP_CLIENT_STREAMING_CHUNK_SIZE, chunkSize);
  82      */
  83     public static final String HTTP_CLIENT_STREAMING_CHUNK_SIZE = "com.sun.xml.internal.ws.transport.http.client.streaming.chunk.size";
  84 
  85 
  86     /**
  87      * Set this property on the {@link BindingProvider#getRequestContext()} to
  88      * enable {@link HttpsURLConnection#setHostnameVerifier(HostnameVerifier)}}. The property
  89      * is set as follows:
  90      *
  91      * <p>
  92      * HostNameVerifier hostNameVerifier = ...;
  93      * Map<String, Object> ctxt = ((BindingProvider)proxy).getRequestContext();
  94      * ctxt.put(HOSTNAME_VERIFIER, hostNameVerifier);
  95      *
  96      * <p>
  97      * <b>THIS PROPERTY IS EXPERIMENTAL AND IS SUBJECT TO CHANGE WITHOUT NOTICE IN FUTURE.</b>
  98      */
  99     public static final String HOSTNAME_VERIFIER = "com.sun.xml.internal.ws.transport.https.client.hostname.verifier";
 100 
 101     /**
 102      * Set this property on the {@link BindingProvider#getRequestContext()} to
 103      * enable {@link HttpsURLConnection#setSSLSocketFactory(SSLSocketFactory)}. The property is set
 104      * as follows:
 105      *
 106      * <p>
 107      * SSLSocketFactory sslFactory = ...;
 108      * Map<String, Object> ctxt = ((BindingProvider)proxy).getRequestContext();
 109      * ctxt.put(SSL_SOCKET_FACTORY, sslFactory);
 110      *
 111      * <p>
 112      * <b>THIS PROPERTY IS EXPERIMENTAL AND IS SUBJECT TO CHANGE WITHOUT NOTICE IN FUTURE.</b>
 113      */
 114     public static final String SSL_SOCKET_FACTORY = "com.sun.xml.internal.ws.transport.https.client.SSLSocketFactory";
 115 
 116     /**
 117      * Acccess the list of SOAP headers in the SOAP message.
 118      *
 119      * <p>
 120      * On {@link WebServiceContext}, this property returns a {@link HeaderList} object
 121      * that represents SOAP headers in the request message that was received.
 122      * On {@link BindingProvider#getResponseContext()}, this property returns a
 123      * {@link HeaderList} object that represents SOAP headers in the response message from the server.
 124      *
 125      * <p>
 126      * The property is read-only, and please do not modify the returned {@link HeaderList}
 127      * as that may break the JAX-WS RI in some unexpected way.
 128      *
 129      * <p>
 130      * <b>THIS PROPERTY IS EXPERIMENTAL AND IS SUBJECT TO CHANGE WITHOUT NOTICE IN FUTURE.</b>
 131      */
 132     public static final String INBOUND_HEADER_LIST_PROPERTY = "com.sun.xml.internal.ws.api.message.HeaderList";
 133 
 134     /**
 135      * Access the {@link WSEndpoint} object that delivered the request.
 136      *
 137      * <p>
 138      * {@link WSEndpoint} is the root of the objects that are together
 139      * responsible for delivering requests to the application SEI object.
 140      * One can look up this {@link WSEndpoint} from {@link WebServiceContext},
 141      * and from there access many parts of the JAX-WS RI runtime.
 142      *
 143      * <p>
 144      * <b>THIS PROPERTY IS EXPERIMENTAL AND IS SUBJECT TO CHANGE WITHOUT NOTICE IN FUTURE.</b>
 145      *
 146      * @since 2.1.2
 147      */
 148     public static final String WSENDPOINT = "com.sun.xml.internal.ws.api.server.WSEndpoint";
 149 
 150     /**
 151      * Gets the {@code wsa:To} header.
 152      *
 153      * The propery value is available on incoming SOAP message. The type of the value
 154      * is {@link WSEndpointReference}.
 155      *
 156      * Null if the incoming SOAP message didn't have the header.
 157      *
 158      * @since 2.1.3
 159      */
 160     public static final String ADDRESSING_TO = "com.sun.xml.internal.ws.api.addressing.to";
 161 
 162     /**
 163      * Gets the {@code wsa:From} header.
 164      *
 165      * The propery value is available on incoming SOAP message. The type of the value
 166      * is {@link WSEndpointReference}.
 167      *
 168      * Null if the incoming SOAP message didn't have the header.
 169      *
 170      * @since 2.1.3
 171      */
 172     public static final String ADDRESSING_FROM = "com.sun.xml.internal.ws.api.addressing.from";
 173 
 174     /**
 175      * Gets the {@code wsa:Action} header value.
 176      *
 177      * The propery value is available on incoming SOAP message. The type of the value
 178      * is {@link String}.
 179      *
 180      * Null if the incoming SOAP message didn't have the header.
 181      *
 182      * @since 2.1.3
 183      */
 184     public static final String ADDRESSING_ACTION = "com.sun.xml.internal.ws.api.addressing.action";
 185 
 186     /**
 187      * Gets the {@code wsa:MessageID} header value.
 188      *
 189      * The propery value is available on incoming SOAP message. The type of the value
 190      * is {@link String}.
 191      *
 192      * Null if the incoming SOAP message didn't have the header.
 193      *
 194      * @since 2.1.3
 195      */
 196     public static final String ADDRESSING_MESSAGEID = "com.sun.xml.internal.ws.api.addressing.messageId";
 197 
 198     /**
 199      * Reconstructs the URL the client used to make the request. The returned URL
 200      * contains a protocol, server name, port number, and server path, but it does
 201      * not include query string parameters.
 202      * <p>
 203      * The property value is available on incoming SOAP message on servlet transport.
 204      *
 205      * @since 2.1.3
 206      */
 207     public static final String HTTP_REQUEST_URL = "com.sun.xml.internal.ws.transport.http.servlet.requestURL";
 208 
 209     /**
 210      * Binding to represent RESTful services. {@link HTTPBinding#HTTP_BINDING} works
 211      * only for Dispatch/Provider services, but this binding works with even SEI based
 212      * services. It would be XML, NOT SOAP on the wire. Hence, the SEI parameters
 213      * shouldn't be mapped to headers.
 214      *
 215      * <p>
 216      * Note that, this only solves limited RESTful usecases.
 217      *
 218      * <p>To enable restful binding on the service, specify the binding id via
 219      * {@link BindingType} or DD
 220      * <pre>
 221      * @WebService
 222      * @BindingType(JAXWSProperties.REST_BINDING)
 223      * </pre>
 224      *
 225      * <p>To enable restful binding on the client side, specify the binding id via
 226      * {@link BindingTypeFeature}
 227      * <pre>
 228      * proxy = echoImplService.getEchoImplPort(new BindingTypeFeature(JAXWSProperties.REST_BINDING));
 229      * </pre>
 230      *
 231      * @since 2.1.4
 232      */
 233     public static final String REST_BINDING = "http://jax-ws.dev.java.net/rest";
 234 
 235 }