diff --git a/jaxrs-1x/pom.xml b/jaxrs-1x/pom.xml deleted file mode 100644 index d601b4c0..00000000 --- a/jaxrs-1x/pom.xml +++ /dev/null @@ -1,100 +0,0 @@ - - - - - 4.0.0 - - - org.glassfish - json - 2.0.0-SNAPSHOT - ../pom.xml - - - jsonp-jaxrs-1x - bundle - 2.0.0-SNAPSHOT - Jakarta JSON Processing Media for JAX-RS 1.1 - JAX-RS 1.1 MessageBodyReader and MessageBodyWriter to support JsonObject/JsonArray/JsonStructure API of Jakarta JSON Processing - https://github.com/eclipse-ee4j/jsonp - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - - attach-javadocs - - jar - - - - - - - org.apache.felix - maven-bundle-plugin - true - - - ${impl_version} - org.glassfish.json.jaxrs1x - - - - - - - - - javax.ws.rs - jsr311-api - provided - - - jakarta.json - jakarta.json-api - provided - - - - - - jdk9-setup - - [9,) - - - - jakarta.annotation - jakarta.annotation-api - provided - - - - - - diff --git a/jaxrs-1x/src/main/java/org/glassfish/json/jaxrs1x/JsonStructureBodyReader.java b/jaxrs-1x/src/main/java/org/glassfish/json/jaxrs1x/JsonStructureBodyReader.java deleted file mode 100644 index 8daed9d5..00000000 --- a/jaxrs-1x/src/main/java/org/glassfish/json/jaxrs1x/JsonStructureBodyReader.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2012, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.json.jaxrs1x; - -import java.io.IOException; -import java.io.InputStream; -import java.lang.annotation.Annotation; -import java.lang.reflect.Type; - -import jakarta.json.Json; -import jakarta.json.JsonReader; -import jakarta.json.JsonReaderFactory; -import jakarta.json.JsonStructure; - -import javax.ws.rs.Consumes; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.ext.MessageBodyReader; -import javax.ws.rs.ext.Provider; - -/** - * JAX-RS MessageBodyReader for JsonStructure. This allows - * JsonStructure, JsonArray and JsonObject to be a parameter of a - * resource method. - * - * @author Jitendra Kotamraju - * @author Blaise Doughan - * @author Michal Gajdos - */ -@Provider -@Consumes({"application/json", "text/json", "*/*"}) -public class JsonStructureBodyReader implements MessageBodyReader { - private final JsonReaderFactory rf = Json.createReaderFactory(null); - - private static final String JSON = "json"; - private static final String PLUS_JSON = "+json"; - - @Override - public boolean isReadable(Class aClass, Type type, - Annotation[] annotations, MediaType mediaType) { - return JsonStructure.class.isAssignableFrom(aClass) && supportsMediaType(mediaType); - } - - /** - * @return true for all media types of the pattern */json and - * */*+json. - */ - private static boolean supportsMediaType(final MediaType mediaType) { - return mediaType.getSubtype().equals(JSON) || mediaType.getSubtype().endsWith(PLUS_JSON); - } - - @Override - public JsonStructure readFrom(Class jsonStructureClass, - Type type, Annotation[] annotations, MediaType mediaType, - MultivaluedMap stringStringMultivaluedMap, - InputStream inputStream) throws IOException, WebApplicationException { - try (JsonReader reader = rf.createReader(inputStream)) { - return reader.read(); - } - } -} diff --git a/jaxrs-1x/src/main/java/org/glassfish/json/jaxrs1x/JsonStructureBodyWriter.java b/jaxrs-1x/src/main/java/org/glassfish/json/jaxrs1x/JsonStructureBodyWriter.java deleted file mode 100644 index cd96be13..00000000 --- a/jaxrs-1x/src/main/java/org/glassfish/json/jaxrs1x/JsonStructureBodyWriter.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2012, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.json.jaxrs1x; - -import java.io.IOException; -import java.io.OutputStream; -import java.lang.annotation.Annotation; -import java.lang.reflect.Type; -import java.util.HashMap; -import java.util.Map; - -import jakarta.json.Json; -import jakarta.json.JsonStructure; -import jakarta.json.JsonWriter; -import jakarta.json.JsonWriterFactory; - -import javax.annotation.PostConstruct; -import javax.ws.rs.Produces; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.ext.MessageBodyWriter; -import javax.ws.rs.ext.Provider; - -/** - * JAX-RS MessageBodyWriter for JsonStructure. This allows - * JsonStructure, JsonArray and JsonObject to be return type of a - * resource method. - * - * @author Jitendra Kotamraju - * @author Blaise Doughan - * @author Michal Gajdos - */ -@Provider -@Produces({"application/json", "text/json", "*/*"}) -public class JsonStructureBodyWriter implements MessageBodyWriter { - private static final String JSON = "json"; - private static final String PLUS_JSON = "+json"; - - private JsonWriterFactory wf = Json.createWriterFactory(null); - - @PostConstruct - private void init() { - wf = Json.createWriterFactory(new HashMap<>()); - } - - @Override - public boolean isWriteable(Class aClass, - Type type, Annotation[] annotations, MediaType mediaType) { - return JsonStructure.class.isAssignableFrom(aClass) && supportsMediaType(mediaType); - } - - /** - * @return true for all media types of the pattern */json and - * */*+json. - */ - private static boolean supportsMediaType(final MediaType mediaType) { - return mediaType.getSubtype().equals(JSON) || mediaType.getSubtype().endsWith(PLUS_JSON); - } - - @Override - public long getSize(JsonStructure jsonStructure, Class aClass, - Type type, Annotation[] annotations, MediaType mediaType) { - - return -1; - } - - @Override - public void writeTo(JsonStructure jsonStructure, Class aClass, Type type, - Annotation[] annotations, MediaType mediaType, - MultivaluedMap stringObjectMultivaluedMap, - OutputStream outputStream) throws IOException, WebApplicationException { - try (JsonWriter writer = wf.createWriter(outputStream)) { - writer.write(jsonStructure); - } - } -} diff --git a/pom.xml b/pom.xml index 22fe2f62..f6722ee7 100644 --- a/pom.xml +++ b/pom.xml @@ -390,13 +390,6 @@ all - jakarta.servlet jakarta.servlet-api @@ -405,9 +398,6 @@ - gf demos