feat(jdk8): move files to new folder to avoid resources compiled.
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.ws.developer;
|
||||
|
||||
import com.sun.xml.internal.ws.api.BindingID;
|
||||
|
||||
import javax.xml.ws.WebServiceFeature;
|
||||
|
||||
import com.sun.org.glassfish.gmbal.ManagedAttribute;
|
||||
import com.sun.org.glassfish.gmbal.ManagedData;
|
||||
|
||||
/**
|
||||
* Using this feature, the application could override the binding used by
|
||||
* the runtime(usually determined from WSDL).
|
||||
*
|
||||
* @author Jitendra Kotamraju
|
||||
*/
|
||||
@ManagedData
|
||||
public final class BindingTypeFeature extends WebServiceFeature {
|
||||
|
||||
public static final String ID = "http://jax-ws.dev.java.net/features/binding";
|
||||
|
||||
private final String bindingId;
|
||||
|
||||
public BindingTypeFeature(String bindingId) {
|
||||
this.bindingId = bindingId;
|
||||
}
|
||||
|
||||
@ManagedAttribute
|
||||
public String getID() {
|
||||
return ID;
|
||||
}
|
||||
|
||||
@ManagedAttribute
|
||||
public String getBindingId() {
|
||||
return bindingId;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Oracle and/or its affiliates. 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.ws.developer;
|
||||
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
/**
|
||||
* Simple utility ensuring that the value is cached only in case it is non-internal implementation
|
||||
*/
|
||||
abstract class ContextClassloaderLocal<V> {
|
||||
|
||||
private static final String FAILED_TO_CREATE_NEW_INSTANCE = "FAILED_TO_CREATE_NEW_INSTANCE";
|
||||
|
||||
private WeakHashMap<ClassLoader, V> CACHE = new WeakHashMap<ClassLoader, V>();
|
||||
|
||||
public V get() throws Error {
|
||||
ClassLoader tccl = getContextClassLoader();
|
||||
V instance = CACHE.get(tccl);
|
||||
if (instance == null) {
|
||||
instance = createNewInstance();
|
||||
CACHE.put(tccl, instance);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void set(V instance) {
|
||||
CACHE.put(getContextClassLoader(), instance);
|
||||
}
|
||||
|
||||
protected abstract V initialValue() throws Exception;
|
||||
|
||||
private V createNewInstance() {
|
||||
try {
|
||||
return initialValue();
|
||||
} catch (Exception e) {
|
||||
throw new Error(format(FAILED_TO_CREATE_NEW_INSTANCE, getClass().getName()), e);
|
||||
}
|
||||
}
|
||||
|
||||
private static String format(String property, Object... args) {
|
||||
String text = ResourceBundle.getBundle(ContextClassloaderLocal.class.getName()).getString(property);
|
||||
return MessageFormat.format(text, args);
|
||||
}
|
||||
|
||||
private static ClassLoader getContextClassLoader() {
|
||||
return (ClassLoader)
|
||||
AccessController.doPrivileged(new PrivilegedAction() {
|
||||
public Object run() {
|
||||
ClassLoader cl = null;
|
||||
try {
|
||||
cl = Thread.currentThread().getContextClassLoader();
|
||||
} catch (SecurityException ex) {
|
||||
}
|
||||
return cl;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
132
jdkSrc/jdk8/com/sun/xml/internal/ws/developer/EPRRecipe.java
Normal file
132
jdkSrc/jdk8/com/sun/xml/internal/ws/developer/EPRRecipe.java
Normal file
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.ws.developer;
|
||||
|
||||
import com.sun.istack.internal.NotNull;
|
||||
import com.sun.xml.internal.ws.api.message.Header;
|
||||
import com.sun.xml.internal.ws.api.message.Headers;
|
||||
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.ws.EndpointReference;
|
||||
import javax.xml.ws.wsaddressing.W3CEndpointReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Represents additional data to be added to EPRs
|
||||
* created from {@link StatefulWebServiceManager} (for advanced users).
|
||||
*
|
||||
* <p>
|
||||
* Occasionally it is convenient to be able to control the data to be
|
||||
* present on {@link EndpointReference}s created by {@link StatefulWebServiceManager}.
|
||||
* You can do so by using this class like this:
|
||||
*
|
||||
* <pre>
|
||||
* statefulWebServiceManager.export({@link W3CEndpointReference}.class,myObject,
|
||||
* new EPRRecipe().addReferenceParameter({@link Headers}.create(...))
|
||||
* .addReferenceParameter({@link Headers}.create(...)));
|
||||
* </pre>
|
||||
*
|
||||
* <p>
|
||||
* The methods on this class follows <a href="http://www.martinfowler.com/bliki/FluentInterface.html">
|
||||
* the fluent interface design</a> to allow construction without using a variable.
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* See <a href="http://www.w3.org/TR/2006/REC-ws-addr-core-20060509/#eprinfomodel">
|
||||
* WS-Addressing EPR information model</a> for more details.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @since 2.1.1
|
||||
* @see StatefulWebServiceManager
|
||||
* @see Headers
|
||||
*/
|
||||
public final class EPRRecipe {
|
||||
private final List<Header> referenceParameters = new ArrayList<Header>();
|
||||
private final List<Source> metadata = new ArrayList<Source>();
|
||||
|
||||
/**
|
||||
* Gets all the reference parameters added so far.
|
||||
*/
|
||||
public @NotNull List<Header> getReferenceParameters() {
|
||||
return referenceParameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all the metadata added so far.
|
||||
*/
|
||||
public @NotNull List<Source> getMetadata() {
|
||||
return metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new reference parameter.
|
||||
*/
|
||||
public EPRRecipe addReferenceParameter(Header h) {
|
||||
if(h==null) throw new IllegalArgumentException();
|
||||
referenceParameters.add(h);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds all the headers as reference parameters.
|
||||
*/
|
||||
public EPRRecipe addReferenceParameters(Header... headers) {
|
||||
for (Header h : headers)
|
||||
addReferenceParameter(h);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds all the headers as reference parameters.
|
||||
*/
|
||||
public EPRRecipe addReferenceParameters(Iterable<? extends Header> headers) {
|
||||
for (Header h : headers)
|
||||
addReferenceParameter(h);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new metadata.
|
||||
*/
|
||||
public EPRRecipe addMetadata(Source source) {
|
||||
if(source==null) throw new IllegalArgumentException();
|
||||
metadata.add(source);
|
||||
return this;
|
||||
}
|
||||
|
||||
public EPRRecipe addMetadata(Source... sources) {
|
||||
for (Source s : sources)
|
||||
addMetadata(s);
|
||||
return this;
|
||||
}
|
||||
|
||||
public EPRRecipe addMetadata(Iterable<? extends Source> sources) {
|
||||
for (Source s : sources)
|
||||
addMetadata(s);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.ws.developer;
|
||||
|
||||
import javax.xml.ws.WebServiceException;
|
||||
import javax.xml.ws.WebServiceFeature;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.net.CookieHandler;
|
||||
|
||||
/**
|
||||
* A proxy's HTTP configuration (e.g cookie handling) can be configured using
|
||||
* this feature. While creating the proxy, this can be passed just like other
|
||||
* features.
|
||||
*
|
||||
* <p>
|
||||
* <b>THIS feature IS EXPERIMENTAL AND IS SUBJECT TO CHANGE WITHOUT NOTICE IN FUTURE.</b>
|
||||
*
|
||||
* @author Jitendra Kotamraju
|
||||
*/
|
||||
public final class HttpConfigFeature extends WebServiceFeature {
|
||||
/**
|
||||
* Constant value identifying the {@link HttpConfigFeature} feature.
|
||||
*/
|
||||
public static final String ID = "http://jax-ws.java.net/features/http-config";
|
||||
|
||||
private static final Constructor cookieManagerConstructor;
|
||||
private static final Object cookiePolicy;
|
||||
static {
|
||||
Constructor tempConstructor;
|
||||
Object tempPolicy;
|
||||
try {
|
||||
/*
|
||||
* Using reflection to create CookieManger so that RI would continue to
|
||||
* work with JDK 5.
|
||||
*/
|
||||
Class policyClass = Class.forName("java.net.CookiePolicy");
|
||||
Class storeClass = Class.forName("java.net.CookieStore");
|
||||
tempConstructor = Class.forName("java.net.CookieManager").getConstructor(storeClass, policyClass);
|
||||
// JDK's default policy is ACCEPT_ORIGINAL_SERVER, but ACCEPT_ALL
|
||||
// is used for backward compatibility
|
||||
tempPolicy = policyClass.getField("ACCEPT_ALL").get(null);
|
||||
} catch(Exception e) {
|
||||
try {
|
||||
/*
|
||||
* Using reflection so that these classes won't have to be
|
||||
* integrated in JDK 6.
|
||||
*/
|
||||
Class policyClass = Class.forName("com.sun.xml.internal.ws.transport.http.client.CookiePolicy");
|
||||
Class storeClass = Class.forName("com.sun.xml.internal.ws.transport.http.client.CookieStore");
|
||||
tempConstructor = Class.forName("com.sun.xml.internal.ws.transport.http.client.CookieManager").getConstructor(storeClass, policyClass);
|
||||
// JDK's default policy is ACCEPT_ORIGINAL_SERVER, but ACCEPT_ALL
|
||||
// is used for backward compatibility
|
||||
tempPolicy = policyClass.getField("ACCEPT_ALL").get(null);
|
||||
} catch(Exception ce) {
|
||||
throw new WebServiceException(ce);
|
||||
}
|
||||
}
|
||||
cookieManagerConstructor = tempConstructor;
|
||||
cookiePolicy = tempPolicy;
|
||||
}
|
||||
|
||||
private final CookieHandler cookieJar; // shared object among the tubes
|
||||
|
||||
public HttpConfigFeature() {
|
||||
this(getInternalCookieHandler());
|
||||
}
|
||||
|
||||
public HttpConfigFeature(CookieHandler cookieJar) {
|
||||
this.enabled = true;
|
||||
this.cookieJar = cookieJar;
|
||||
}
|
||||
|
||||
private static CookieHandler getInternalCookieHandler() {
|
||||
try {
|
||||
return (CookieHandler)cookieManagerConstructor.newInstance(null, cookiePolicy);
|
||||
} catch(Exception e) {
|
||||
throw new WebServiceException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public String getID() {
|
||||
return ID;
|
||||
}
|
||||
|
||||
public CookieHandler getCookieHandler() {
|
||||
return cookieJar;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.ws.developer;
|
||||
|
||||
import com.sun.istack.internal.NotNull;
|
||||
import com.sun.xml.internal.bind.api.JAXBRIContext;
|
||||
import com.sun.xml.internal.bind.api.TypeReference;
|
||||
import com.sun.xml.internal.ws.api.model.SEIModel;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Factory to create {@link JAXBContext}.
|
||||
*
|
||||
* <p>
|
||||
* JAX-WS uses JAXB to perform databinding when you use the service endpoint interface, and normally
|
||||
* the JAX-WS RI drives JAXB and creates a necessary {@link JAXBContext} automatically.
|
||||
*
|
||||
* <p>
|
||||
* This annotation is a JAX-WS RI vendor-specific feature, which lets applications create {@link JAXBRIContext}
|
||||
* (which is the JAXB RI's {@link JAXBContext} implementation.)
|
||||
* Combined with the JAXB RI vendor extensions defined in {@link JAXBRIContext}, appliation can use this to
|
||||
* fine-tune how the databinding happens, such as by adding more classes to the binding context,
|
||||
* by controlling the namespace mappings, and so on.
|
||||
*
|
||||
* <p>
|
||||
* Applications should either use {@link UsesJAXBContextFeature} or {@link UsesJAXBContext} to instruct
|
||||
* the JAX-WS runtime to use a custom factory.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @since 2.1.5
|
||||
*/
|
||||
public interface JAXBContextFactory {
|
||||
/**
|
||||
* Called by the JAX-WS runtime to create a {@link JAXBRIContext} for the given SEI.
|
||||
*
|
||||
* @param sei
|
||||
* The {@link SEIModel} object being constructed. This object provides you access to
|
||||
* what SEI is being processed, and therefore useful if you are writing a generic
|
||||
* {@link JAXBContextFactory} that can work with arbitrary SEI classes.
|
||||
*
|
||||
* @param classesToBind
|
||||
* List of classes that needs to be bound by JAXB. This value is computed according to
|
||||
* the JAX-WS spec and given to you.
|
||||
*
|
||||
* The calling JAX-WS runtime expects the returned {@link JAXBRIContext} to be capable of
|
||||
* handling all these classes, but you can add more (which is more common), or remove some
|
||||
* (if you know what you are doing.)
|
||||
*
|
||||
* The callee is free to mutate this list.
|
||||
*
|
||||
* @param typeReferences
|
||||
* List of {@link TypeReference}s, which is also a part of the input to the JAXB RI to control
|
||||
* how the databinding happens. Most likely this will be just a pass-through to the
|
||||
* {@link JAXBRIContext#newInstance} method.
|
||||
*
|
||||
* @return
|
||||
* A non-null valid {@link JAXBRIContext} object.
|
||||
*
|
||||
* @throws JAXBException
|
||||
* If the callee encounters a fatal problem and wants to abort the JAX-WS runtime processing
|
||||
* of the given SEI, throw a {@link JAXBException}. This will cause the port instantiation
|
||||
* to fail (if on client), or the application deployment to fail (if on server.)
|
||||
*/
|
||||
@NotNull JAXBRIContext createJAXBContext(@NotNull SEIModel sei, @NotNull List<Class> classesToBind, @NotNull List<TypeReference> typeReferences) throws JAXBException;
|
||||
|
||||
/**
|
||||
* The default implementation that creates {@link JAXBRIContext} according to the standard behavior.
|
||||
*/
|
||||
public static final JAXBContextFactory DEFAULT = new JAXBContextFactory() {
|
||||
@NotNull
|
||||
public JAXBRIContext createJAXBContext(@NotNull SEIModel sei, @NotNull List<Class> classesToBind, @NotNull List<TypeReference> typeReferences) throws JAXBException {
|
||||
return JAXBRIContext.newInstance(classesToBind.toArray(new Class[classesToBind.size()]),
|
||||
typeReferences, null, sei.getTargetNamespace(), false, null);
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,235 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.ws.developer;
|
||||
|
||||
import com.sun.xml.internal.ws.api.message.HeaderList;
|
||||
import com.sun.xml.internal.ws.api.server.WSEndpoint;
|
||||
import com.sun.xml.internal.ws.api.addressing.WSEndpointReference;
|
||||
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import javax.net.ssl.SSLSocketFactory;
|
||||
import javax.xml.ws.BindingProvider;
|
||||
import javax.xml.ws.WebServiceContext;
|
||||
import javax.xml.ws.BindingType;
|
||||
import javax.xml.ws.http.HTTPBinding;
|
||||
import java.net.HttpURLConnection;
|
||||
|
||||
public interface JAXWSProperties {
|
||||
// Content negotiation property: values "none", "pessimistic" and "optimistic"
|
||||
// It is split into two strings so that package renaming for
|
||||
// Java SE 6 doesn't alter the value. So do not combine them
|
||||
@Deprecated
|
||||
public static final String CONTENT_NEGOTIATION_PROPERTY = "com.sun."+"xml.ws.client.ContentNegotiation";
|
||||
public static final String MTOM_THRESHOLOD_VALUE = "com.sun.xml.internal.ws.common.MtomThresholdValue";
|
||||
public static final String HTTP_EXCHANGE = "com.sun.xml.internal.ws.http.exchange";
|
||||
|
||||
/**
|
||||
* Set this property on the {@link BindingProvider#getRequestContext()} to
|
||||
* enable {@link HttpURLConnection#setConnectTimeout(int)}
|
||||
*
|
||||
*<p>
|
||||
* int timeout = ...;
|
||||
* Map<String, Object> ctxt = ((BindingProvider)proxy).getRequestContext();
|
||||
* ctxt.put(CONNECT_TIMEOUT, timeout);
|
||||
*/
|
||||
public static final String CONNECT_TIMEOUT =
|
||||
"com.sun.xml.internal.ws.connect.timeout";
|
||||
|
||||
/**
|
||||
* Set this property on the {@link BindingProvider#getRequestContext()} to
|
||||
* enable {@link HttpURLConnection#setReadTimeout(int)}
|
||||
*
|
||||
*<p>
|
||||
* int timeout = ...;
|
||||
* Map<String, Object> ctxt = ((BindingProvider)proxy).getRequestContext();
|
||||
* ctxt.put(REQUEST_TIMEOUT, timeout);
|
||||
*/
|
||||
public static final String REQUEST_TIMEOUT =
|
||||
"com.sun.xml.internal.ws.request.timeout";
|
||||
|
||||
/**
|
||||
* Set this property on the {@link BindingProvider#getRequestContext()} to
|
||||
* enable {@link HttpURLConnection#setChunkedStreamingMode(int)}
|
||||
*
|
||||
*<p>
|
||||
* int chunkSize = ...;
|
||||
* Map<String, Object> ctxt = ((BindingProvider)proxy).getRequestContext();
|
||||
* ctxt.put(HTTP_CLIENT_STREAMING_CHUNK_SIZE, chunkSize);
|
||||
*/
|
||||
public static final String HTTP_CLIENT_STREAMING_CHUNK_SIZE = "com.sun.xml.internal.ws.transport.http.client.streaming.chunk.size";
|
||||
|
||||
|
||||
/**
|
||||
* Set this property on the {@link BindingProvider#getRequestContext()} to
|
||||
* enable {@link HttpsURLConnection#setHostnameVerifier(HostnameVerifier)}}. The property
|
||||
* is set as follows:
|
||||
*
|
||||
* <p>
|
||||
* HostNameVerifier hostNameVerifier = ...;
|
||||
* Map<String, Object> ctxt = ((BindingProvider)proxy).getRequestContext();
|
||||
* ctxt.put(HOSTNAME_VERIFIER, hostNameVerifier);
|
||||
*
|
||||
* <p>
|
||||
* <b>THIS PROPERTY IS EXPERIMENTAL AND IS SUBJECT TO CHANGE WITHOUT NOTICE IN FUTURE.</b>
|
||||
*/
|
||||
public static final String HOSTNAME_VERIFIER = "com.sun.xml.internal.ws.transport.https.client.hostname.verifier";
|
||||
|
||||
/**
|
||||
* Set this property on the {@link BindingProvider#getRequestContext()} to
|
||||
* enable {@link HttpsURLConnection#setSSLSocketFactory(SSLSocketFactory)}. The property is set
|
||||
* as follows:
|
||||
*
|
||||
* <p>
|
||||
* SSLSocketFactory sslFactory = ...;
|
||||
* Map<String, Object> ctxt = ((BindingProvider)proxy).getRequestContext();
|
||||
* ctxt.put(SSL_SOCKET_FACTORY, sslFactory);
|
||||
*
|
||||
* <p>
|
||||
* <b>THIS PROPERTY IS EXPERIMENTAL AND IS SUBJECT TO CHANGE WITHOUT NOTICE IN FUTURE.</b>
|
||||
*/
|
||||
public static final String SSL_SOCKET_FACTORY = "com.sun.xml.internal.ws.transport.https.client.SSLSocketFactory";
|
||||
|
||||
/**
|
||||
* Acccess the list of SOAP headers in the SOAP message.
|
||||
*
|
||||
* <p>
|
||||
* On {@link WebServiceContext}, this property returns a {@link HeaderList} object
|
||||
* that represents SOAP headers in the request message that was received.
|
||||
* On {@link BindingProvider#getResponseContext()}, this property returns a
|
||||
* {@link HeaderList} object that represents SOAP headers in the response message from the server.
|
||||
*
|
||||
* <p>
|
||||
* The property is read-only, and please do not modify the returned {@link HeaderList}
|
||||
* as that may break the JAX-WS RI in some unexpected way.
|
||||
*
|
||||
* <p>
|
||||
* <b>THIS PROPERTY IS EXPERIMENTAL AND IS SUBJECT TO CHANGE WITHOUT NOTICE IN FUTURE.</b>
|
||||
*/
|
||||
public static final String INBOUND_HEADER_LIST_PROPERTY = "com.sun.xml.internal.ws.api.message.HeaderList";
|
||||
|
||||
/**
|
||||
* Access the {@link WSEndpoint} object that delivered the request.
|
||||
*
|
||||
* <p>
|
||||
* {@link WSEndpoint} is the root of the objects that are together
|
||||
* responsible for delivering requests to the application SEI object.
|
||||
* One can look up this {@link WSEndpoint} from {@link WebServiceContext},
|
||||
* and from there access many parts of the JAX-WS RI runtime.
|
||||
*
|
||||
* <p>
|
||||
* <b>THIS PROPERTY IS EXPERIMENTAL AND IS SUBJECT TO CHANGE WITHOUT NOTICE IN FUTURE.</b>
|
||||
*
|
||||
* @since 2.1.2
|
||||
*/
|
||||
public static final String WSENDPOINT = "com.sun.xml.internal.ws.api.server.WSEndpoint";
|
||||
|
||||
/**
|
||||
* Gets the <tt>wsa:To</tt> header.
|
||||
*
|
||||
* The propery value is available on incoming SOAP message. The type of the value
|
||||
* is {@link WSEndpointReference}.
|
||||
*
|
||||
* Null if the incoming SOAP message didn't have the header.
|
||||
*
|
||||
* @since 2.1.3
|
||||
*/
|
||||
public static final String ADDRESSING_TO = "com.sun.xml.internal.ws.api.addressing.to";
|
||||
|
||||
/**
|
||||
* Gets the <tt>wsa:From</tt> header.
|
||||
*
|
||||
* The propery value is available on incoming SOAP message. The type of the value
|
||||
* is {@link WSEndpointReference}.
|
||||
*
|
||||
* Null if the incoming SOAP message didn't have the header.
|
||||
*
|
||||
* @since 2.1.3
|
||||
*/
|
||||
public static final String ADDRESSING_FROM = "com.sun.xml.internal.ws.api.addressing.from";
|
||||
|
||||
/**
|
||||
* Gets the <tt>wsa:Action</tt> header value.
|
||||
*
|
||||
* The propery value is available on incoming SOAP message. The type of the value
|
||||
* is {@link String}.
|
||||
*
|
||||
* Null if the incoming SOAP message didn't have the header.
|
||||
*
|
||||
* @since 2.1.3
|
||||
*/
|
||||
public static final String ADDRESSING_ACTION = "com.sun.xml.internal.ws.api.addressing.action";
|
||||
|
||||
/**
|
||||
* Gets the <tt>wsa:MessageID</tt> header value.
|
||||
*
|
||||
* The propery value is available on incoming SOAP message. The type of the value
|
||||
* is {@link String}.
|
||||
*
|
||||
* Null if the incoming SOAP message didn't have the header.
|
||||
*
|
||||
* @since 2.1.3
|
||||
*/
|
||||
public static final String ADDRESSING_MESSAGEID = "com.sun.xml.internal.ws.api.addressing.messageId";
|
||||
|
||||
/**
|
||||
* Reconstructs the URL the client used to make the request. The returned URL
|
||||
* contains a protocol, server name, port number, and server path, but it does
|
||||
* not include query string parameters.
|
||||
* <p>
|
||||
* The property value is available on incoming SOAP message on servlet transport.
|
||||
*
|
||||
* @since 2.1.3
|
||||
*/
|
||||
public static final String HTTP_REQUEST_URL = "com.sun.xml.internal.ws.transport.http.servlet.requestURL";
|
||||
|
||||
/**
|
||||
* Binding to represent RESTful services. {@link HTTPBinding#HTTP_BINDING} works
|
||||
* only for Dispatch/Provider services, but this binding works with even SEI based
|
||||
* services. It would be XML, NOT SOAP on the wire. Hence, the SEI parameters
|
||||
* shouldn't be mapped to headers.
|
||||
*
|
||||
* <p>
|
||||
* Note that, this only solves limited RESTful usecases.
|
||||
*
|
||||
* <p>To enable restful binding on the service, specify the binding id via
|
||||
* {@link BindingType} or DD
|
||||
* <pre>
|
||||
* @WebService
|
||||
* @BindingType(JAXWSProperties.REST_BINDING)
|
||||
* </pre>
|
||||
*
|
||||
* <p>To enable restful binding on the client side, specify the binding id via
|
||||
* {@link BindingTypeFeature}
|
||||
* <pre>
|
||||
* proxy = echoImplService.getEchoImplPort(new BindingTypeFeature(JAXWSProperties.REST_BINDING));
|
||||
* </pre>
|
||||
*
|
||||
* @since 2.1.4
|
||||
*/
|
||||
public static final String REST_BINDING = "http://jax-ws.dev.java.net/rest";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.ws.developer;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
import javax.xml.ws.spi.WebServiceFeatureAnnotation;
|
||||
|
||||
/**
|
||||
* This feature represents the use of WS-Addressing with either
|
||||
* the SOAP 1.1/HTTP or SOAP 1.2/HTTP binding. Using this feature
|
||||
* with any other binding is NOT required.
|
||||
* <p>
|
||||
* Enabling this feature will result in the
|
||||
* <code>wsaw:UsingAddressing</code> element being added to the
|
||||
* <code>wsdl:Binding</code> for
|
||||
* the endpoint and in the runtime being capable of responding to
|
||||
* WS-Addressing headers.
|
||||
* <p>
|
||||
* The following describes the affects of this feature with respect
|
||||
* to be enabled or disabled:
|
||||
* <ul>
|
||||
* <li> ENABLED: In this Mode, Addressing will be enabled.
|
||||
* If there is not a WSDL associated with the Endpoint and
|
||||
* a WSDL is to be generated, it MUST be generated with the
|
||||
* wsaw:UsingAddressing element. At runtime, Addressing headers
|
||||
* MUST be consumed by the receiver and generated by the
|
||||
* sender even if the WSDL declares otherwise. The
|
||||
* mustUnderstand="0" attribute MUST be used on the Addressing
|
||||
* headers.
|
||||
* <li> DISABLED: In this Mode, Addressing will be disabled
|
||||
* even if an associated WSDL specifies otherwise. At runtime,
|
||||
* Addressing headers MUST NOT be used.
|
||||
* </ul>
|
||||
* <p>
|
||||
* The {@link #required} property can be used to
|
||||
* specify if the <code>required</code> attribute on the
|
||||
* <code>wsaw:UsingAddressing</code> element should
|
||||
* be <code>true</code> or <code>false</code>. By default the
|
||||
* <code>wsdl:required</code> parameter is <code>false</code>.
|
||||
*
|
||||
* See <a href="http://www.w3.org/TR/2006/REC-ws-addr-core-20060509/">WS-Addressing</a>
|
||||
* for more information on WS-Addressing.
|
||||
* See <a href="http://www.w3.org/TR/2006/CR-ws-addr-wsdl-20060529/">WS-Addressing - WSDL 1.0
|
||||
* </a> for more information on <code>wsaw:UsingAddressing</code>.
|
||||
*
|
||||
* @since JAX-WS 2.1
|
||||
*/
|
||||
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@WebServiceFeatureAnnotation(id= MemberSubmissionAddressingFeature.ID,bean=MemberSubmissionAddressingFeature.class)
|
||||
public @interface MemberSubmissionAddressing {
|
||||
/**
|
||||
* Specifies if this feature is enabled or disabled.
|
||||
*/
|
||||
boolean enabled() default true;
|
||||
|
||||
/**
|
||||
* Property to determine the value of the
|
||||
* <code>wsdl:required</code> attribute on
|
||||
* <code>wsaw:UsingAddressing</code> element in the WSDL.
|
||||
*/
|
||||
boolean required() default false;
|
||||
|
||||
/**
|
||||
* Property to determine if the incoming messsages should be checked for conformance
|
||||
* with MemberSubmission version of WS-Addressing.
|
||||
*
|
||||
* If Validation.LAX, then some WS-Adressing headers are not strictly checked.
|
||||
*/
|
||||
public enum Validation { LAX, STRICT }
|
||||
|
||||
Validation validation() default Validation.LAX;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.ws.developer;
|
||||
|
||||
import com.sun.xml.internal.ws.api.FeatureConstructor;
|
||||
|
||||
import javax.xml.ws.WebServiceFeature;
|
||||
|
||||
import com.sun.org.glassfish.gmbal.ManagedAttribute;
|
||||
import com.sun.org.glassfish.gmbal.ManagedData;
|
||||
|
||||
|
||||
/**
|
||||
* Addressing Feature representing MemberSubmission Version.
|
||||
*
|
||||
* @author Rama Pulavarthi
|
||||
*/
|
||||
|
||||
@ManagedData
|
||||
public class MemberSubmissionAddressingFeature extends WebServiceFeature {
|
||||
/**
|
||||
* Constant value identifying the MemberSubmissionAddressingFeature
|
||||
*/
|
||||
public static final String ID = "http://java.sun.com/xml/ns/jaxws/2004/08/addressing";
|
||||
|
||||
/**
|
||||
* Constant ID for the <code>required</code> feature parameter
|
||||
*/
|
||||
public static final String IS_REQUIRED = "ADDRESSING_IS_REQUIRED";
|
||||
|
||||
private boolean required;
|
||||
|
||||
/**
|
||||
* Create an MemberSubmissionAddressingFeature
|
||||
* The instance created will be enabled.
|
||||
*/
|
||||
public MemberSubmissionAddressingFeature() {
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an MemberSubmissionAddressingFeature
|
||||
*
|
||||
* @param enabled specifies whether this feature should
|
||||
* be enabled or not.
|
||||
*/
|
||||
public MemberSubmissionAddressingFeature(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an <code>MemberSubmissionAddressingFeature</code>
|
||||
*
|
||||
* @param enabled specifies whether this feature should
|
||||
* be enabled or not.
|
||||
* @param required specifies the value that will be used
|
||||
* for the <code>required</code> attribute on the
|
||||
* <code>wsaw:UsingAddressing</code> element.
|
||||
*/
|
||||
public MemberSubmissionAddressingFeature(boolean enabled, boolean required) {
|
||||
this.enabled = enabled;
|
||||
this.required = required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an <code>MemberSubmissionAddressingFeature</code>
|
||||
*
|
||||
* @param enabled specifies whether this feature should
|
||||
* be enabled or not.
|
||||
* @param required specifies the value that will be used
|
||||
* for the <code>required</code> attribute on the
|
||||
* <code>wsaw:UsingAddressing</code> element.
|
||||
* @param validation specifies the value that will be used
|
||||
* for validation for the incoming messages. If LAX, messages are not strictly checked for conformance with the spec.
|
||||
*/
|
||||
@FeatureConstructor({"enabled","required","validation"})
|
||||
public MemberSubmissionAddressingFeature(boolean enabled, boolean required, MemberSubmissionAddressing.Validation validation) {
|
||||
this.enabled = enabled;
|
||||
this.required = required;
|
||||
this.validation = validation;
|
||||
}
|
||||
|
||||
|
||||
@ManagedAttribute
|
||||
public String getID() {
|
||||
return ID;
|
||||
}
|
||||
|
||||
@ManagedAttribute
|
||||
public boolean isRequired() {
|
||||
return required;
|
||||
}
|
||||
|
||||
public void setRequired(boolean required) {
|
||||
this.required = required;
|
||||
}
|
||||
|
||||
private MemberSubmissionAddressing.Validation validation = MemberSubmissionAddressing.Validation.LAX;
|
||||
public void setValidation(MemberSubmissionAddressing.Validation validation) {
|
||||
this.validation = validation;
|
||||
|
||||
}
|
||||
|
||||
@ManagedAttribute
|
||||
public MemberSubmissionAddressing.Validation getValidation() {
|
||||
return validation;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,209 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.ws.developer;
|
||||
|
||||
import com.sun.istack.internal.NotNull;
|
||||
import com.sun.xml.internal.ws.addressing.v200408.MemberSubmissionAddressingConstants;
|
||||
import com.sun.xml.internal.ws.wsdl.parser.WSDLConstants;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.Marshaller;
|
||||
import javax.xml.bind.Unmarshaller;
|
||||
import javax.xml.bind.annotation.XmlAnyAttribute;
|
||||
import javax.xml.bind.annotation.XmlAnyElement;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.bind.annotation.XmlValue;
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.transform.Result;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.ws.EndpointReference;
|
||||
import javax.xml.ws.WebServiceException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Data model for Member Submission WS-Addressing specification. This is modeled after the
|
||||
* member submission schema at:
|
||||
*
|
||||
* http://schemas.xmlsoap.org/ws/2004/08/addressing/
|
||||
*
|
||||
* @author Kathy Walsh
|
||||
* @author Vivek Pandey
|
||||
*/
|
||||
|
||||
@XmlRootElement(name = "EndpointReference", namespace = MemberSubmissionEndpointReference.MSNS)
|
||||
@XmlType(name = "EndpointReferenceType", namespace = MemberSubmissionEndpointReference.MSNS)
|
||||
public final class MemberSubmissionEndpointReference extends EndpointReference implements MemberSubmissionAddressingConstants {
|
||||
|
||||
private final static ContextClassloaderLocal<JAXBContext> msjc = new ContextClassloaderLocal<JAXBContext>() {
|
||||
@Override
|
||||
protected JAXBContext initialValue() throws Exception {
|
||||
return MemberSubmissionEndpointReference.getMSJaxbContext();
|
||||
}
|
||||
};
|
||||
|
||||
public MemberSubmissionEndpointReference() {
|
||||
}
|
||||
|
||||
/**
|
||||
* construct an EPR from infoset representation
|
||||
*
|
||||
* @param source A source object containing valid XmlInfoset
|
||||
* instance consistent with the Member Submission WS-Addressing
|
||||
* @throws javax.xml.ws.WebServiceException
|
||||
* if the source does not contain a valid W3C WS-Addressing
|
||||
* EndpointReference.
|
||||
* @throws WebServiceException if the <code>null</code> <code>source</code> value is given
|
||||
*/
|
||||
public MemberSubmissionEndpointReference(@NotNull Source source) {
|
||||
|
||||
if (source == null) {
|
||||
throw new WebServiceException("Source parameter can not be null on constructor");
|
||||
}
|
||||
|
||||
try {
|
||||
Unmarshaller unmarshaller = MemberSubmissionEndpointReference.msjc.get().createUnmarshaller();
|
||||
MemberSubmissionEndpointReference epr = unmarshaller.unmarshal(source,MemberSubmissionEndpointReference.class).getValue();
|
||||
|
||||
this.addr = epr.addr;
|
||||
this.referenceProperties = epr.referenceProperties;
|
||||
this.referenceParameters = epr.referenceParameters;
|
||||
this.portTypeName = epr.portTypeName;
|
||||
this.serviceName = epr.serviceName;
|
||||
this.attributes = epr.attributes;
|
||||
this.elements = epr.elements;
|
||||
} catch (JAXBException e) {
|
||||
throw new WebServiceException("Error unmarshalling MemberSubmissionEndpointReference ", e);
|
||||
} catch (ClassCastException e) {
|
||||
throw new WebServiceException("Source did not contain MemberSubmissionEndpointReference", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(Result result) {
|
||||
try {
|
||||
Marshaller marshaller = MemberSubmissionEndpointReference.msjc.get().createMarshaller();
|
||||
//marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
|
||||
marshaller.marshal(this, result);
|
||||
} catch (JAXBException e) {
|
||||
throw new WebServiceException("Error marshalling W3CEndpointReference. ", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Source containing the wsdl from the MemberSubmissionEndpointReference
|
||||
*
|
||||
* @return Source A source object containing the wsdl in the MemeberSubmissionEndpointReference, if present.
|
||||
*/
|
||||
public Source toWSDLSource() {
|
||||
Element wsdlElement = null;
|
||||
|
||||
for (Element elem : elements) {
|
||||
if (elem.getNamespaceURI().equals(WSDLConstants.NS_WSDL) &&
|
||||
elem.getLocalName().equals(WSDLConstants.QNAME_DEFINITIONS.getLocalPart())) {
|
||||
wsdlElement = elem;
|
||||
}
|
||||
}
|
||||
|
||||
return new DOMSource(wsdlElement);
|
||||
}
|
||||
|
||||
|
||||
private static JAXBContext getMSJaxbContext() {
|
||||
try {
|
||||
return JAXBContext.newInstance(MemberSubmissionEndpointReference.class);
|
||||
} catch (JAXBException e) {
|
||||
throw new WebServiceException("Error creating JAXBContext for MemberSubmissionEndpointReference. ", e);
|
||||
}
|
||||
}
|
||||
|
||||
@XmlElement(name = "Address", namespace = MemberSubmissionEndpointReference.MSNS)
|
||||
public Address addr;
|
||||
|
||||
@XmlElement(name = "ReferenceProperties", namespace = MemberSubmissionEndpointReference.MSNS)
|
||||
public Elements referenceProperties;
|
||||
|
||||
@XmlElement(name = "ReferenceParameters", namespace = MemberSubmissionEndpointReference.MSNS)
|
||||
public Elements referenceParameters;
|
||||
|
||||
@XmlElement(name = "PortType", namespace = MemberSubmissionEndpointReference.MSNS)
|
||||
public AttributedQName portTypeName;
|
||||
|
||||
@XmlElement(name = "ServiceName", namespace = MemberSubmissionEndpointReference.MSNS)
|
||||
public ServiceNameType serviceName;
|
||||
|
||||
@XmlAnyAttribute
|
||||
public Map<QName,String> attributes;
|
||||
|
||||
@XmlAnyElement
|
||||
public List<Element> elements;
|
||||
|
||||
@XmlType(name="address", namespace=MemberSubmissionEndpointReference.MSNS)
|
||||
public static class Address {
|
||||
public Address() {
|
||||
}
|
||||
|
||||
@XmlValue
|
||||
public String uri;
|
||||
@XmlAnyAttribute
|
||||
public Map<QName, String> attributes;
|
||||
}
|
||||
|
||||
@XmlType(name="elements", namespace=MemberSubmissionEndpointReference.MSNS)
|
||||
public static class Elements {
|
||||
public Elements() {}
|
||||
|
||||
@XmlAnyElement
|
||||
public List<Element> elements;
|
||||
}
|
||||
|
||||
|
||||
public static class AttributedQName {
|
||||
public AttributedQName() {
|
||||
}
|
||||
|
||||
@XmlValue
|
||||
public QName name;
|
||||
@XmlAnyAttribute
|
||||
public Map<QName, String> attributes;
|
||||
}
|
||||
|
||||
public static class ServiceNameType extends AttributedQName{
|
||||
public ServiceNameType() {
|
||||
}
|
||||
|
||||
@XmlAttribute(name="PortName")
|
||||
public String portName;
|
||||
}
|
||||
|
||||
protected static final String MSNS = "http://schemas.xmlsoap.org/ws/2004/08/addressing";
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.ws.developer;
|
||||
|
||||
import com.sun.xml.internal.ws.server.DraconianValidationErrorHandler;
|
||||
|
||||
import javax.jws.WebService;
|
||||
import javax.xml.ws.spi.WebServiceFeatureAnnotation;
|
||||
import java.lang.annotation.Documented;
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
import java.lang.annotation.Retention;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
||||
/**
|
||||
* Validates all request and response messages payload(SOAP:Body) for a {@link WebService}
|
||||
* against the XML schema. To use this feature, annotate the endpoint class with
|
||||
* this annotation.
|
||||
*
|
||||
* <pre>
|
||||
* for e.g.:
|
||||
*
|
||||
* @WebService
|
||||
* @SchemaValidation
|
||||
* public class HelloImpl {
|
||||
* ...
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* At present, schema validation works for doc/lit web services only.
|
||||
*
|
||||
* @since JAX-WS 2.1.3
|
||||
* @author Jitendra Kotamraju
|
||||
* @see SchemaValidationFeature
|
||||
*/
|
||||
@Retention(RUNTIME)
|
||||
@Target({TYPE, ElementType.METHOD, ElementType.FIELD})
|
||||
@Documented
|
||||
@WebServiceFeatureAnnotation(id = SchemaValidationFeature.ID, bean = SchemaValidationFeature.class)
|
||||
public @interface SchemaValidation {
|
||||
|
||||
/**
|
||||
* Configure the validation behaviour w.r.t error handling. The default handler
|
||||
* just rejects any invalid schema intances. If the application want to change
|
||||
* this default behaviour(say just log the errors), it can do so by providing
|
||||
* a custom implementation of {@link ValidationErrorHandler}.
|
||||
*/
|
||||
Class<? extends ValidationErrorHandler> handler() default DraconianValidationErrorHandler.class;
|
||||
|
||||
/**
|
||||
* Turns validation on/off for inbound messages
|
||||
*
|
||||
* @since JAX-WS RI 2.2.2
|
||||
*/
|
||||
boolean inbound() default true;
|
||||
|
||||
|
||||
/**
|
||||
* Turns validation on/off for outbound messages
|
||||
*
|
||||
* @since JAX-WS RI 2.2.2
|
||||
*/
|
||||
boolean outbound() default true;
|
||||
|
||||
/**
|
||||
* Does validation for bound headers in a SOAP message.
|
||||
*
|
||||
boolean headers() default false;
|
||||
*/
|
||||
|
||||
/**
|
||||
* Additional schema documents that are used to create {@link Schema} object. Useful
|
||||
* when the application adds additional SOAP headers to the message. This is a list
|
||||
* of system-ids, that are used to create {@link Source} objects and used in creation
|
||||
* of {@link Schema} object
|
||||
*
|
||||
* for e.g.:
|
||||
* @SchemaValidation(schemaLocations={"http://bar.foo/b.xsd", "http://foo.bar/a.xsd"}
|
||||
*
|
||||
String[] schemaLocations() default {};
|
||||
*/
|
||||
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.ws.developer;
|
||||
|
||||
import com.sun.xml.internal.ws.api.FeatureConstructor;
|
||||
import com.sun.xml.internal.ws.server.DraconianValidationErrorHandler;
|
||||
|
||||
import javax.xml.ws.WebServiceFeature;
|
||||
|
||||
import com.sun.org.glassfish.gmbal.ManagedAttribute;
|
||||
import com.sun.org.glassfish.gmbal.ManagedData;
|
||||
|
||||
/**
|
||||
* {@link WebServiceFeature} for schema validation.
|
||||
*
|
||||
* @since JAX-WS 2.1.3
|
||||
* @author Jitendra Kotamraju
|
||||
* @see SchemaValidation
|
||||
*/
|
||||
@ManagedData
|
||||
public class SchemaValidationFeature extends WebServiceFeature {
|
||||
/**
|
||||
* Constant value identifying the SchemaValidationFeature
|
||||
*/
|
||||
public static final String ID = "http://jax-ws.dev.java.net/features/schema-validation";
|
||||
|
||||
private final Class<? extends ValidationErrorHandler> clazz;
|
||||
private final boolean inbound;
|
||||
private final boolean outbound;
|
||||
|
||||
public SchemaValidationFeature() {
|
||||
this(true, true, DraconianValidationErrorHandler.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an <code>SchemaValidationFeature</code>.
|
||||
* The instance created will be enabled.
|
||||
*/
|
||||
public SchemaValidationFeature(Class<? extends ValidationErrorHandler> clazz) {
|
||||
this(true, true, clazz);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since JAX-WS RI 2.2.2
|
||||
*/
|
||||
public SchemaValidationFeature(boolean inbound, boolean outbound) {
|
||||
this(inbound, outbound, DraconianValidationErrorHandler.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since JAX-WS RI 2.2.2
|
||||
*/
|
||||
@FeatureConstructor({"inbound", "outbound", "handler"})
|
||||
public SchemaValidationFeature(boolean inbound, boolean outbound, Class<? extends ValidationErrorHandler> clazz) {
|
||||
this.enabled = true;
|
||||
this.inbound = inbound;
|
||||
this.outbound = outbound;
|
||||
this.clazz = clazz;
|
||||
}
|
||||
|
||||
@ManagedAttribute
|
||||
@Override
|
||||
public String getID() {
|
||||
return ID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invalid schema instances are rejected, a SOAP fault message is created
|
||||
* for any invalid request and response message. If it is set to false, schema
|
||||
* validation messages are just logged.
|
||||
*/
|
||||
@ManagedAttribute
|
||||
public Class<? extends ValidationErrorHandler> getErrorHandler() {
|
||||
return clazz;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns validation on/off for inbound messages
|
||||
*
|
||||
* @since JAX-WS RI 2.2.2
|
||||
*/
|
||||
public boolean isInbound() {
|
||||
return inbound;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns validation on/off for outbound messages
|
||||
*
|
||||
* @since JAX-WS RI 2.2.2
|
||||
*/
|
||||
public boolean isOutbound() {
|
||||
return outbound;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.ws.developer;
|
||||
|
||||
import javax.xml.ws.spi.WebServiceFeatureAnnotation;
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
/**
|
||||
* Configures various aspects of serialization like encoding
|
||||
*
|
||||
* <pre>
|
||||
* for e.g.:
|
||||
*
|
||||
* @WebService
|
||||
* @Serialization(encoding="Shift_JIS")
|
||||
* public class HelloImpl {
|
||||
* ...
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @since JAX-WS RI 2.2.6
|
||||
* @author Jitendra Kotamraju
|
||||
* @see com.sun.xml.internal.ws.developer.SerializationFeature
|
||||
*/
|
||||
@Retention(RUNTIME)
|
||||
@Target({TYPE, ElementType.METHOD, ElementType.FIELD})
|
||||
@Documented
|
||||
@WebServiceFeatureAnnotation(id = SerializationFeature.ID, bean = SerializationFeature.class)
|
||||
public @interface Serialization {
|
||||
|
||||
/**
|
||||
* Turns validation on/off for inbound messages
|
||||
*
|
||||
* @since JAX-WS RI 2.2.6
|
||||
*/
|
||||
String encoding() default "";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.ws.developer;
|
||||
|
||||
import com.sun.xml.internal.ws.api.FeatureConstructor;
|
||||
|
||||
import javax.xml.ws.WebServiceFeature;
|
||||
|
||||
/**
|
||||
* {@link javax.xml.ws.WebServiceFeature} for configuration serialization.
|
||||
*
|
||||
* @since JAX-WS RI 2.2.6
|
||||
* @author Jitendra Kotamraju
|
||||
* @see com.sun.xml.internal.ws.developer.Serialization
|
||||
*/
|
||||
public class SerializationFeature extends WebServiceFeature {
|
||||
/**
|
||||
* Constant value identifying this feature
|
||||
*/
|
||||
public static final String ID = "http://jax-ws.java.net/features/serialization";
|
||||
private final String encoding;
|
||||
|
||||
public SerializationFeature() {
|
||||
this("");
|
||||
}
|
||||
|
||||
@FeatureConstructor({"encoding"})
|
||||
public SerializationFeature(String encoding) {
|
||||
this.encoding = encoding;
|
||||
}
|
||||
|
||||
public String getID() {
|
||||
return ID;
|
||||
}
|
||||
|
||||
public String getEncoding() {
|
||||
return encoding;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.ws.developer;
|
||||
|
||||
/**
|
||||
* Represents the exception that has occurred on the server side.
|
||||
*
|
||||
* <p>
|
||||
* When an exception occurs on the server, JAX-WS RI sends the stack
|
||||
* trace of that exception to the client. On the client side,
|
||||
* instances of this class are used to represent such stack trace.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @since 2.1
|
||||
*/
|
||||
public class ServerSideException extends Exception {
|
||||
private final String className;
|
||||
|
||||
public ServerSideException(String className, String message) {
|
||||
super(message);
|
||||
this.className = className;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return "Client received an exception from server: "
|
||||
+ super.getMessage()
|
||||
+ " Please see the server log to find more detail regarding exact cause of the failure.";
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
String s = className;
|
||||
String message = getLocalizedMessage();
|
||||
return (message != null) ? (s + ": " + message) : s;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.ws.developer;
|
||||
|
||||
import javax.xml.ws.spi.WebServiceFeatureAnnotation;
|
||||
import java.lang.annotation.*;
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* This feature represents the use of StreamingAttachment attachments with a
|
||||
* web service.
|
||||
*
|
||||
* <p>
|
||||
* for e.g.: To keep all MIME attachments in memory, do the following
|
||||
*
|
||||
* <pre>
|
||||
* @WebService
|
||||
* @MIME(memoryThreshold=-1L)
|
||||
* public class HelloService {
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* @see StreamingAttachmentFeature
|
||||
*
|
||||
* @author Jitendra Kotamraju
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
|
||||
@Documented
|
||||
@WebServiceFeatureAnnotation(id = StreamingAttachmentFeature.ID, bean = StreamingAttachmentFeature.class)
|
||||
public @interface StreamingAttachment {
|
||||
|
||||
/**
|
||||
* Directory in which large attachments are stored. {@link File#createTempFile}
|
||||
* methods are used to create temp files for storing attachments. This
|
||||
* value is used in {@link File#createTempFile}, if specified. If a file
|
||||
* cannot be created in this dir, then all the content is kept in memory.
|
||||
*/
|
||||
String dir() default "";
|
||||
|
||||
/**
|
||||
* MIME message is parsed eagerly.
|
||||
*/
|
||||
boolean parseEagerly() default false;
|
||||
|
||||
/**
|
||||
* After this threshold(no of bytes per attachment), large attachment is
|
||||
* written to file system.
|
||||
*
|
||||
* If the value is -1, then all the attachment content is kept in memory.
|
||||
*/
|
||||
long memoryThreshold() default 1048576L;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.ws.developer;
|
||||
|
||||
import com.sun.xml.internal.ws.api.FeatureConstructor;
|
||||
import com.sun.istack.internal.Nullable;
|
||||
|
||||
import javax.xml.ws.WebServiceFeature;
|
||||
|
||||
import com.sun.xml.internal.org.jvnet.mimepull.MIMEConfig;
|
||||
|
||||
import com.sun.org.glassfish.gmbal.ManagedAttribute;
|
||||
import com.sun.org.glassfish.gmbal.ManagedData;
|
||||
|
||||
/**
|
||||
* Proxy needs to be created with this feature to configure StreamingAttachment
|
||||
* attachments behaviour.
|
||||
*
|
||||
* <pre>
|
||||
* for e.g.: To configure all StreamingAttachment attachments to be kept in memory
|
||||
* <p>
|
||||
*
|
||||
* StreamingAttachmentFeature feature = new StreamingAttachmentFeature();
|
||||
* feature.setAllMemory(true);
|
||||
*
|
||||
* proxy = HelloService().getHelloPort(feature);
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author Jitendra Kotamraju
|
||||
*/
|
||||
@ManagedData
|
||||
public final class StreamingAttachmentFeature extends WebServiceFeature {
|
||||
/**
|
||||
* Constant value identifying the {@link StreamingAttachment} feature.
|
||||
*/
|
||||
public static final String ID = "http://jax-ws.dev.java.net/features/mime";
|
||||
|
||||
private MIMEConfig config;
|
||||
|
||||
private String dir;
|
||||
private boolean parseEagerly;
|
||||
private long memoryThreshold;
|
||||
|
||||
public StreamingAttachmentFeature() {
|
||||
}
|
||||
|
||||
@FeatureConstructor({"dir","parseEagerly","memoryThreshold"})
|
||||
public StreamingAttachmentFeature(@Nullable String dir, boolean parseEagerly, long memoryThreshold) {
|
||||
this.enabled = true;
|
||||
this.dir = dir;
|
||||
this.parseEagerly = parseEagerly;
|
||||
this.memoryThreshold = memoryThreshold;
|
||||
}
|
||||
|
||||
@ManagedAttribute
|
||||
public String getID() {
|
||||
return ID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the configuration object. Once this is called, you cannot
|
||||
* change the configuration.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ManagedAttribute
|
||||
public MIMEConfig getConfig() {
|
||||
if (config == null) {
|
||||
config = new MIMEConfig();
|
||||
config.setDir(dir);
|
||||
config.setParseEagerly(parseEagerly);
|
||||
config.setMemoryThreshold(memoryThreshold);
|
||||
config.validate();
|
||||
}
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Directory in which large attachments are stored
|
||||
*/
|
||||
public void setDir(String dir) {
|
||||
this.dir = dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* StreamingAttachment message is parsed eagerly
|
||||
*/
|
||||
public void setParseEagerly(boolean parseEagerly) {
|
||||
this.parseEagerly = parseEagerly;
|
||||
}
|
||||
|
||||
/**
|
||||
* After this threshold(no of bytes), large attachments are
|
||||
* written to file system
|
||||
*/
|
||||
public void setMemoryThreshold(long memoryThreshold) {
|
||||
this.memoryThreshold = memoryThreshold;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.ws.developer;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
import javax.activation.DataSource;
|
||||
|
||||
/**
|
||||
* Implementation of {@link com.sun.xml.internal.org.jvnet.staxex.StreamingDataHandler} to access MIME
|
||||
* attachments efficiently. Applications can use the additional methods and decide
|
||||
* on how to access the attachment data in JAX-WS applications.
|
||||
*
|
||||
* <p>
|
||||
* for e.g.:
|
||||
*
|
||||
* DataHandler dh = proxy.getData();
|
||||
* StreamingDataHandler sdh = (StreamingDataHandler)dh;
|
||||
* // readOnce() doesn't store attachment on the disk in some cases
|
||||
* // for e.g when only one huge attachment after soap envelope part in MIME message
|
||||
* InputStream in = sdh.readOnce();
|
||||
* ...
|
||||
* in.close();
|
||||
* sdh.close();
|
||||
*
|
||||
* @author Jitendra Kotamraju
|
||||
*/
|
||||
public abstract class StreamingDataHandler extends com.sun.xml.internal.org.jvnet.staxex.StreamingDataHandler {
|
||||
|
||||
private String hrefCid;
|
||||
|
||||
public StreamingDataHandler(Object o, String s) {
|
||||
super(o, s);
|
||||
}
|
||||
|
||||
public StreamingDataHandler(URL url) {
|
||||
super(url);
|
||||
}
|
||||
|
||||
public StreamingDataHandler(DataSource dataSource) {
|
||||
super(dataSource);
|
||||
}
|
||||
|
||||
public String getHrefCid() {
|
||||
return hrefCid;
|
||||
}
|
||||
|
||||
public void setHrefCid(final String cid) {
|
||||
this.hrefCid = cid;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.ws.developer;
|
||||
|
||||
import javax.xml.ws.spi.WebServiceFeatureAnnotation;
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* This feature instructs that the specified {@link JAXBContextFactory} be used for performing
|
||||
* data-binding for the SEI.
|
||||
*
|
||||
* <p>
|
||||
* For example,
|
||||
* <pre>
|
||||
* @WebService
|
||||
* @UsesJAXBContext(MyJAXBContextFactory.class)
|
||||
* public class HelloService {
|
||||
* ...
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* <p>
|
||||
* If your {@link JAXBContextFactory} needs to carry some state from your calling application,
|
||||
* you can use {@link UsesJAXBContextFeature} to pass in an instance of {@link JAXBContextFactory},
|
||||
* instead of using this to specify the type.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @since 2.1.5
|
||||
*/
|
||||
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@WebServiceFeatureAnnotation(id=UsesJAXBContextFeature.ID,bean=UsesJAXBContextFeature.class)
|
||||
public @interface UsesJAXBContext {
|
||||
/**
|
||||
* Designates the {@link JAXBContextFactory} to be used to create the {@link JAXBContext} object,
|
||||
* which in turn will be used by the JAX-WS runtime to marshal/unmarshal parameters and return
|
||||
* values to/from XML.
|
||||
*/
|
||||
Class<? extends JAXBContextFactory> value();
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.ws.developer;
|
||||
|
||||
import com.sun.xml.internal.ws.api.FeatureConstructor;
|
||||
import com.sun.xml.internal.ws.api.model.SEIModel;
|
||||
import com.sun.xml.internal.bind.api.JAXBRIContext;
|
||||
import com.sun.xml.internal.bind.api.TypeReference;
|
||||
import com.sun.istack.internal.NotNull;
|
||||
import com.sun.istack.internal.Nullable;
|
||||
|
||||
import javax.xml.ws.WebServiceFeature;
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.List;
|
||||
|
||||
import com.sun.org.glassfish.gmbal.ManagedAttribute;
|
||||
import com.sun.org.glassfish.gmbal.ManagedData;
|
||||
|
||||
/**
|
||||
* A {@link WebServiceFeature} that instructs the JAX-WS runtime to use a specific {@link JAXBContextFactory}
|
||||
* instance of creating {@link JAXBContext}.
|
||||
*
|
||||
* @see UsesJAXBContext
|
||||
* @since 2.1.5
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
@ManagedData
|
||||
public class UsesJAXBContextFeature extends WebServiceFeature {
|
||||
/**
|
||||
* Constant value identifying the {@link UsesJAXBContext} feature.
|
||||
*/
|
||||
public static final String ID = "http://jax-ws.dev.java.net/features/uses-jaxb-context";
|
||||
|
||||
private final JAXBContextFactory factory;
|
||||
|
||||
/**
|
||||
* Creates {@link UsesJAXBContextFeature}.
|
||||
*
|
||||
* @param factoryClass
|
||||
* This class has to have a public no-arg constructor, which will be invoked to create
|
||||
* a new instance. {@link JAXBContextFactory#createJAXBContext(SEIModel, List, List)} will
|
||||
* be then called to create {@link JAXBContext}.
|
||||
*/
|
||||
@FeatureConstructor("value")
|
||||
public UsesJAXBContextFeature(@NotNull Class<? extends JAXBContextFactory> factoryClass) {
|
||||
try {
|
||||
factory = factoryClass.getConstructor().newInstance();
|
||||
} catch (InstantiationException e) {
|
||||
Error x = new InstantiationError(e.getMessage());
|
||||
x.initCause(e);
|
||||
throw x;
|
||||
} catch (IllegalAccessException e) {
|
||||
Error x = new IllegalAccessError(e.getMessage());
|
||||
x.initCause(e);
|
||||
throw x;
|
||||
} catch (InvocationTargetException e) {
|
||||
Error x = new InstantiationError(e.getMessage());
|
||||
x.initCause(e);
|
||||
throw x;
|
||||
} catch (NoSuchMethodException e) {
|
||||
Error x = new NoSuchMethodError(e.getMessage());
|
||||
x.initCause(e);
|
||||
throw x;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates {@link UsesJAXBContextFeature}.
|
||||
* This version allows {@link JAXBContextFactory} to carry application specific state.
|
||||
*
|
||||
* @param factory
|
||||
* Uses a specific instance of {@link JAXBContextFactory} to create {@link JAXBContext}.
|
||||
*/
|
||||
public UsesJAXBContextFeature(@Nullable JAXBContextFactory factory) {
|
||||
this.factory = factory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates {@link UsesJAXBContextFeature}.
|
||||
* This version allows you to create {@link JAXBRIContext} upfront and uses it.
|
||||
*/
|
||||
public UsesJAXBContextFeature(@Nullable final JAXBRIContext context) {
|
||||
this.factory = new JAXBContextFactory() {
|
||||
@NotNull
|
||||
public JAXBRIContext createJAXBContext(@NotNull SEIModel sei, @NotNull List<Class> classesToBind, @NotNull List<TypeReference> typeReferences) throws JAXBException {
|
||||
return context;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the {@link JAXBContextFactory} instance to be used for creating {@link JAXBContext} for SEI.
|
||||
*
|
||||
* @return
|
||||
* null if the default {@link JAXBContext} shall be used.
|
||||
*/
|
||||
@ManagedAttribute
|
||||
public @Nullable JAXBContextFactory getFactory() {
|
||||
return factory;
|
||||
}
|
||||
|
||||
@ManagedAttribute
|
||||
public String getID() {
|
||||
return ID;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.ws.developer;
|
||||
|
||||
import com.sun.xml.internal.ws.api.message.Packet;
|
||||
import org.xml.sax.ErrorHandler;
|
||||
|
||||
import javax.xml.ws.handler.MessageContext;
|
||||
import javax.xml.validation.Validator;
|
||||
|
||||
/**
|
||||
* An {@link ErrorHandler} to receive errors encountered during the
|
||||
* {@link Validator#validate} method invocation. Specify
|
||||
* a custom handler in {@link SchemaValidation}, {@link SchemaValidationFeature}
|
||||
* to customize the error handling process during validation.
|
||||
*
|
||||
* @see SchemaValidation
|
||||
* @author Jitendra Kotamraju
|
||||
*/
|
||||
public abstract class ValidationErrorHandler implements ErrorHandler {
|
||||
protected Packet packet;
|
||||
|
||||
/**
|
||||
* Use it to communicate validation errors with the application.
|
||||
*
|
||||
* For e.g validation exceptions can be stored in {@link Packet#invocationProperties}
|
||||
* during request processing and can be accessed in the endpoint
|
||||
* via {@link MessageContext}
|
||||
*
|
||||
* @param packet for request or response message
|
||||
*/
|
||||
public void setPacket(Packet packet) {
|
||||
this.packet = packet;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.ws.developer;
|
||||
|
||||
import com.sun.istack.internal.NotNull;
|
||||
import com.sun.xml.internal.ws.api.ComponentRegistry;
|
||||
import com.sun.xml.internal.ws.api.message.Header;
|
||||
import com.sun.xml.internal.ws.api.message.Headers;
|
||||
import com.sun.xml.internal.ws.api.addressing.WSEndpointReference;
|
||||
import com.sun.xml.internal.ws.api.client.WSPortInfo;
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.ws.BindingProvider;
|
||||
import javax.xml.ws.Dispatch;
|
||||
import javax.xml.ws.Service;
|
||||
import javax.xml.ws.Service.Mode;
|
||||
import java.util.List;
|
||||
import java.io.Closeable;
|
||||
import com.sun.org.glassfish.gmbal.ManagedObjectManager;
|
||||
|
||||
/**
|
||||
* {@link BindingProvider} with JAX-WS RI's extension methods.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @author Jitendra Kotamraju
|
||||
* @since 2.1EA3
|
||||
*/
|
||||
public interface WSBindingProvider extends BindingProvider, Closeable, ComponentRegistry {
|
||||
/**
|
||||
* Sets the out-bound headers to be added to messages sent from
|
||||
* this {@link BindingProvider}.
|
||||
*
|
||||
* <p>
|
||||
* Calling this method would discard any out-bound headers
|
||||
* that were previously set.
|
||||
*
|
||||
* <p>
|
||||
* A new {@link Header} object can be created by using
|
||||
* one of the methods on {@link Headers}.
|
||||
*
|
||||
* @param headers
|
||||
* The headers to be added to the future request messages.
|
||||
* To clear the outbound headers, pass in either null
|
||||
* or empty list.
|
||||
* @throws IllegalArgumentException
|
||||
* if the list contains null item.
|
||||
*/
|
||||
void setOutboundHeaders(List<Header> headers);
|
||||
|
||||
/**
|
||||
* Sets the out-bound headers to be added to messages sent from
|
||||
* this {@link BindingProvider}.
|
||||
*
|
||||
* <p>
|
||||
* Works like {@link #setOutboundHeaders(List)} except
|
||||
* that it accepts a var arg array.
|
||||
*
|
||||
* @param headers
|
||||
* Can be null or empty.
|
||||
*/
|
||||
void setOutboundHeaders(Header... headers);
|
||||
|
||||
/**
|
||||
* Sets the out-bound headers to be added to messages sent from
|
||||
* this {@link BindingProvider}.
|
||||
*
|
||||
* <p>
|
||||
* Each object must be a JAXB-bound object that is understood
|
||||
* by the {@link JAXBContext} object known by this {@link WSBindingProvider}
|
||||
* (that is, if this is a {@link Dispatch} with JAXB, then
|
||||
* {@link JAXBContext} given to {@link Service#createDispatch(QName,JAXBContext,Mode)}
|
||||
* and if this is a typed proxy, then {@link JAXBContext}
|
||||
* implicitly created by the JAX-WS RI.)
|
||||
*
|
||||
* @param headers
|
||||
* Can be null or empty.
|
||||
* @throws UnsupportedOperationException
|
||||
* If this {@link WSBindingProvider} is a {@link Dispatch}
|
||||
* that does not use JAXB.
|
||||
*/
|
||||
void setOutboundHeaders(Object... headers);
|
||||
|
||||
List<Header> getInboundHeaders();
|
||||
|
||||
/**
|
||||
* Sets the endpoint address for all the invocations that happen
|
||||
* from {@link BindingProvider}. Instead of doing the following
|
||||
*
|
||||
* <p>
|
||||
* ((BindingProvider)proxy).getRequestContext().put(
|
||||
* BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "...")
|
||||
* <p>
|
||||
* you could do this:
|
||||
*
|
||||
* <p>
|
||||
* ((WSBindingProvider)proxy).setAddress("...");
|
||||
*
|
||||
* @param address Address of the service
|
||||
*/
|
||||
void setAddress(String address);
|
||||
|
||||
/**
|
||||
* Similar to {link BindingProvider#getEndpointReference(}, but returns WSEndpointReference that has more
|
||||
* convenience methods
|
||||
*
|
||||
* @return WSEndpointReference of the target servcie endpoint
|
||||
*
|
||||
* @since JAX-WS 2.2
|
||||
*/
|
||||
WSEndpointReference getWSEndpointReference();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return WSPortInfo object that captures the port information for which the stub is created.
|
||||
* @since JAX-WS 2.2
|
||||
*/
|
||||
WSPortInfo getPortInfo();
|
||||
|
||||
/**
|
||||
* Get the ManagedObjectManager for this provider.
|
||||
*/
|
||||
public @NotNull ManagedObjectManager getManagedObjectManager();
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* JAX-WS RI vendor extension features that are available to the JAX-WS RI users.
|
||||
*/
|
||||
package com.sun.xml.internal.ws.developer;
|
||||
Reference in New Issue
Block a user