Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ Changes log

- 2.6.0 (??-05-2025)
- Misc
- Upgraded to Jakarta EE 10
- JaxB to 4.0.0
- Servlet API to 6.0.0
- Upgraded Gson library to 2.13.1.
- Upgraded Jackson library to 2.19.1.
- Upgraded Jetty library to version 2.0.17.
Expand Down
15 changes: 5 additions & 10 deletions org.restlet.java/org.restlet.ext.jaxb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,14 @@

<dependencies>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>${lib-jaxb-ri-version}</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>${lib-jaxb-api-version}</version>
</dependency>
<dependency>
<groupId>com.sun.istack</groupId>
<artifactId>istack-commons-runtime</artifactId>
<version>${lib-istack-version}</version>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>${lib-jaxb-ri-version}</version>
</dependency>
<dependency>
<groupId>org.restlet</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
import java.io.IOException;
import java.util.List;

import javax.xml.bind.annotation.XmlRootElement;

import jakarta.xml.bind.annotation.XmlRootElement;
import org.restlet.data.MediaType;
import org.restlet.data.Preference;
import org.restlet.engine.converter.ConverterHelper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,19 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.ValidationEventHandler;
import javax.xml.bind.util.JAXBSource;
import javax.xml.parsers.DocumentBuilderFactory;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.ValidationEventHandler;
import jakarta.xml.bind.util.JAXBSource;

import org.glassfish.jaxb.runtime.marshaller.NamespacePrefixMapper;
import org.restlet.Context;
import org.restlet.data.MediaType;
import org.restlet.ext.jaxb.internal.Marshaller;
import org.restlet.ext.jaxb.internal.Unmarshaller;
import org.restlet.representation.Representation;
import org.restlet.representation.WriterRepresentation;

import com.sun.xml.bind.marshaller.NamespacePrefixMapper;

/**
* An XML representation based on JAXB that provides easy translation between
* XML and JAXB element class trees.
Expand Down Expand Up @@ -111,8 +109,7 @@ public static synchronized JAXBContext getContext(String contextPath,
private volatile boolean formattedOutput;

/**
* Indicates whether or not document level events will be generated by the
* Marshaller.
* Indicates whether the Marshaller will generate document level events.
*/
private volatile boolean fragment;

Expand All @@ -135,8 +132,6 @@ public static synchronized JAXBContext getContext(String contextPath,
* Indicates the desire for validating this type of XML representations
* against a DTD. Note that for XML schema or Relax NG validation, use the
* "schema" property instead.
*
* @see DocumentBuilderFactory#setValidating(boolean)
*/
private volatile boolean validatingDtd;

Expand All @@ -145,10 +140,10 @@ public static synchronized JAXBContext getContext(String contextPath,

/**
* Indicates the desire for processing <em>XInclude</em> if found in this
* type of XML representations. By default the value of this is set to
* type of XML representations. By default, the value of this is set to
* false.
*
* @see DocumentBuilderFactory#setXIncludeAware(boolean)
* @see javax.xml.parsers.DocumentBuilderFactory#setXIncludeAware(boolean)
*/
private volatile boolean xIncludeAware;

Expand Down Expand Up @@ -441,10 +436,10 @@ public ValidationEventHandler getValidationEventHandler() {
}

/**
* Indicates if the parser will expand entity reference nodes. By default
* Indicates if the parser expands entity reference nodes. By default,
* the value of this is set to true.
*
* @return True if the parser will expand entity reference nodes.
* @return True if the parser expands entity reference nodes.
*/
public boolean isExpandingEntityRefs() {
return expandingEntityRefs;
Expand All @@ -461,11 +456,9 @@ public boolean isFormattedOutput() {
}

/**
* Indicates whether or not document level events will be generated by the
* Marshaller.
* Indicates whether the Marshaller will generate document level events.
*
* @return True if the document level events will be generated by the
* Marshaller.
* @return True if the Marshaller generates the document level events.
*/
public boolean isFragment() {
return fragment;
Expand All @@ -492,7 +485,7 @@ public boolean isValidatingDtd() {

/**
* Indicates the desire for processing <em>XInclude</em> if found in this
* type of XML representations. By default the value of this is set to
* type of XML representations. By default, the value of this is set to
* false.
*
* @return The current value of the xIncludeAware flag.
Expand Down Expand Up @@ -523,11 +516,11 @@ public void setContextPath(String contextPath) {
}

/**
* Indicates if the parser will expand entity reference nodes. By default
* Indicates if the parser expands entity reference nodes. By default,
* the value of this is set to true.
*
* @param expandEntityRefs
* True if the parser will expand entity reference nodes.
* True if the parser expands entity reference nodes.
*/
public void setExpandingEntityRefs(boolean expandEntityRefs) {
this.expandingEntityRefs = expandEntityRefs;
Expand All @@ -549,7 +542,7 @@ public void setFormattedOutput(boolean formattedOutput) {
* Marshaller.
*
* @param fragment
* True if the document level events will be generated by the
* True if the document level events are generated by the
* Marshaller.
*/
public void setFragment(boolean fragment) {
Expand Down Expand Up @@ -634,7 +627,7 @@ public void setValidationEventHandler(

/**
* Indicates the desire for processing <em>XInclude</em> if found in this
* type of XML representations. By default the value of this is set to
* type of XML representations. By default, the value of this is set to
* false.
*
* @param includeAware
Expand All @@ -651,7 +644,7 @@ public void setXIncludeAware(boolean includeAware) {
* The writer to use when writing.
*
* @throws IOException
* If any error occurs attempting to write the stream.
* If any error occurs, attempting to write the stream.
*/
@Override
public void write(Writer writer) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
import java.io.Writer;
import java.util.logging.Level;

import javax.xml.bind.JAXBException;

import jakarta.xml.bind.JAXBException;
import org.restlet.Context;
import org.restlet.ext.jaxb.JaxbRepresentation;

Expand All @@ -42,31 +41,32 @@ public class Marshaller<T> {
/** The parent JAXB representation. */
private final JaxbRepresentation<T> jaxbRepresentation;

/** Use thread identity to preserve safety of access to marshalers. */
private final ThreadLocal<javax.xml.bind.Marshaller> marshaller = new ThreadLocal<javax.xml.bind.Marshaller>() {
/** Use thread identity to preserve the safety of access to marshalers. */
private final ThreadLocal<jakarta.xml.bind.Marshaller> marshaller = new ThreadLocal<>() {

@Override
protected synchronized javax.xml.bind.Marshaller initialValue() {
javax.xml.bind.Marshaller m = null;
protected synchronized jakarta.xml.bind.Marshaller initialValue() {
jakarta.xml.bind.Marshaller m = null;

try {
m = JaxbRepresentation.getContext(getContextPath(),
getClassLoader()).createMarshaller();
m.setProperty("jaxb.formatted.output", getJaxbRepresentation()

m.setProperty(jakarta.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, getJaxbRepresentation()
.isFormattedOutput());

if (getJaxbRepresentation().getSchemaLocation() != null) {
m.setProperty("jaxb.schemaLocation",
m.setProperty(jakarta.xml.bind.Marshaller.JAXB_SCHEMA_LOCATION,
getJaxbRepresentation().getSchemaLocation());
}
if (getJaxbRepresentation().getNoNamespaceSchemaLocation() != null) {
m.setProperty("jaxb.noNamespaceSchemaLocation",
m.setProperty(jakarta.xml.bind.Marshaller.JAXB_NO_NAMESPACE_SCHEMA_LOCATION,
getJaxbRepresentation()
.getNoNamespaceSchemaLocation());
}

if (Marshaller.this.jaxbRepresentation.getCharacterSet() != null) {
m.setProperty("jaxb.encoding",
m.setProperty(jakarta.xml.bind.Marshaller.JAXB_ENCODING,
Marshaller.this.jaxbRepresentation
.getCharacterSet().getName());
}
Expand All @@ -76,7 +76,7 @@ protected synchronized javax.xml.bind.Marshaller initialValue() {
getJaxbRepresentation().getNamespacePrefixMapper());
}

m.setProperty("jaxb.fragment", getJaxbRepresentation()
m.setProperty(jakarta.xml.bind.Marshaller.JAXB_FRAGMENT, getJaxbRepresentation()
.isFragment());
} catch (Exception e) {
Context.getCurrentLogger().log(Level.WARNING,
Expand Down Expand Up @@ -143,8 +143,8 @@ public JaxbRepresentation<T> getJaxbRepresentation() {
* @return The JAXB marshaller.
* @throws JAXBException
*/
private javax.xml.bind.Marshaller getMarshaller() throws JAXBException {
final javax.xml.bind.Marshaller m = this.marshaller.get();
private jakarta.xml.bind.Marshaller getMarshaller() throws JAXBException {
final jakarta.xml.bind.Marshaller m = this.marshaller.get();
if (m == null) {
Context.getCurrentLogger().warning("Unable to locate marshaller.");
throw new JAXBException("Unable to locate marshaller.");
Expand All @@ -157,11 +157,11 @@ private javax.xml.bind.Marshaller getMarshaller() throws JAXBException {
* stream.
*
* @param jaxbElement
* The root of the content tree to be marshalled.
* The root of the content tree to be marshaled.
* @param stream
* The target output stream write the XML to.
* The target output stream writes the XML to.
* @throws JAXBException
* If any unexpected problem occurs during marshalling.
* If any unexpected problem occurs during marshaling.
*/
public void marshal(Object jaxbElement, OutputStream stream)
throws JAXBException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
import java.io.Reader;
import java.util.logging.Level;

import javax.xml.XMLConstants;
import javax.xml.bind.JAXBException;
import javax.xml.bind.ValidationEventHandler;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.transform.sax.SAXSource;

import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.ValidationEventHandler;
import org.restlet.Context;
import org.restlet.ext.jaxb.JaxbRepresentation;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;

import javax.xml.XMLConstants;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.transform.sax.SAXSource;

/**
* This is a utility class to assist in unmarshaling XML into a new Java content
* tree.
Expand All @@ -47,15 +47,14 @@ public class Unmarshaller<T> {
private final String contextPath;

/**
* Use thread identity to preserve safety of access to unmarshallers.
* Use thread identity to preserve the safety of access to unmarshallers.
*/
private final ThreadLocal<javax.xml.bind.Unmarshaller> unmarshaller = new ThreadLocal<javax.xml.bind.Unmarshaller>() {
private final ThreadLocal<jakarta.xml.bind.Unmarshaller> unmarshaller = new ThreadLocal<>() {
@Override
protected synchronized javax.xml.bind.Unmarshaller initialValue() {
javax.xml.bind.Unmarshaller m = null;
protected synchronized jakarta.xml.bind.Unmarshaller initialValue() {
jakarta.xml.bind.Unmarshaller m = null;
try {
m = JaxbRepresentation.getContext(getContextPath(),
getClassLoader()).createUnmarshaller();
m = JaxbRepresentation.getContext(getContextPath(), getClassLoader()).createUnmarshaller();
} catch (Exception e) {
Context.getCurrentLogger().log(Level.WARNING,
"Problem creating Unmarshaller", e);
Expand Down Expand Up @@ -102,8 +101,8 @@ public String getContextPath() {
* @return The JAXB unmarshaller.
* @throws JAXBException
*/
private javax.xml.bind.Unmarshaller getUnmarshaller() throws JAXBException {
final javax.xml.bind.Unmarshaller m = this.unmarshaller.get();
private jakarta.xml.bind.Unmarshaller getUnmarshaller() throws JAXBException {
final jakarta.xml.bind.Unmarshaller m = this.unmarshaller.get();
if (m == null) {
Context.getCurrentLogger()
.warning("Unable to locate unmarshaller.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

package org.restlet.ext.jaxb;

import javax.xml.bind.annotation.XmlRegistry;
import jakarta.xml.bind.annotation.XmlRegistry;

@XmlRegistry
public class ObjectFactory {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

package org.restlet.ext.jaxb;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@
<lib-gwt-server-version>2.12.2</lib-gwt-server-version>
<lib-istack-version>3.0.12</lib-istack-version>
<lib-jackson-version>2.19.1</lib-jackson-version>
<lib-jaxb-ri-version>2.4.0-b180830.0438</lib-jaxb-ri-version>
<lib-jaxb-api-version>2.4.0-b180830.0359</lib-jaxb-api-version>
<lib-jaxb-ri-version>4.0.0</lib-jaxb-ri-version>
<lib-jaxb-api-version>4.0.0</lib-jaxb-api-version>
<lib-joda-time-version>2.14.0</lib-joda-time-version>
<lib-jetty-version>12.0.22</lib-jetty-version>
<lib-json-version>20250517</lib-json-version>
<lib-log4j-version>1.2.17</lib-log4j-version>
<lib-hamcrest-version>1.3</lib-hamcrest-version>
<lib-osgi-version>4.3.1</lib-osgi-version>
<lib-servlet-version>5.0.0</lib-servlet-version>
<lib-servlet-version>6.0.0</lib-servlet-version>
<lib-slf4j-version>2.0.17</lib-slf4j-version>
<lib-spring-version>6.2.8</lib-spring-version>
<lib-thymeleaf-version>3.1.3.RELEASE</lib-thymeleaf-version>
Expand Down