changeset 85:c37936a72332

6813167: Merge cleanup.
author andrew
date Thu, 06 Aug 2009 01:34:10 +0100
parents eec5a3bbff72
children 73440eb34fb0
files src/share/classes/com/sun/xml/internal/ws/client/sei/AsyncBuilder.java src/share/classes/com/sun/xml/internal/ws/encoding/AbstractXMLStreamWriterExImpl.java src/share/classes/com/sun/xml/internal/ws/streaming/XMLReader.java src/share/classes/com/sun/xml/internal/ws/transport/http/client/HttpClientTransport.java src/share/classes/com/sun/xml/internal/ws/transport/http/server/ServerConnectionImpl.java
diffstat 5 files changed, 5 insertions(+), 558 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/xml/internal/ws/client/sei/AsyncBuilder.java	Thu Aug 06 00:33:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,244 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-package com.sun.xml.internal.ws.client.sei;
-
-import com.sun.xml.internal.bind.api.AccessorException;
-import com.sun.xml.internal.bind.api.Bridge;
-import com.sun.xml.internal.bind.api.CompositeStructure;
-import com.sun.xml.internal.bind.api.RawAccessor;
-import com.sun.xml.internal.ws.api.SOAPVersion;
-import com.sun.xml.internal.ws.api.message.Message;
-import com.sun.xml.internal.ws.api.message.Messages;
-import com.sun.xml.internal.ws.api.model.SEIModel;
-import com.sun.xml.internal.ws.model.ParameterImpl;
-import com.sun.xml.internal.ws.model.WrapperParameter;
-import com.sun.xml.internal.ws.message.jaxb.JAXBMessage;
-import java.util.Collection;
-
-import javax.xml.bind.JAXBException;
-import javax.xml.namespace.QName;
-import javax.xml.ws.Holder;
-import javax.xml.ws.WebServiceException;
-import java.util.List;
-
-/**
- * Builds Async bean
- *
- * @see MessageFiller
- * @author Jitendra Kotamraju
- */
-abstract class AsyncBuilder {
-
-    abstract Object fillAsyncBean(Object[] methodArgs, Object returnValue, Object bean);
-
-    /**
-     * Used to create a payload JAXB object just by taking
-     * one of the parameters.
-     */
-    final static class Bare extends AsyncBuilder {
-        /**
-         * The index of the method invocation parameters that goes into the payload.
-         */
-        private final int methodPos;
-        private final ValueGetter getter;
-        private final RawAccessor accessor;
-
-        /**
-         * Creates a {@link BodyBuilder} from a bare parameter.
-         */
-        Bare(Class wrapper, ParameterImpl p) {
-            this.methodPos = p.getIndex();
-            this.getter = ValueGetter.get(p);
-            QName name = p.getName();
-            try {
-                accessor = p.getOwner().getJAXBContext().getElementPropertyAccessor(
-                        wrapper, name.getNamespaceURI(), name.getLocalPart() );
-            } catch (JAXBException e) {
-                throw new WebServiceException(  // TODO: i18n
-                    wrapper+" do not have a property of the name "+name,e);
-            }
-        }
-
-        /**
-         * Picks up an object from the method arguments and uses it.
-         */
-        Object fillAsyncBean(Object[] methodArgs, Object returnValue, Object bean) {
-            Object obj = (methodPos == -1) ? returnValue : getter.get(methodArgs[methodPos]);
-            try {
-                accessor.set(bean, obj);
-            } catch (Exception e) {
-                throw new WebServiceException(e);    // TODO:i18n
-            }
-            return bean;
-        }
-    }
-
-    final static class Filler extends AsyncBuilder {
-        /**
-         * The index of the method invocation parameters that goes into the payload.
-         */
-        private final int methodPos;
-        private final ValueGetter getter;
-
-        /**
-         * Creates a {@link BodyBuilder} from a bare parameter.
-         */
-        Filler(ParameterImpl p) {
-            this.methodPos = p.getIndex();
-            this.getter = ValueGetter.get(p);
-        }
-
-        /**
-         * Picks up an object from the method arguments and uses it.
-         */
-        Object fillAsyncBean(Object[] methodArgs, Object returnValue, Object bean) {
-            return (methodPos == -1) ? returnValue : getter.get(methodArgs[methodPos]);
-        }
-    }
-
-    public static AsyncBuilder NONE = new None();
-
-    static final class None extends AsyncBuilder {
-        Object fillAsyncBean(Object[] methodArgs, Object returnValue, Object bean) {
-            return bean;
-        }
-    }
-
-    static final class Composite extends AsyncBuilder {
-        private final AsyncBuilder[] builders;
-        private final Class beanClass;
-
-        public Composite(AsyncBuilder[] builders, Class beanClass) {
-            this.builders = builders;
-            this.beanClass = beanClass;
-        }
-
-
-        public Composite(Collection<? extends AsyncBuilder> builders, Class beanClass) {
-            this(builders.toArray(new AsyncBuilder[builders.size()]), beanClass);
-        }
-
-        Object fillAsyncBean(Object[] methodArgs, Object returnValue, Object bean) {
-            try {
-                bean = beanClass.newInstance();
-            } catch (Exception ex) {
-                throw new WebServiceException(ex);
-            }
-            for (AsyncBuilder builder : builders) {
-                builder.fillAsyncBean(methodArgs, returnValue, bean);
-            }
-            return bean;
-        }
-    }
-
-
-    /**
-     * Used to handle a 'wrapper' style request.
-     * Common part of rpc/lit and doc/lit.
-     */
-    abstract static class Wrapped extends AsyncBuilder {
-
-        /**
-         * Where in the method argument list do they come from?
-         */
-        protected final int[] indices;
-
-        /**
-         * Abstracts away the {@link Holder} handling when touching method arguments.
-         */
-        protected final ValueGetter[] getters;
-
-        protected Wrapped(WrapperParameter wp) {
-
-            List<ParameterImpl> children = wp.getWrapperChildren();
-
-            indices = new int[children.size()];
-            getters = new ValueGetter[children.size()];
-            for( int i=0; i<indices.length; i++ ) {
-                ParameterImpl p = children.get(i);
-                indices[i] = p.getIndex();
-                getters[i] = ValueGetter.get(p);
-            }
-        }
-    }
-
-    /**
-     * Used to create a payload JAXB object by wrapping
-     * multiple parameters into one "wrapper bean".
-     */
-    final static class DocLit extends Wrapped {
-        /**
-         * How does each wrapped parameter binds to XML?
-         */
-        private final RawAccessor[] accessors;
-
-        /**
-         * Wrapper bean.
-         */
-        private final Class wrapper;
-
-        /**
-         * Creates a {@link BodyBuilder} from a {@link WrapperParameter}.
-         */
-        DocLit(Class wrapper, WrapperParameter wp) {
-            super(wp);
-            this.wrapper = wrapper;
-
-            List<ParameterImpl> children = wp.getWrapperChildren();
-
-            accessors = new RawAccessor[children.size()];
-            for( int i=0; i<accessors.length; i++ ) {
-                ParameterImpl p = children.get(i);
-                QName name = p.getName();
-                try {
-                    accessors[i] = p.getOwner().getJAXBContext().getElementPropertyAccessor(
-                        wrapper, name.getNamespaceURI(), name.getLocalPart() );
-                } catch (JAXBException e) {
-                    throw new WebServiceException(  // TODO: i18n
-                        wrapper+" do not have a property of the name "+name,e);
-                }
-            }
-
-        }
-
-        /**
-         * Packs a bunch of arguments into a {@link CompositeStructure}.
-         */
-        Object fillAsyncBean(Object[] methodArgs, Object returnValue, Object bean) {
-            try {
-                // fill in wrapped parameters from methodArgs
-                for( int i=indices.length-1; i>=0; i-- ) {
-                    Object obj = (indices[i] == -1) ? returnValue : methodArgs[indices[i]];
-                    accessors[i].set(bean,getters[i].get(obj));
-                }
-            } catch (Exception e) {
-                throw new WebServiceException(e);    // TODO:i18n
-            }
-            return bean;
-        }
-    }
-
-}
--- a/src/share/classes/com/sun/xml/internal/ws/encoding/AbstractXMLStreamWriterExImpl.java	Thu Aug 06 00:33:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-package com.sun.xml.internal.ws.encoding;
-
-import com.sun.istack.internal.XMLStreamException2;
-import com.sun.xml.internal.ws.util.ByteArrayBuffer;
-import com.sun.xml.internal.org.jvnet.staxex.XMLStreamWriterEx;
-
-import javax.activation.DataHandler;
-import javax.xml.stream.XMLStreamException;
-import java.io.IOException;
-import java.io.OutputStream;
-
-/**
- * Partial default implementation of {@link XMLStreamWriterEx}.
- *
- * TODO: find a good home for this class.
- *
- * @author Kohsuke Kawaguchi
- */
-public abstract class AbstractXMLStreamWriterExImpl implements XMLStreamWriterEx {
-
-    private StreamImpl stream;
-
-    public void writeBinary(DataHandler data) throws XMLStreamException {
-        try {
-            StreamImpl stream = _writeBinary(data.getContentType());
-            stream.write(data.getInputStream());
-            stream.close();
-        } catch (IOException e) {
-            throw new XMLStreamException2(e);
-        }
-    }
-    public OutputStream writeBinary(String contentType) throws XMLStreamException {
-        return _writeBinary(contentType);
-    }
-
-    private StreamImpl _writeBinary(String contentType) {
-        if(stream==null)
-            stream = new StreamImpl();
-        else
-            stream.reset();
-        stream.contentType = contentType;
-        return stream;
-    }
-
-    private final class StreamImpl extends ByteArrayBuffer {
-        private String contentType;
-        public void close() throws IOException {
-            super.close();
-            try {
-                writeBinary(buf,0,size(),contentType);
-            } catch (XMLStreamException e) {
-                IOException x = new IOException();
-                x.initCause(e);
-                throw x;
-            }
-        }
-    }
-}
--- a/src/share/classes/com/sun/xml/internal/ws/streaming/XMLReader.java	Thu Aug 06 00:33:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,230 +0,0 @@
-/*
- * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-package com.sun.xml.internal.ws.streaming;
-
-import org.xml.sax.helpers.XMLReaderFactory;
-
-import java.util.Iterator;
-
-import javax.xml.namespace.QName;
-
-/**
- * <p> XMLReader provides a high-level streaming parser interface
- * for reading XML documents. </p>
- *
- * <p> The {@link #next} method is used to read events from the XML document. </p>
- *
- * <p> Each time it is called, {@link #next} returns the new state of the reader. </p>
- *
- * <p> Possible states are: BOF, the initial state, START, denoting the start
- * tag of an element, END, denoting the end tag of an element, CHARS, denoting
- * the character content of an element, PI, denoting a processing instruction,
- * EOF, denoting the end of the document. </p>
- *
- * <p> Depending on the state the reader is in, one or more of the following
- * query methods will be meaningful: {@link #getName}, {@link #getURI},
- * {@link #getLocalName}, {@link #getAttributes}, {@link #getValue}. </p>
- *
- * <p> Elements visited by a XMLReader are tagged with unique IDs. The ID of the
- * current element can be found by calling {@link #getElementId}. </p>
- *
- * <p> A XMLReader is always namespace-aware, and keeps track of the namespace
- * declarations which are in scope at any time during streaming. The
- * {@link #getURI(java.lang.String)} method can be used to find the URI
- * associated to a given prefix in the current scope. </p>
- *
- * <p> XMLReaders can be created using a {@link XMLReaderFactory}. </p>
- *
- * <p> Some utility methods, {@link #nextContent} and {@link #nextElementContent}
- * make it possible to ignore whitespace and processing instructions with
- * minimum impact on the client code. </p>
- *
- * <p> Similarly, the {@link #skipElement} and {@link #skipElement(int elementId)}
- * methods allow to skip to the end tag of an element ignoring all its content. </p>
- *
- * <p> Finally, the {@link #recordElement} method can be invoked when the XMLReader
- * is positioned on the start tag of an element to record the element's contents
- * so that they can be played back later. </p>
- *
- * @see XMLReaderFactory
- *
- * @author WS Development Team
- */
-public interface XMLReader {
-    /**
-     * The initial state of a XMLReader.
-     */
-    public static final int BOF = 0;
-
-    /**
-     * The state denoting the start tag of an element.
-     */
-    public static final int START = 1;
-
-    /**
-     * The state denoting the end tag of an element.
-     */
-    public static final int END = 2;
-
-    /**
-     * The state denoting the character content of an element.
-     */
-    public static final int CHARS = 3;
-
-    /**
-     * The state denoting a processing instruction.
-     */
-    public static final int PI = 4;
-
-    /**
-     * The state denoting that the end of the document has been reached.
-     */
-    public static final int EOF = 5;
-
-    /**
-     * Return the next state of the XMLReader.
-     *
-     * The return value is one of: START, END, CHARS, PI, EOF.
-     */
-    public int next();
-
-    /*
-    * Return the next state of the XMLReader.
-    *
-    * <p> Whitespace character content and processing instructions are ignored. </p>
-    *
-    * <p> The return value is one of: START, END, CHARS, EOF. </p>
-    */
-    public int nextContent();
-
-    /**
-     * Return the next state of the XMLReader.
-     *
-     * <p> Whitespace character content, processing instructions are ignored.
-     * Non-whitespace character content triggers an exception. </p>
-     *
-     * <p> The return value is one of: START, END, EOF. </p>
-     */
-    public int nextElementContent();
-
-    /**
-     * Return the current state of the XMLReader.
-     *
-     */
-    public int getState();
-
-    /**
-     * Return the current qualified name.
-     *
-     * <p> Meaningful only when the state is one of: START, END. </p>
-     */
-    public QName getName();
-
-    /**
-     * Return the current URI.
-     *
-     * <p> Meaningful only when the state is one of: START, END. </p>
-     */
-    public String getURI();
-
-    /**
-     * Return the current local name.
-     *
-     * <p> Meaningful only when the state is one of: START, END, PI. </p>
-     */
-    public String getLocalName();
-
-    /**
-     * Return the current attribute list. In the jaxws implementation,
-     * this list also includes namespace declarations.
-     *
-     * <p> Meaningful only when the state is one of: START. </p>
-     *
-     * <p> The returned {@link Attributes} object belong to the XMLReader and is
-     * only guaranteed to be valid until the {@link #next} method is called,
-     * directly or indirectly.</p>
-     */
-    public Attributes getAttributes();
-
-    /**
-     * Return the current value.
-     *
-     * <p> Meaningful only when the state is one of: CHARS, PI. </p>
-     */
-    public String getValue();
-
-    /**
-     * Return the current element ID.
-     */
-    public int getElementId();
-
-    /**
-     * Return the current line number.
-     *
-     * <p> Due to aggressive parsing, this value may be off by a few lines. </p>
-     */
-    public int getLineNumber();
-
-    /**
-     * Return the URI for the given prefix.
-     *
-     * <p> If there is no namespace declaration in scope for the given
-     * prefix, return null. </p>
-     */
-    public String getURI(String prefix);
-
-    /**
-     * Return an iterator on all prefixes in scope, except for the default prefix.
-     *
-     */
-    public Iterator getPrefixes();
-
-    /**
-     * Records the current element and leaves the reader positioned on its end tag.
-     *
-     * <p> The XMLReader must be positioned on the start tag of the element.
-     * The returned reader will play back all events starting with the
-     * start tag of the element and ending with its end tag. </p>
-     */
-    public XMLReader recordElement();
-
-    /**
-     * Skip all nodes up to the end tag of the element with the current element ID.
-     */
-    public void skipElement();
-
-    /**
-     * Skip all nodes up to the end tag of the element with the given element ID.
-     */
-    public void skipElement(int elementId);
-
-    /**
-     * Close the XMLReader.
-     *
-     * <p> All subsequent calls to {@link #next} will return EOF. </p>
-     */
-    public void close();
-}
--- a/src/share/classes/com/sun/xml/internal/ws/transport/http/client/HttpClientTransport.java	Thu Aug 06 00:33:48 2009 +0100
+++ b/src/share/classes/com/sun/xml/internal/ws/transport/http/client/HttpClientTransport.java	Thu Aug 06 01:34:10 2009 +0100
@@ -349,7 +349,7 @@
      * is kept in memory. This wraps the ChunkedOuputStream so that it writes only small
      * chunks.
      */
-    private static final class WSChunkedOuputStream extends OutputStream {
+    private static final class WSChunkedOuputStream extends FilterOutputStream {
         final int chunkSize;
 
         WSChunkedOuputStream(OutputStream actual, int chunkSize) {
--- a/src/share/classes/com/sun/xml/internal/ws/transport/http/server/ServerConnectionImpl.java	Thu Aug 06 00:33:48 2009 +0100
+++ b/src/share/classes/com/sun/xml/internal/ws/transport/http/server/ServerConnectionImpl.java	Thu Aug 06 01:34:10 2009 +0100
@@ -30,11 +30,15 @@
 import com.sun.net.httpserver.HttpExchange;
 import com.sun.net.httpserver.HttpsExchange;
 import com.sun.xml.internal.ws.api.message.Packet;
+import com.sun.xml.internal.ws.api.server.PortAddressResolver;
 import com.sun.xml.internal.ws.api.server.WSEndpoint;
 import com.sun.xml.internal.ws.api.server.WebServiceContextDelegate;
+import com.sun.xml.internal.ws.developer.JAXWSProperties;
+import com.sun.xml.internal.ws.resources.WsservletMessages;
 import com.sun.xml.internal.ws.transport.http.HttpAdapter;
 import com.sun.xml.internal.ws.transport.http.WSHTTPConnection;
 
+import javax.xml.ws.WebServiceException;
 import javax.xml.ws.handler.MessageContext;
 import java.io.*;
 import java.net.URI;