openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1802857 - in /openwebbeans/meecrowave/trunk: meecrowave-core/src/main/java/org/apache/meecrowave/cxf/ meecrowave-core/src/test/java/org/apache/meecrowave/ meecrowave-doc/src/main/jbake/content/
Date Mon, 24 Jul 2017 19:33:49 GMT
Author: struberg
Date: Mon Jul 24 19:33:48 2017
New Revision: 1802857

URL: http://svn.apache.org/viewvc?rev=1802857&view=rev
Log:
MEECROWAVE-49 don't use JSON-B for byte[] content. 

ported over from mw-1.0.x branch

Added:
    openwebbeans/meecrowave/trunk/meecrowave-core/src/test/java/org/apache/meecrowave/OctetStreamMediaTypeTest.java
      - copied, changed from r1802856, openwebbeans/meecrowave/trunk/meecrowave-core/src/test/java/org/apache/meecrowave/OctectStreamMediaTypeTest.java
Removed:
    openwebbeans/meecrowave/trunk/meecrowave-core/src/test/java/org/apache/meecrowave/OctectStreamMediaTypeTest.java
Modified:
    openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/cxf/MeecrowaveBus.java
    openwebbeans/meecrowave/trunk/meecrowave-doc/src/main/jbake/content/download.adoc

Modified: openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/cxf/MeecrowaveBus.java
URL: http://svn.apache.org/viewvc/openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/cxf/MeecrowaveBus.java?rev=1802857&r1=1802856&r2=1802857&view=diff
==============================================================================
--- openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/cxf/MeecrowaveBus.java
(original)
+++ openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/cxf/MeecrowaveBus.java
Mon Jul 24 19:33:48 2017
@@ -26,6 +26,7 @@ import javax.ws.rs.Consumes;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.ext.Provider;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
@@ -197,6 +198,10 @@ public class MeecrowaveBus implements Bu
                                              final String binaryStrategy,
                                              final String namingStrategy,
                                              final String orderStrategy) {
+            // ATTENTION this is only a workaround for MEECROWAVE-49 and shall get removed
after Johnzon has a fix for it!
+            // We add byte[] to the ignored types.
+            super(Arrays.asList("[B"));
+
             ofNullable(encoding).ifPresent(this::setEncoding);
             ofNullable(namingStrategy).ifPresent(this::setPropertyNamingStrategy);
             ofNullable(orderStrategy).ifPresent(this::setPropertyOrderStrategy);

Copied: openwebbeans/meecrowave/trunk/meecrowave-core/src/test/java/org/apache/meecrowave/OctetStreamMediaTypeTest.java
(from r1802856, openwebbeans/meecrowave/trunk/meecrowave-core/src/test/java/org/apache/meecrowave/OctectStreamMediaTypeTest.java)
URL: http://svn.apache.org/viewvc/openwebbeans/meecrowave/trunk/meecrowave-core/src/test/java/org/apache/meecrowave/OctetStreamMediaTypeTest.java?p2=openwebbeans/meecrowave/trunk/meecrowave-core/src/test/java/org/apache/meecrowave/OctetStreamMediaTypeTest.java&p1=openwebbeans/meecrowave/trunk/meecrowave-core/src/test/java/org/apache/meecrowave/OctectStreamMediaTypeTest.java&r1=1802856&r2=1802857&rev=1802857&view=diff
==============================================================================
--- openwebbeans/meecrowave/trunk/meecrowave-core/src/test/java/org/apache/meecrowave/OctectStreamMediaTypeTest.java
(original)
+++ openwebbeans/meecrowave/trunk/meecrowave-core/src/test/java/org/apache/meecrowave/OctetStreamMediaTypeTest.java
Mon Jul 24 19:33:48 2017
@@ -35,34 +35,36 @@ import java.nio.charset.StandardCharsets
 
 import static org.junit.Assert.assertEquals;
 
-public class OctectStreamMediaTypeTest {
+public class OctetStreamMediaTypeTest {
     @Test
     public void fields() throws IOException {
         try (final Meecrowave meecrowave = new Meecrowave(new Meecrowave.Builder()
-                .randomHttpPort()
-                .includePackages(OctectStreamMediaTypeTest.class.getName())).bake()) {
+            .randomHttpPort()
+            .includePackages(OctetStreamMediaTypeTest.class.getName())).bake()) {
             try (final InputStream stream = new URL(
-                    "http://localhost:" + meecrowave.getConfiguration().getHttpPort() + "/OctectStreamMediaTypeTest/response").openStream())
{
+                "http://localhost:" + meecrowave.getConfiguration().getHttpPort() + "/OctetStreamMediaTypeTest/response").openStream())
{
                 assertEquals("resp", Streams.asString(stream, "UTF-8"));
             }
             try (final InputStream stream = new URL(
-                    "http://localhost:" + meecrowave.getConfiguration().getHttpPort() + "/OctectStreamMediaTypeTest/streaming").openStream())
{
+                "http://localhost:" + meecrowave.getConfiguration().getHttpPort() + "/OctetStreamMediaTypeTest/responseBytes").openStream())
{
+                assertEquals("resp", Streams.asString(stream, "UTF-8"));
+            }
+            try (final InputStream stream = new URL(
+                "http://localhost:" + meecrowave.getConfiguration().getHttpPort() + "/OctetStreamMediaTypeTest/streaming").openStream())
{
                 assertEquals("stream", Streams.asString(stream, "UTF-8"));
             }
             try (final InputStream stream = new URL(
-                    "http://localhost:" + meecrowave.getConfiguration().getHttpPort() + "/OctectStreamMediaTypeTest/string").openStream())
{
+                "http://localhost:" + meecrowave.getConfiguration().getHttpPort() + "/OctetStreamMediaTypeTest/string").openStream())
{
                 assertEquals("string", Streams.asString(stream, "UTF-8"));
             }
-            /* too ambiguous to have it working, you can add it in ignored list of johnzon
provider if you want to handle it particularly
             try (final InputStream stream = new URL(
-                    "http://localhost:" + meecrowave.getConfiguration().getHttpPort() + "/OctectStreamMediaTypeTest/bytes").openStream())
{
+                    "http://localhost:" + meecrowave.getConfiguration().getHttpPort() + "/OctetStreamMediaTypeTest/bytes").openStream())
{
                 assertEquals("bytes", Streams.asString(stream, "UTF-8"));
             }
-            */
         }
     }
 
-    @Path("OctectStreamMediaTypeTest")
+    @Path("OctetStreamMediaTypeTest")
     @ApplicationScoped
     public static class App {
         @GET
@@ -73,6 +75,13 @@ public class OctectStreamMediaTypeTest {
         }
 
         @GET
+        @Path("responseBytes")
+        @Produces(MediaType.APPLICATION_OCTET_STREAM)
+        public Response getResponseBytes() {
+            return Response.ok("resp".getBytes()).build();
+        }
+
+        @GET
         @Path("streaming")
         @Produces(MediaType.APPLICATION_OCTET_STREAM)
         public StreamingOutput getStreamingOutput() {

Modified: openwebbeans/meecrowave/trunk/meecrowave-doc/src/main/jbake/content/download.adoc
URL: http://svn.apache.org/viewvc/openwebbeans/meecrowave/trunk/meecrowave-doc/src/main/jbake/content/download.adoc?rev=1802857&r1=1802856&r2=1802857&view=diff
==============================================================================
--- openwebbeans/meecrowave/trunk/meecrowave-doc/src/main/jbake/content/download.adoc (original)
+++ openwebbeans/meecrowave/trunk/meecrowave-doc/src/main/jbake/content/download.adoc Mon
Jul 24 19:33:48 2017
@@ -1,5 +1,5 @@
 = Downloads
-:jbake-date: 2016-10-24
+:jbake-date: 2017-07-24
 :jbake-type: page
 :jbake-status: published
 :jbake-meecrowavepdf:



Mime
View raw message