Fixed various MTOM issues.
This commit is contained in:
@@ -18,7 +18,6 @@ package org.springframework.oxm.jaxb;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.Marshaller;
|
||||
@@ -27,7 +26,6 @@ import javax.xml.bind.ValidationEventHandler;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.oxm.XmlMappingException;
|
||||
|
||||
@@ -45,9 +43,7 @@ import org.springframework.oxm.XmlMappingException;
|
||||
public abstract class AbstractJaxbMarshaller
|
||||
implements org.springframework.oxm.Marshaller, org.springframework.oxm.Unmarshaller, InitializingBean {
|
||||
|
||||
/**
|
||||
* Logger available to subclasses.
|
||||
*/
|
||||
/** Logger available to subclasses. */
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private String contextPath;
|
||||
@@ -60,16 +56,12 @@ public abstract class AbstractJaxbMarshaller
|
||||
|
||||
private ValidationEventHandler validationEventHandler;
|
||||
|
||||
/**
|
||||
* Returns the JAXB Context path.
|
||||
*/
|
||||
/** Returns the JAXB Context path. */
|
||||
protected String getContextPath() {
|
||||
return contextPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the JAXB Context path.
|
||||
*/
|
||||
/** Sets the JAXB Context path. */
|
||||
public void setContextPath(String contextPath) {
|
||||
this.contextPath = contextPath;
|
||||
}
|
||||
@@ -79,7 +71,7 @@ public abstract class AbstractJaxbMarshaller
|
||||
* <code>Marshaller</code>, and allow for features such as indentation.
|
||||
*
|
||||
* @param properties the properties
|
||||
* @see javax.xml.bind.Marshaller#setProperty(String, Object)
|
||||
* @see javax.xml.bind.Marshaller#setProperty(String,Object)
|
||||
* @see javax.xml.bind.Marshaller#JAXB_ENCODING
|
||||
* @see javax.xml.bind.Marshaller#JAXB_FORMATTED_OUTPUT
|
||||
* @see javax.xml.bind.Marshaller#JAXB_NO_NAMESPACE_SCHEMA_LOCATION
|
||||
@@ -94,7 +86,7 @@ public abstract class AbstractJaxbMarshaller
|
||||
* <code>Unmarshaller</code>.
|
||||
*
|
||||
* @param properties the properties
|
||||
* @see javax.xml.bind.Unmarshaller#setProperty(String, Object)
|
||||
* @see javax.xml.bind.Unmarshaller#setProperty(String,Object)
|
||||
*/
|
||||
public void setUnmarshallerProperties(Map properties) {
|
||||
this.unmarshallerProperties = properties;
|
||||
@@ -110,6 +102,11 @@ public abstract class AbstractJaxbMarshaller
|
||||
this.validationEventHandler = validationEventHandler;
|
||||
}
|
||||
|
||||
/** Returns the {@link JAXBContext} created in {@link #afterPropertiesSet()}. */
|
||||
public JAXBContext getJaxbContext() {
|
||||
return jaxbContext;
|
||||
}
|
||||
|
||||
public final void afterPropertiesSet() throws Exception {
|
||||
try {
|
||||
jaxbContext = createJaxbContext();
|
||||
@@ -133,9 +130,7 @@ public abstract class AbstractJaxbMarshaller
|
||||
return JaxbUtils.convertJaxbException(ex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a newly created JAXB marshaller. JAXB marshallers are not necessarily thread safe.
|
||||
*/
|
||||
/** Returns a newly created JAXB marshaller. JAXB marshallers are not necessarily thread safe. */
|
||||
protected Marshaller createMarshaller() {
|
||||
try {
|
||||
Marshaller marshaller = jaxbContext.createMarshaller();
|
||||
@@ -156,9 +151,7 @@ public abstract class AbstractJaxbMarshaller
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a newly created JAXB unmarshaller. JAXB unmarshallers are not necessarily thread safe.
|
||||
*/
|
||||
/** Returns a newly created JAXB unmarshaller. JAXB unmarshallers are not necessarily thread safe. */
|
||||
protected Unmarshaller createUnmarshaller() {
|
||||
try {
|
||||
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
|
||||
@@ -197,8 +190,6 @@ public abstract class AbstractJaxbMarshaller
|
||||
protected void initJaxbUnmarshaller(Unmarshaller unmarshaller) throws JAXBException {
|
||||
}
|
||||
|
||||
/**
|
||||
* Template method that returns a newly created JAXB context. Called from <code>afterPropertiesSet()</code>.
|
||||
*/
|
||||
/** Template method that returns a newly created JAXB context. Called from <code>afterPropertiesSet()</code>. */
|
||||
protected abstract JAXBContext createJaxbContext() throws Exception;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.springframework.oxm.jaxb;
|
||||
|
||||
import java.io.IOException;
|
||||
import javax.xml.bind.UnmarshalException;
|
||||
|
||||
import org.springframework.oxm.UnmarshallingFailureException;
|
||||
@@ -30,4 +31,7 @@ public class JaxbUnmarshallingFailureException extends UnmarshallingFailureExcep
|
||||
super("JAXB unmarshalling exception: " + ex.getMessage(), ex);
|
||||
}
|
||||
|
||||
public JaxbUnmarshallingFailureException(IOException ex) {
|
||||
super("JAXB unmarshalling exception: " + ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,14 @@ public interface MimeContainer {
|
||||
*/
|
||||
boolean isXopPackage();
|
||||
|
||||
/**
|
||||
* Turns this message into a XOP package.
|
||||
*
|
||||
* @return <code>true</code> when the message is a XOP package
|
||||
* @see <a href="http://www.w3.org/TR/2005/REC-xop10-20050125/#xop_packages">XOP Packages</a>
|
||||
*/
|
||||
boolean convertToXopPackage();
|
||||
|
||||
/**
|
||||
* Adds the given data handler as an attachment to this container.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user