Author: heiko.braun(a)jboss.com
Date: 2007-10-10 10:50:55 -0400 (Wed, 10 Oct 2007)
New Revision: 4727
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/CustomizableJAXBContextFactory.java
Log:
Fix jaxbintro reggression introduced by WSDL generation
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/CustomizableJAXBContextFactory.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/CustomizableJAXBContextFactory.java 2007-10-10
14:30:12 UTC (rev 4726)
+++
stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/CustomizableJAXBContextFactory.java 2007-10-10
14:50:55 UTC (rev 4727)
@@ -27,6 +27,8 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
import org.jboss.wsf.spi.binding.BindingCustomization;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.invocation.EndpointAssociation;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
@@ -36,7 +38,8 @@
* The default factory checks if a {@link JAXBBindingCustomization} exists
* and uses it to customize the JAXBContext that will be created.
* <p>
- * It uses the {@link org.jboss.wsf.spi.invocation.EndpointAssociation} to access
customizations.
+ * It uses the {@link org.jboss.wsf.spi.invocation.EndpointAssociation} to access
customizations
+ * if they are not passed explicitly.
*
* @see org.jboss.wsf.spi.deployment.Endpoint
* @see org.jboss.wsf.spi.binding.BindingCustomization
@@ -56,12 +59,20 @@
{
return createContext(new Class[] {clazz});
}
-
+
public JAXBContext createContext(Class[] clazzes) throws WSException
{
try
{
- return JAXBContext.newInstance(clazzes);
+ BindingCustomization customization = getCustomization();
+
+ JAXBContext jaxbCtx;
+ if(null == customization)
+ jaxbCtx = JAXBContext.newInstance(clazzes);
+ else
+ jaxbCtx = createContext(clazzes, customization);
+
+ return jaxbCtx;
}
catch (JAXBException e) {
throw new WSException("Failed to create JAXBContext", e);
@@ -71,7 +82,7 @@
public JAXBContext createContext(Class[] clazzes, BindingCustomization
bindingCustomization) throws WSException
{
try
- {
+ {
return JAXBContext.newInstance(clazzes, bindingCustomization);
}
catch (JAXBException e) {
@@ -84,7 +95,7 @@
String defaultNamespaceRemap, boolean c14nSupport, BindingCustomization
bindingCustomization)
{
try
- {
+ {
RuntimeAnnotationReader runtimeAnnotations = bindingCustomization!=null ?
(RuntimeAnnotationReader)bindingCustomization.get(JAXBRIContext.ANNOTATION_READER) :
null;
@@ -100,4 +111,10 @@
throw new WSException("Failed to create JAXBContext", e);
}
}
+
+ private BindingCustomization getCustomization()
+ {
+ Endpoint threadLocal = EndpointAssociation.getEndpoint();
+ return threadLocal!=null ?
threadLocal.getAttachment(BindingCustomization.class):null;
+ }
}