325N/A/*
325N/A * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
325N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
325N/A *
325N/A * This code is free software; you can redistribute it and/or modify it
325N/A * under the terms of the GNU General Public License version 2 only, as
325N/A * published by the Free Software Foundation. Oracle designates this
325N/A * particular file as subject to the "Classpath" exception as provided
325N/A * by Oracle in the LICENSE file that accompanied this code.
325N/A *
325N/A * This code is distributed in the hope that it will be useful, but WITHOUT
325N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
325N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
325N/A * version 2 for more details (a copy is included in the LICENSE file that
325N/A * accompanied this code).
325N/A *
325N/A * You should have received a copy of the GNU General Public License version
325N/A * 2 along with this work; if not, write to the Free Software Foundation,
325N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
325N/A *
325N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
325N/A * or visit www.oracle.com if you need additional information or have any
325N/A * questions.
325N/A */
325N/A
325N/Apackage com.sun.xml.internal.messaging.saaj.client.p2p;
325N/A
325N/Aimport java.io.*;
325N/Aimport java.lang.reflect.Method;
325N/Aimport java.net.*;
325N/Aimport java.security.*;
325N/Aimport java.util.Iterator;
325N/Aimport java.util.StringTokenizer;
325N/Aimport java.util.logging.Level;
325N/Aimport java.util.logging.Logger;
325N/A
325N/Aimport javax.xml.soap.*;
325N/A
325N/Aimport com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl;
325N/Aimport com.sun.xml.internal.messaging.saaj.util.*;
325N/A
325N/A/**
325N/A * This represents a "connection" to the simple HTTP-based provider.
325N/A *
325N/A * @author Anil Vijendran (akv@eng.sun.com)
325N/A * @author Rajiv Mordani (rajiv.mordani@sun.com)
325N/A * @author Manveen Kaur (manveen.kaur@sun.com)
325N/A *
325N/A */
325N/Aclass HttpSOAPConnection extends SOAPConnection {
325N/A
325N/A public static final String vmVendor = SAAJUtil.getSystemProperty("java.vendor.url");
325N/A private static final String sunVmVendor = "http://java.sun.com/";
325N/A private static final String ibmVmVendor = "http://www.ibm.com/";
325N/A private static final boolean isSunVM = sunVmVendor.equals(vmVendor) ? true: false;
325N/A private static final boolean isIBMVM = ibmVmVendor.equals(vmVendor) ? true : false;
325N/A private static final String JAXM_URLENDPOINT="javax.xml.messaging.URLEndpoint";
325N/A
325N/A protected static final Logger log =
325N/A Logger.getLogger(LogDomainConstants.HTTP_CONN_DOMAIN,
325N/A "com.sun.xml.internal.messaging.saaj.client.p2p.LocalStrings");
325N/A
325N/A
325N/A MessageFactory messageFactory = null;
325N/A
325N/A boolean closed = false;
325N/A
325N/A public HttpSOAPConnection() throws SOAPException {
325N/A
325N/A try {
325N/A messageFactory = MessageFactory.newInstance(SOAPConstants.DYNAMIC_SOAP_PROTOCOL);
325N/A } catch (NoSuchMethodError ex) {
325N/A //fallback to default SOAP 1.1 in this case for backward compatibility
325N/A messageFactory = MessageFactory.newInstance();
325N/A } catch (Exception ex) {
325N/A log.log(Level.SEVERE, "SAAJ0001.p2p.cannot.create.msg.factory", ex);
325N/A throw new SOAPExceptionImpl("Unable to create message factory", ex);
325N/A }
325N/A }
325N/A
325N/A public void close() throws SOAPException {
325N/A if (closed) {
325N/A log.severe("SAAJ0002.p2p.close.already.closed.conn");
325N/A throw new SOAPExceptionImpl("Connection already closed");
325N/A }
325N/A
325N/A messageFactory = null;
325N/A closed = true;
325N/A }
325N/A
325N/A public SOAPMessage call(SOAPMessage message, Object endPoint)
325N/A throws SOAPException {
325N/A if (closed) {
325N/A log.severe("SAAJ0003.p2p.call.already.closed.conn");
325N/A throw new SOAPExceptionImpl("Connection is closed");
325N/A }
325N/A
325N/A Class urlEndpointClass = null;
325N/A ClassLoader loader = Thread.currentThread().getContextClassLoader();
325N/A try {
325N/A if (loader != null) {
325N/A urlEndpointClass = loader.loadClass(JAXM_URLENDPOINT);
325N/A } else {
325N/A urlEndpointClass = Class.forName(JAXM_URLENDPOINT);
325N/A }
325N/A } catch (ClassNotFoundException ex) {
325N/A //Do nothing. URLEndpoint is available only when JAXM is there.
325N/A log.finest("SAAJ0090.p2p.endpoint.available.only.for.JAXM");
325N/A }
325N/A
325N/A if (urlEndpointClass != null) {
325N/A if (urlEndpointClass.isInstance(endPoint)) {
325N/A String url = null;
325N/A
325N/A try {
325N/A Method m = urlEndpointClass.getMethod("getURL", (Class[])null);
325N/A url = (String) m.invoke(endPoint, (Object[])null);
325N/A } catch (Exception ex) {
325N/A // TBD -- exception chaining
325N/A log.log(Level.SEVERE,"SAAJ0004.p2p.internal.err",ex);
325N/A throw new SOAPExceptionImpl(
325N/A "Internal error: " + ex.getMessage());
325N/A }
325N/A try {
325N/A endPoint = new URL(url);
325N/A } catch (MalformedURLException mex) {
325N/A log.log(Level.SEVERE,"SAAJ0005.p2p.", mex);
325N/A throw new SOAPExceptionImpl("Bad URL: " + mex.getMessage());
325N/A }
325N/A }
325N/A }
325N/A
325N/A if (endPoint instanceof java.lang.String) {
325N/A try {
325N/A endPoint = new URL((String) endPoint);
325N/A } catch (MalformedURLException mex) {
325N/A log.log(Level.SEVERE, "SAAJ0006.p2p.bad.URL", mex);
325N/A throw new SOAPExceptionImpl("Bad URL: " + mex.getMessage());
325N/A }
325N/A }
325N/A
325N/A if (endPoint instanceof URL)
325N/A try {
325N/A SOAPMessage response = post(message, (URL)endPoint);
325N/A return response;
325N/A } catch (Exception ex) {
325N/A // TBD -- chaining?
325N/A throw new SOAPExceptionImpl(ex);
325N/A } else {
325N/A log.severe("SAAJ0007.p2p.bad.endPoint.type");
325N/A throw new SOAPExceptionImpl("Bad endPoint type " + endPoint);
325N/A }
325N/A }
325N/A
325N/A SOAPMessage post(SOAPMessage message, URL endPoint) throws SOAPException {
325N/A boolean isFailure = false;
325N/A
325N/A URL url = null;
325N/A HttpURLConnection httpConnection = null;
325N/A
325N/A int responseCode = 0;
325N/A try {
325N/A if (endPoint.getProtocol().equals("https"))
325N/A //if(!setHttps)
325N/A initHttps();
325N/A // Process the URL
325N/A JaxmURI uri = new JaxmURI(endPoint.toString());
325N/A String userInfo = uri.getUserinfo();
325N/A
325N/A url = endPoint;
325N/A
325N/A if (dL > 0)
325N/A d("uri: " + userInfo + " " + url + " " + uri);
325N/A
325N/A // TBD
325N/A // Will deal with https later.
325N/A if (!url.getProtocol().equalsIgnoreCase("http")
325N/A && !url.getProtocol().equalsIgnoreCase("https")) {
325N/A log.severe("SAAJ0052.p2p.protocol.mustbe.http.or.https");
325N/A throw new IllegalArgumentException(
325N/A "Protocol "
325N/A + url.getProtocol()
325N/A + " not supported in URL "
325N/A + url);
325N/A }
325N/A httpConnection = (HttpURLConnection) createConnection(url);
325N/A
325N/A httpConnection.setRequestMethod("POST");
325N/A
325N/A httpConnection.setDoOutput(true);
325N/A httpConnection.setDoInput(true);
325N/A httpConnection.setUseCaches(false);
325N/A httpConnection.setInstanceFollowRedirects(true);
325N/A
325N/A if (message.saveRequired())
325N/A message.saveChanges();
325N/A
325N/A MimeHeaders headers = message.getMimeHeaders();
325N/A
325N/A Iterator it = headers.getAllHeaders();
325N/A boolean hasAuth = false; // true if we find explicit Auth header
325N/A while (it.hasNext()) {
325N/A MimeHeader header = (MimeHeader) it.next();
325N/A
325N/A String[] values = headers.getHeader(header.getName());
325N/A if (values.length == 1)
325N/A httpConnection.setRequestProperty(
325N/A header.getName(),
325N/A header.getValue());
325N/A else {
325N/A StringBuffer concat = new StringBuffer();
325N/A int i = 0;
325N/A while (i < values.length) {
325N/A if (i != 0)
325N/A concat.append(',');
325N/A concat.append(values[i]);
325N/A i++;
325N/A }
325N/A
325N/A httpConnection.setRequestProperty(
325N/A header.getName(),
325N/A concat.toString());
325N/A }
325N/A
325N/A if ("Authorization".equals(header.getName())) {
325N/A hasAuth = true;
325N/A log.fine("SAAJ0091.p2p.https.auth.in.POST.true");
325N/A }
325N/A }
325N/A
325N/A if (!hasAuth && userInfo != null) {
325N/A initAuthUserInfo(httpConnection, userInfo);
325N/A }
325N/A
325N/A OutputStream out = httpConnection.getOutputStream();
325N/A message.writeTo(out);
325N/A
325N/A out.flush();
325N/A out.close();
325N/A
325N/A httpConnection.connect();
325N/A
325N/A try {
325N/A
325N/A responseCode = httpConnection.getResponseCode();
325N/A
325N/A // let HTTP_INTERNAL_ERROR (500) through because it is used for SOAP faults
325N/A if (responseCode == HttpURLConnection.HTTP_INTERNAL_ERROR) {
325N/A isFailure = true;
325N/A }
325N/A //else if (responseCode != HttpURLConnection.HTTP_OK)
325N/A //else if (!(responseCode >= HttpURLConnection.HTTP_OK && responseCode < 207))
325N/A else if ((responseCode / 100) != 2) {
325N/A log.log(Level.SEVERE,
325N/A "SAAJ0008.p2p.bad.response",
325N/A new String[] {httpConnection.getResponseMessage()});
325N/A throw new SOAPExceptionImpl(
325N/A "Bad response: ("
325N/A + responseCode
325N/A + httpConnection.getResponseMessage());
325N/A
325N/A }
325N/A } catch (IOException e) {
325N/A // on JDK1.3.1_01, we end up here, but then getResponseCode() succeeds!
325N/A responseCode = httpConnection.getResponseCode();
325N/A if (responseCode == HttpURLConnection.HTTP_INTERNAL_ERROR) {
325N/A isFailure = true;
325N/A } else {
325N/A throw e;
325N/A }
325N/A
325N/A }
325N/A
325N/A } catch (SOAPException ex) {
325N/A throw ex;
325N/A } catch (Exception ex) {
325N/A log.severe("SAAJ0009.p2p.msg.send.failed");
325N/A throw new SOAPExceptionImpl("Message send failed", ex);
325N/A }
325N/A
325N/A SOAPMessage response = null;
325N/A if (responseCode == HttpURLConnection.HTTP_OK || isFailure) {
325N/A try {
325N/A MimeHeaders headers = new MimeHeaders();
325N/A
325N/A String key, value;
325N/A
325N/A // Header field 0 is the status line so we skip it.
325N/A
325N/A int i = 1;
325N/A
325N/A while (true) {
325N/A key = httpConnection.getHeaderFieldKey(i);
325N/A value = httpConnection.getHeaderField(i);
325N/A
325N/A if (key == null && value == null)
325N/A break;
325N/A
325N/A if (key != null) {
325N/A StringTokenizer values =
325N/A new StringTokenizer(value, ",");
325N/A while (values.hasMoreTokens())
325N/A headers.addHeader(key, values.nextToken().trim());
325N/A }
325N/A i++;
325N/A }
325N/A
325N/A InputStream httpIn =
325N/A (isFailure
325N/A ? httpConnection.getErrorStream()
325N/A : httpConnection.getInputStream());
325N/A
325N/A byte[] bytes = readFully(httpIn);
325N/A
325N/A int length =
325N/A httpConnection.getContentLength() == -1
325N/A ? bytes.length
325N/A : httpConnection.getContentLength();
325N/A
325N/A // If no reply message is returned,
325N/A // content-Length header field value is expected to be zero.
325N/A if (length == 0) {
325N/A response = null;
325N/A log.warning("SAAJ0014.p2p.content.zero");
325N/A } else {
325N/A ByteInputStream in = new ByteInputStream(bytes, length);
325N/A response = messageFactory.createMessage(headers, in);
325N/A }
325N/A
325N/A httpIn.close();
325N/A httpConnection.disconnect();
325N/A
325N/A } catch (SOAPException ex) {
325N/A throw ex;
325N/A } catch (Exception ex) {
325N/A log.log(Level.SEVERE,"SAAJ0010.p2p.cannot.read.resp", ex);
325N/A throw new SOAPExceptionImpl(
325N/A "Unable to read response: " + ex.getMessage());
325N/A }
325N/A }
325N/A return response;
325N/A }
325N/A
325N/A // Object identifies where the request should be sent.
325N/A // It is required to support objects of type String and java.net.URL.
325N/A
325N/A public SOAPMessage get(Object endPoint) throws SOAPException {
325N/A if (closed) {
325N/A log.severe("SAAJ0011.p2p.get.already.closed.conn");
325N/A throw new SOAPExceptionImpl("Connection is closed");
325N/A }
325N/A Class urlEndpointClass = null;
325N/A
325N/A try {
325N/A urlEndpointClass = Class.forName("javax.xml.messaging.URLEndpoint");
325N/A } catch (Exception ex) {
325N/A //Do nothing. URLEndpoint is available only when JAXM is there.
325N/A }
325N/A
325N/A if (urlEndpointClass != null) {
325N/A if (urlEndpointClass.isInstance(endPoint)) {
325N/A String url = null;
325N/A
325N/A try {
325N/A Method m = urlEndpointClass.getMethod("getURL", (Class[])null);
325N/A url = (String) m.invoke(endPoint, (Object[])null);
325N/A } catch (Exception ex) {
325N/A log.severe("SAAJ0004.p2p.internal.err");
325N/A throw new SOAPExceptionImpl(
325N/A "Internal error: " + ex.getMessage());
325N/A }
325N/A try {
325N/A endPoint = new URL(url);
325N/A } catch (MalformedURLException mex) {
325N/A log.severe("SAAJ0005.p2p.");
325N/A throw new SOAPExceptionImpl("Bad URL: " + mex.getMessage());
325N/A }
325N/A }
325N/A }
325N/A
325N/A if (endPoint instanceof java.lang.String) {
325N/A try {
325N/A endPoint = new URL((String) endPoint);
325N/A } catch (MalformedURLException mex) {
325N/A log.severe("SAAJ0006.p2p.bad.URL");
325N/A throw new SOAPExceptionImpl("Bad URL: " + mex.getMessage());
325N/A }
325N/A }
325N/A
325N/A if (endPoint instanceof URL)
325N/A try {
325N/A SOAPMessage response = doGet((URL)endPoint);
325N/A return response;
325N/A } catch (Exception ex) {
325N/A throw new SOAPExceptionImpl(ex);
325N/A } else
325N/A throw new SOAPExceptionImpl("Bad endPoint type " + endPoint);
325N/A }
325N/A
325N/A SOAPMessage doGet(URL endPoint) throws SOAPException {
325N/A boolean isFailure = false;
325N/A
325N/A URL url = null;
325N/A HttpURLConnection httpConnection = null;
325N/A
325N/A int responseCode = 0;
325N/A try {
325N/A /// Is https GET allowed??
325N/A if (endPoint.getProtocol().equals("https"))
325N/A initHttps();
325N/A // Process the URL
325N/A JaxmURI uri = new JaxmURI(endPoint.toString());
325N/A String userInfo = uri.getUserinfo();
325N/A
325N/A url = endPoint;
325N/A
325N/A if (dL > 0)
325N/A d("uri: " + userInfo + " " + url + " " + uri);
325N/A
325N/A // TBD
325N/A // Will deal with https later.
325N/A if (!url.getProtocol().equalsIgnoreCase("http")
325N/A && !url.getProtocol().equalsIgnoreCase("https")) {
325N/A log.severe("SAAJ0052.p2p.protocol.mustbe.http.or.https");
325N/A throw new IllegalArgumentException(
325N/A "Protocol "
325N/A + url.getProtocol()
325N/A + " not supported in URL "
325N/A + url);
325N/A }
325N/A httpConnection = (HttpURLConnection) createConnection(url);
325N/A
325N/A httpConnection.setRequestMethod("GET");
325N/A
325N/A httpConnection.setDoOutput(true);
325N/A httpConnection.setDoInput(true);
325N/A httpConnection.setUseCaches(false);
325N/A httpConnection.setFollowRedirects(true);
325N/A
325N/A httpConnection.connect();
325N/A
325N/A try {
325N/A
325N/A responseCode = httpConnection.getResponseCode();
325N/A
325N/A // let HTTP_INTERNAL_ERROR (500) through because it is used for SOAP faults
325N/A if (responseCode == HttpURLConnection.HTTP_INTERNAL_ERROR) {
325N/A isFailure = true;
325N/A } else if ((responseCode / 100) != 2) {
325N/A log.log(Level.SEVERE,
325N/A "SAAJ0008.p2p.bad.response",
325N/A new String[] { httpConnection.getResponseMessage()});
325N/A throw new SOAPExceptionImpl(
325N/A "Bad response: ("
325N/A + responseCode
325N/A + httpConnection.getResponseMessage());
325N/A
325N/A }
325N/A } catch (IOException e) {
325N/A // on JDK1.3.1_01, we end up here, but then getResponseCode() succeeds!
325N/A responseCode = httpConnection.getResponseCode();
325N/A if (responseCode == HttpURLConnection.HTTP_INTERNAL_ERROR) {
325N/A isFailure = true;
325N/A } else {
325N/A throw e;
325N/A }
325N/A
325N/A }
325N/A
325N/A } catch (SOAPException ex) {
325N/A throw ex;
325N/A } catch (Exception ex) {
325N/A log.severe("SAAJ0012.p2p.get.failed");
325N/A throw new SOAPExceptionImpl("Get failed", ex);
325N/A }
325N/A
325N/A SOAPMessage response = null;
325N/A if (responseCode == HttpURLConnection.HTTP_OK || isFailure) {
325N/A try {
325N/A MimeHeaders headers = new MimeHeaders();
325N/A
325N/A String key, value;
325N/A
325N/A // Header field 0 is the status line so we skip it.
325N/A
325N/A int i = 1;
325N/A
325N/A while (true) {
325N/A key = httpConnection.getHeaderFieldKey(i);
325N/A value = httpConnection.getHeaderField(i);
325N/A
325N/A if (key == null && value == null)
325N/A break;
325N/A
325N/A if (key != null) {
325N/A StringTokenizer values =
325N/A new StringTokenizer(value, ",");
325N/A while (values.hasMoreTokens())
325N/A headers.addHeader(key, values.nextToken().trim());
325N/A }
325N/A i++;
325N/A }
325N/A
325N/A InputStream httpIn =
325N/A (isFailure
325N/A ? httpConnection.getErrorStream()
325N/A : httpConnection.getInputStream());
325N/A // If no reply message is returned,
325N/A // content-Length header field value is expected to be zero.
325N/A // java SE 6 documentation says :
325N/A // available() : an estimate of the number of bytes that can be read
325N/A //(or skipped over) from this input stream without blocking
325N/A //or 0 when it reaches the end of the input stream.
325N/A if ((httpIn == null )
325N/A || (httpConnection.getContentLength() == 0)
325N/A || (httpIn.available() == 0)) {
325N/A response = null;
325N/A log.warning("SAAJ0014.p2p.content.zero");
325N/A } else {
325N/A response = messageFactory.createMessage(headers, httpIn);
325N/A }
325N/A
325N/A httpIn.close();
325N/A httpConnection.disconnect();
325N/A
325N/A } catch (SOAPException ex) {
325N/A throw ex;
325N/A } catch (Exception ex) {
325N/A log.log(Level.SEVERE,
325N/A "SAAJ0010.p2p.cannot.read.resp",
325N/A ex);
325N/A throw new SOAPExceptionImpl(
325N/A "Unable to read response: " + ex.getMessage());
325N/A }
325N/A }
325N/A return response;
325N/A }
325N/A
325N/A private byte[] readFully(InputStream istream) throws IOException {
325N/A ByteArrayOutputStream bout = new ByteArrayOutputStream();
325N/A byte[] buf = new byte[1024];
325N/A int num = 0;
325N/A
325N/A while ((num = istream.read(buf)) != -1) {
325N/A bout.write(buf, 0, num);
325N/A }
325N/A
325N/A byte[] ret = bout.toByteArray();
325N/A
325N/A return ret;
325N/A }
325N/A
325N/A //private static String SSL_PKG = "com.sun.net.ssl.internal.www.protocol";
325N/A //private static String SSL_PROVIDER =
325N/A // "com.sun.net.ssl.internal.ssl.Provider";
325N/A private static final String SSL_PKG;
325N/A private static final String SSL_PROVIDER;
325N/A
325N/A static {
325N/A if (isIBMVM) {
325N/A SSL_PKG ="com.ibm.net.ssl.internal.www.protocol";
325N/A SSL_PROVIDER ="com.ibm.net.ssl.internal.ssl.Provider";
325N/A } else {
325N/A //if not IBM VM default to Sun.
325N/A SSL_PKG = "com.sun.net.ssl.internal.www.protocol";
325N/A SSL_PROVIDER ="com.sun.net.ssl.internal.ssl.Provider";
325N/A }
325N/A }
325N/A
325N/A private void initHttps() {
325N/A //if(!setHttps) {
325N/A String pkgs = SAAJUtil.getSystemProperty("java.protocol.handler.pkgs");
325N/A log.log(Level.FINE,
325N/A "SAAJ0053.p2p.providers",
325N/A new String[] { pkgs });
325N/A
325N/A if (pkgs == null || pkgs.indexOf(SSL_PKG) < 0) {
325N/A if (pkgs == null)
325N/A pkgs = SSL_PKG;
325N/A else
325N/A pkgs = pkgs + "|" + SSL_PKG;
325N/A System.setProperty("java.protocol.handler.pkgs", pkgs);
325N/A log.log(Level.FINE,
325N/A "SAAJ0054.p2p.set.providers",
325N/A new String[] { pkgs });
325N/A try {
325N/A Class c = Class.forName(SSL_PROVIDER);
325N/A Provider p = (Provider) c.newInstance();
325N/A Security.addProvider(p);
325N/A log.log(Level.FINE,
325N/A "SAAJ0055.p2p.added.ssl.provider",
325N/A new String[] { SSL_PROVIDER });
325N/A //System.out.println("Added SSL_PROVIDER " + SSL_PROVIDER);
325N/A //setHttps = true;
325N/A } catch (Exception ex) {
325N/A }
325N/A }
325N/A //}
325N/A }
325N/A
325N/A private void initAuthUserInfo(HttpURLConnection conn, String userInfo) {
325N/A String user;
325N/A String password;
325N/A if (userInfo != null) { // get the user and password
325N/A //System.out.println("UserInfo= " + userInfo );
325N/A int delimiter = userInfo.indexOf(':');
325N/A if (delimiter == -1) {
325N/A user = ParseUtil.decode(userInfo);
325N/A password = null;
325N/A } else {
325N/A user = ParseUtil.decode(userInfo.substring(0, delimiter++));
325N/A password = ParseUtil.decode(userInfo.substring(delimiter));
325N/A }
325N/A
325N/A String plain = user + ":";
325N/A byte[] nameBytes = plain.getBytes();
325N/A byte[] passwdBytes = password.getBytes();
325N/A
325N/A // concatenate user name and password bytes and encode them
325N/A byte[] concat = new byte[nameBytes.length + passwdBytes.length];
325N/A
325N/A System.arraycopy(nameBytes, 0, concat, 0, nameBytes.length);
325N/A System.arraycopy(
325N/A passwdBytes,
325N/A 0,
325N/A concat,
325N/A nameBytes.length,
325N/A passwdBytes.length);
325N/A String auth = "Basic " + new String(Base64.encode(concat));
325N/A conn.setRequestProperty("Authorization", auth);
325N/A if (dL > 0)
325N/A d("Adding auth " + auth);
325N/A }
325N/A }
325N/A
325N/A private static final int dL = 0;
325N/A private void d(String s) {
325N/A log.log(Level.SEVERE,
325N/A "SAAJ0013.p2p.HttpSOAPConnection",
325N/A new String[] { s });
325N/A System.err.println("HttpSOAPConnection: " + s);
325N/A }
325N/A
325N/A private java.net.HttpURLConnection createConnection(URL endpoint)
325N/A throws IOException {
325N/A return (HttpURLConnection) endpoint.openConnection();
325N/A }
325N/A
325N/A}