📄 constants.java
字号:
/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package org.apache.axis;import org.apache.axis.schema.SchemaVersion1999;import org.apache.axis.schema.SchemaVersion2000;import org.apache.axis.schema.SchemaVersion2001;import org.apache.axis.soap.SOAPConstants;import org.xml.sax.Attributes;import javax.xml.namespace.QName;public class Constants { // Some common Constants that should be used in local handler options // (Not all implementations will have these concepts - for example // not all Engines will have notion of registries but defining these // here should allow people to ask if they exist) ////////////////////////////////////////////////////////////////////////// // Namespace Prefix Constants ////////////////////////////////////////////////////////////////////////// public static final String NS_PREFIX_SOAP_ENV = "soapenv"; public static final String NS_PREFIX_SOAP_ENC = "soapenc"; public static final String NS_PREFIX_SCHEMA_XSI = "xsi" ; public static final String NS_PREFIX_SCHEMA_XSD = "xsd" ; public static final String NS_PREFIX_WSDL = "wsdl" ; public static final String NS_PREFIX_WSDL_SOAP = "wsdlsoap"; public static final String NS_PREFIX_XMLSOAP = "apachesoap"; public static final String NS_PREFIX_XML = "xml"; public static final String NS_PREFIX_XOP = "xop"; // Axis Namespaces public static final String NS_URI_AXIS = "http://xml.apache.org/axis/"; public static final String NS_URI_XMLSOAP = "http://xml.apache.org/xml-soap"; // Special namespace URI to indicate an "automatically" serialized Java // type. This allows us to use types without needing explicit mappings, // such that Java classes like "org.foo.Bar" map to QNames like // {http://xml.apache.org/axis/java}org.foo.Bar public static final String NS_URI_JAVA = "http://xml.apache.org/axis/java"; // // Default SOAP version // public static final SOAPConstants DEFAULT_SOAP_VERSION = SOAPConstants.SOAP11_CONSTANTS; // // SOAP-ENV Namespaces // public static final String URI_SOAP11_ENV = "http://schemas.xmlsoap.org/soap/envelope/" ; public static final String URI_SOAP12_ENV = "http://www.w3.org/2003/05/soap-envelope"; public static final String URI_DEFAULT_SOAP_ENV = DEFAULT_SOAP_VERSION.getEnvelopeURI(); // fixme: this is unsafe - a client can (accidentaly or on purpose) // over-write the elemnts of this array. This pattern is used throughout // this file. public static final String[] URIS_SOAP_ENV = { URI_SOAP11_ENV, URI_SOAP12_ENV, }; // Constant name of the enterprise-style logging category. // The enterprise category is for stuff that an enterprise product might // want to track, but in a simple environment (like the AXIS build) would // be nothing more than a nuisance. public static final String ENTERPRISE_LOG_CATEGORY = "org.apache.axis.enterprise"; /** * time logged stuff. */ public static final String TIME_LOG_CATEGORY = "org.apache.axis.TIME"; /** * Servlet exceptions. Axis faults are logged at debug level here. */ public static final String EXCEPTION_LOG_CATEGORY = "org.apache.axis.EXCEPTIONS"; /** The name of the field which accepts xsd:any content in Beans. */ public static final String ANYCONTENT = "_any"; /** * The size of the buffer size for. */ public static final int HTTP_TXR_BUFFER_SIZE = 8 * 1024; /** Basic Profile 1.1 compatibility flag */ public static final String WSIBP11_COMPAT_PROPERTY = "axis.ws-i.bp11.compatibility"; /** * Returns true if the string is the SOAP_ENV Namespace. * * @param s the string representation of a URI * @return <code>true</code> if s represents any of the supported soap * envelope URI strings */ public static boolean isSOAP_ENV(String s) { for (int i=0; i<URIS_SOAP_ENV.length; i++) { if (URIS_SOAP_ENV[i].equals(s)) { return true; } } return false; } public static final String URI_LITERAL_ENC = ""; // // SOAP-ENC Namespaces // public static final String URI_SOAP11_ENC = "http://schemas.xmlsoap.org/soap/encoding/" ; public static final String URI_SOAP12_ENC = "http://www.w3.org/2003/05/soap-encoding"; public static final String URI_SOAP12_NOENC = "http://www.w3.org/2003/05/soap-envelope/encoding/none"; public static final String URI_DEFAULT_SOAP_ENC = DEFAULT_SOAP_VERSION.getEncodingURI(); public static final String[] URIS_SOAP_ENC = { URI_SOAP12_ENC, URI_SOAP11_ENC, }; /** * Returns true if SOAP_ENC Namespace. * * @param s a string representing the URI to check * @return true if <code>s</code> matches a SOAP ENCODING namespace URI, * false otherwise */ public static boolean isSOAP_ENC(String s) { for (int i=0; i<URIS_SOAP_ENC.length; i++) { if (URIS_SOAP_ENC[i].equals(s)) { return true; } } return false; } /** * This utility routine returns the value of an attribute which might * be in one of several namespaces. * * @param attributes the attributes to search * @param search an array of namespace URI strings to search * @param localPart is the local part of the attribute name * @return the value of the attribute or null */ public static String getValue(Attributes attributes, String [] search, String localPart) { if (attributes == null || search == null || localPart == null) { return null; } int len = attributes.getLength(); if (len == 0) { return null; } for (int i=0; i < len; i++) { if (attributes.getLocalName(i).equals(localPart)) { String uri = attributes.getURI(i); for (int j=0; j<search.length; j++) { if (search[j].equals(uri)) return attributes.getValue(i); } } } return null; } /** * Search an attribute collection for a list of QNames, returning * the value of the first one found, or null if none were found. * * @param attributes * @param search * @return the value of the attribute */ public static String getValue(Attributes attributes, QName [] search) { if (attributes == null || search == null) return null; if (attributes.getLength() == 0) return null; String value = null; for (int i=0; (value == null) && (i < search.length); i++) { value = attributes.getValue(search[i].getNamespaceURI(), search[i].getLocalPart()); } return value; } /** * equals * The first QName is the current version of the name. The second qname is compared * with the first considering all namespace uri versions. * @param first Currently supported QName * @param second any qname * @return true if the qnames represent the same qname (paster namespace uri versions considered */ public static boolean equals(QName first, QName second) { if (first == second) { return true; } if (first==null || second==null) { return false; } if (first.equals(second)) { return true; } if (!first.getLocalPart().equals(second.getLocalPart())) { return false; } String namespaceURI = first.getNamespaceURI(); String[] search = null; if (namespaceURI.equals(URI_DEFAULT_SOAP_ENC)) search = URIS_SOAP_ENC; else if (namespaceURI.equals(URI_DEFAULT_SOAP_ENV)) search = URIS_SOAP_ENV; else if (namespaceURI.equals(URI_DEFAULT_SCHEMA_XSD)) search = URIS_SCHEMA_XSD; else if (namespaceURI.equals(URI_DEFAULT_SCHEMA_XSI))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -