src/share/jaxws_classes/com/oracle/webservices/internal/api/message/ContentType.java

Tue, 09 Apr 2013 14:51:13 +0100

author
alanb
date
Tue, 09 Apr 2013 14:51:13 +0100
changeset 368
0989ad8c0860
child 374
72e03566f0a6
permissions
-rw-r--r--

8010393: Update JAX-WS RI to 2.2.9-b12941
Reviewed-by: alanb, erikj
Contributed-by: miroslav.kos@oracle.com, martin.grebac@oracle.com

alanb@368 1 /*
alanb@368 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
alanb@368 3 *
alanb@368 4 * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved.
alanb@368 5 *
alanb@368 6 * The contents of this file are subject to the terms of either the GNU
alanb@368 7 * General Public License Version 2 only ("GPL") or the Common Development
alanb@368 8 * and Distribution License("CDDL") (collectively, the "License"). You
alanb@368 9 * may not use this file except in compliance with the License. You can
alanb@368 10 * obtain a copy of the License at
alanb@368 11 * http://glassfish.java.net/public/CDDL+GPL_1_1.html
alanb@368 12 * or packager/legal/LICENSE.txt. See the License for the specific
alanb@368 13 * language governing permissions and limitations under the License.
alanb@368 14 *
alanb@368 15 * When distributing the software, include this License Header Notice in each
alanb@368 16 * file and include the License file at packager/legal/LICENSE.txt.
alanb@368 17 *
alanb@368 18 * GPL Classpath Exception:
alanb@368 19 * Oracle designates this particular file as subject to the "Classpath"
alanb@368 20 * exception as provided by Oracle in the GPL Version 2 section of the License
alanb@368 21 * file that accompanied this code.
alanb@368 22 *
alanb@368 23 * Modifications:
alanb@368 24 * If applicable, add the following below the License Header, with the fields
alanb@368 25 * enclosed by brackets [] replaced by your own identifying information:
alanb@368 26 * "Portions Copyright [year] [name of copyright owner]"
alanb@368 27 *
alanb@368 28 * Contributor(s):
alanb@368 29 * If you wish your version of this file to be governed by only the CDDL or
alanb@368 30 * only the GPL Version 2, indicate your decision by adding "[Contributor]
alanb@368 31 * elects to include this software in this distribution under the [CDDL or GPL
alanb@368 32 * Version 2] license." If you don't indicate a single choice of license, a
alanb@368 33 * recipient has the option to distribute your version of this file under
alanb@368 34 * either the CDDL, the GPL Version 2 or to extend the choice of license to
alanb@368 35 * its licensees as provided above. However, if you add GPL Version 2 code
alanb@368 36 * and therefore, elected the GPL Version 2 license, then the option applies
alanb@368 37 * only if the new code is made subject to such option by the copyright
alanb@368 38 * holder.
alanb@368 39 */
alanb@368 40
alanb@368 41 package com.oracle.webservices.internal.api.message;
alanb@368 42
alanb@368 43 //TODO Do we want to remove this implementation dependency?
alanb@368 44 import com.sun.xml.internal.ws.encoding.ContentTypeImpl;
alanb@368 45
alanb@368 46 /**
alanb@368 47 * A Content-Type transport header that will be returned by {@link MessageContext#write(java.io.OutputStream)}.
alanb@368 48 * It will provide the Content-Type header and also take care of SOAP 1.1 SOAPAction header.
alanb@368 49 *
alanb@368 50 * @author Vivek Pandey
alanb@368 51 */
alanb@368 52 public interface ContentType {
alanb@368 53
alanb@368 54 /**
alanb@368 55 * Gives non-null Content-Type header value.
alanb@368 56 */
alanb@368 57 public String getContentType();
alanb@368 58
alanb@368 59 /**
alanb@368 60 * Gives SOAPAction transport header value. It will be non-null only for SOAP 1.1 messages. In other cases
alanb@368 61 * it MUST be null. The SOAPAction transport header should be written out only when its non-null.
alanb@368 62 *
alanb@368 63 * @return It can be null, in that case SOAPAction header should be written.
alanb@368 64 */
alanb@368 65 public String getSOAPActionHeader();
alanb@368 66
alanb@368 67 /**
alanb@368 68 * Controls the Accept transport header, if the transport supports it.
alanb@368 69 * Returning null means the transport need not add any new header.
alanb@368 70 *
alanb@368 71 * <p>
alanb@368 72 * We realize that this is not an elegant abstraction, but
alanb@368 73 * this would do for now. If another person comes and asks for
alanb@368 74 * a similar functionality, we'll define a real abstraction.
alanb@368 75 */
alanb@368 76 public String getAcceptHeader();
alanb@368 77
alanb@368 78 static public class Builder {
alanb@368 79 private String contentType;
alanb@368 80 private String soapAction;
alanb@368 81 private String accept;
alanb@368 82 private String charset;
alanb@368 83
alanb@368 84 public Builder contentType(String s) {contentType = s; return this; }
alanb@368 85 public Builder soapAction (String s) {soapAction = s; return this; }
alanb@368 86 public Builder accept (String s) {accept = s; return this; }
alanb@368 87 public Builder charset (String s) {charset = s; return this; }
alanb@368 88 public ContentType build() {
alanb@368 89 //TODO Do we want to remove this implementation dependency?
alanb@368 90 return new ContentTypeImpl(contentType, soapAction, accept, charset);
alanb@368 91 }
alanb@368 92 }
alanb@368 93 }

mercurial