src/share/jaxws_classes/com/sun/tools/internal/ws/wsdl/parser/HTTPExtensionHandler.java

Fri, 04 Oct 2013 16:21:34 +0100

author
mkos
date
Fri, 04 Oct 2013 16:21:34 +0100
changeset 408
b0610cd08440
parent 368
0989ad8c0860
child 637
9c07ef4934dd
permissions
-rw-r--r--

8025054: Update JAX-WS RI integration to 2.2.9-b130926.1035
Reviewed-by: chegar

ohair@286 1 /*
alanb@368 2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
ohair@286 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ohair@286 4 *
ohair@286 5 * This code is free software; you can redistribute it and/or modify it
ohair@286 6 * under the terms of the GNU General Public License version 2 only, as
ohair@286 7 * published by the Free Software Foundation. Oracle designates this
ohair@286 8 * particular file as subject to the "Classpath" exception as provided
ohair@286 9 * by Oracle in the LICENSE file that accompanied this code.
ohair@286 10 *
ohair@286 11 * This code is distributed in the hope that it will be useful, but WITHOUT
ohair@286 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ohair@286 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ohair@286 14 * version 2 for more details (a copy is included in the LICENSE file that
ohair@286 15 * accompanied this code).
ohair@286 16 *
ohair@286 17 * You should have received a copy of the GNU General Public License version
ohair@286 18 * 2 along with this work; if not, write to the Free Software Foundation,
ohair@286 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ohair@286 20 *
ohair@286 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@286 22 * or visit www.oracle.com if you need additional information or have any
ohair@286 23 * questions.
ohair@286 24 */
ohair@286 25
ohair@286 26 package com.sun.tools.internal.ws.wsdl.parser;
ohair@286 27
ohair@286 28 import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible;
ohair@286 29 import com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext;
ohair@286 30 import com.sun.tools.internal.ws.util.xml.XmlUtil;
ohair@286 31 import com.sun.tools.internal.ws.wsdl.document.http.*;
ohair@286 32 import org.w3c.dom.Element;
ohair@286 33
ohair@286 34 import java.util.Map;
ohair@286 35
ohair@286 36 /**
ohair@286 37 * The HTTP extension handler for WSDL.
ohair@286 38 *
ohair@286 39 * @author WS Development Team
ohair@286 40 */
ohair@286 41 public class HTTPExtensionHandler extends AbstractExtensionHandler {
ohair@286 42
ohair@286 43
ohair@286 44 public HTTPExtensionHandler(Map<String, AbstractExtensionHandler> extensionHandlerMap) {
ohair@286 45 super(extensionHandlerMap);
ohair@286 46 }
ohair@286 47
ohair@286 48 public String getNamespaceURI() {
ohair@286 49 return Constants.NS_WSDL_HTTP;
ohair@286 50 }
ohair@286 51
ohair@286 52 public boolean handleDefinitionsExtension(
ohair@286 53 TWSDLParserContext context,
ohair@286 54 TWSDLExtensible parent,
ohair@286 55 Element e) {
ohair@286 56 Util.fail(
ohair@286 57 "parsing.invalidExtensionElement",
ohair@286 58 e.getTagName(),
ohair@286 59 e.getNamespaceURI());
ohair@286 60 return false;
ohair@286 61 }
ohair@286 62
ohair@286 63 public boolean handleTypesExtension(
ohair@286 64 com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context,
ohair@286 65 TWSDLExtensible parent,
ohair@286 66 Element e) {
ohair@286 67 Util.fail(
ohair@286 68 "parsing.invalidExtensionElement",
ohair@286 69 e.getTagName(),
ohair@286 70 e.getNamespaceURI());
ohair@286 71 return false;
ohair@286 72 }
ohair@286 73
ohair@286 74 public boolean handleBindingExtension(
ohair@286 75 TWSDLParserContext context,
ohair@286 76 TWSDLExtensible parent,
ohair@286 77 Element e) {
ohair@286 78 if (XmlUtil.matchesTagNS(e, HTTPConstants.QNAME_BINDING)) {
ohair@286 79 context.push();
ohair@286 80 context.registerNamespaces(e);
ohair@286 81
ohair@286 82 HTTPBinding binding = new HTTPBinding(context.getLocation(e));
ohair@286 83
ohair@286 84 String verb = Util.getRequiredAttribute(e, Constants.ATTR_VERB);
ohair@286 85 binding.setVerb(verb);
ohair@286 86
ohair@286 87 parent.addExtension(binding);
ohair@286 88 context.pop();
ohair@286 89 // context.fireDoneParsingEntity(HTTPConstants.QNAME_BINDING, binding);
ohair@286 90 return true;
ohair@286 91 } else {
ohair@286 92 Util.fail(
ohair@286 93 "parsing.invalidExtensionElement",
ohair@286 94 e.getTagName(),
ohair@286 95 e.getNamespaceURI());
ohair@286 96 return false;
ohair@286 97 }
ohair@286 98 }
ohair@286 99
ohair@286 100 public boolean handleOperationExtension(
ohair@286 101 TWSDLParserContext context,
ohair@286 102 TWSDLExtensible parent,
ohair@286 103 Element e) {
ohair@286 104 if (XmlUtil.matchesTagNS(e, HTTPConstants.QNAME_OPERATION)) {
ohair@286 105 context.push();
ohair@286 106 context.registerNamespaces(e);
ohair@286 107
ohair@286 108 HTTPOperation operation = new HTTPOperation(context.getLocation(e));
ohair@286 109
ohair@286 110 String location =
ohair@286 111 Util.getRequiredAttribute(e, Constants.ATTR_LOCATION);
ohair@286 112 operation.setLocation(location);
ohair@286 113
ohair@286 114 parent.addExtension(operation);
ohair@286 115 context.pop();
ohair@286 116 // context.fireDoneParsingEntity(
ohair@286 117 // HTTPConstants.QNAME_OPERATION,
ohair@286 118 // operation);
ohair@286 119 return true;
ohair@286 120 } else {
ohair@286 121 Util.fail(
ohair@286 122 "parsing.invalidExtensionElement",
ohair@286 123 e.getTagName(),
ohair@286 124 e.getNamespaceURI());
ohair@286 125 return false;
ohair@286 126 }
ohair@286 127 }
ohair@286 128
ohair@286 129 public boolean handleInputExtension(
ohair@286 130 TWSDLParserContext context,
ohair@286 131 TWSDLExtensible parent,
ohair@286 132 Element e) {
ohair@286 133 if (XmlUtil.matchesTagNS(e, HTTPConstants.QNAME_URL_ENCODED)) {
ohair@286 134 parent.addExtension(new HTTPUrlEncoded(context.getLocation(e)));
ohair@286 135 return true;
ohair@286 136 } else if (
ohair@286 137 XmlUtil.matchesTagNS(e, HTTPConstants.QNAME_URL_REPLACEMENT)) {
ohair@286 138 parent.addExtension(new HTTPUrlReplacement(context.getLocation(e)));
ohair@286 139 return true;
ohair@286 140 } else {
ohair@286 141 Util.fail(
ohair@286 142 "parsing.invalidExtensionElement",
ohair@286 143 e.getTagName(),
ohair@286 144 e.getNamespaceURI());
ohair@286 145 return false;
ohair@286 146 }
ohair@286 147 }
ohair@286 148
ohair@286 149 public boolean handleOutputExtension(
ohair@286 150 TWSDLParserContext context,
ohair@286 151 TWSDLExtensible parent,
ohair@286 152 Element e) {
ohair@286 153 Util.fail(
ohair@286 154 "parsing.invalidExtensionElement",
ohair@286 155 e.getTagName(),
ohair@286 156 e.getNamespaceURI());
ohair@286 157 return false;
ohair@286 158 }
ohair@286 159
ohair@286 160 public boolean handleFaultExtension(
ohair@286 161 TWSDLParserContext context,
ohair@286 162 TWSDLExtensible parent,
ohair@286 163 Element e) {
ohair@286 164 Util.fail(
ohair@286 165 "parsing.invalidExtensionElement",
ohair@286 166 e.getTagName(),
ohair@286 167 e.getNamespaceURI());
ohair@286 168 return false;
ohair@286 169 }
ohair@286 170
ohair@286 171 public boolean handleServiceExtension(
ohair@286 172 TWSDLParserContext context,
ohair@286 173 TWSDLExtensible parent,
ohair@286 174 Element e) {
ohair@286 175 Util.fail(
ohair@286 176 "parsing.invalidExtensionElement",
ohair@286 177 e.getTagName(),
ohair@286 178 e.getNamespaceURI());
ohair@286 179 return false;
ohair@286 180 }
ohair@286 181
ohair@286 182 public boolean handlePortExtension(
ohair@286 183 TWSDLParserContext context,
ohair@286 184 TWSDLExtensible parent,
ohair@286 185 Element e) {
ohair@286 186 if (XmlUtil.matchesTagNS(e, HTTPConstants.QNAME_ADDRESS)) {
ohair@286 187 context.push();
ohair@286 188 context.registerNamespaces(e);
ohair@286 189
ohair@286 190 HTTPAddress address = new HTTPAddress(context.getLocation(e));
ohair@286 191
ohair@286 192 String location =
ohair@286 193 Util.getRequiredAttribute(e, Constants.ATTR_LOCATION);
ohair@286 194 address.setLocation(location);
ohair@286 195
ohair@286 196 parent.addExtension(address);
ohair@286 197 context.pop();
ohair@286 198 // context.fireDoneParsingEntity(HTTPConstants.QNAME_ADDRESS, address);
ohair@286 199 return true;
ohair@286 200 } else {
ohair@286 201 Util.fail(
ohair@286 202 "parsing.invalidExtensionElement",
ohair@286 203 e.getTagName(),
ohair@286 204 e.getNamespaceURI());
ohair@286 205 return false;
ohair@286 206 }
ohair@286 207 }
ohair@286 208
ohair@286 209 public boolean handlePortTypeExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) {
ohair@286 210 Util.fail(
ohair@286 211 "parsing.invalidExtensionElement",
ohair@286 212 e.getTagName(),
ohair@286 213 e.getNamespaceURI());
ohair@286 214 return false;
ohair@286 215 }
ohair@286 216 }

mercurial