You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2021/07/02 08:11:09 UTC

[isis] branch master updated: ISIS-2783: Bump resteasy-spring-boot-starter from 4.8.0.Final to 4.8.1.Final

This is an automated email from the ASF dual-hosted git repository.

ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git


The following commit(s) were added to refs/heads/master by this push:
     new 27160c9  ISIS-2783: Bump resteasy-spring-boot-starter from 4.8.0.Final to 4.8.1.Final
27160c9 is described below

commit 27160c97345cc10055249344111e3e8fcbb08937
Author: andi-huber <ah...@apache.org>
AuthorDate: Fri Jul 2 10:10:56 2021 +0200

    ISIS-2783: Bump resteasy-spring-boot-starter from 4.8.0.Final to
    4.8.1.Final
    
    fixes RepresentationTypeSimplifiedV2 parsing to adapt to the new format
    in use
---
 .../client/RepresentationTypeSimplifiedV2.java     | 12 ++++--
 .../client/RepresentationTypeSimplifiedV2Test.java | 43 ++++++++++++++++++++++
 core/pom.xml                                       |  4 +-
 starters/pom.xml                                   |  2 +-
 4 files changed, 55 insertions(+), 6 deletions(-)

diff --git a/api/applib/src/main/java/org/apache/isis/applib/client/RepresentationTypeSimplifiedV2.java b/api/applib/src/main/java/org/apache/isis/applib/client/RepresentationTypeSimplifiedV2.java
index 6725740..4f98321 100644
--- a/api/applib/src/main/java/org/apache/isis/applib/client/RepresentationTypeSimplifiedV2.java
+++ b/api/applib/src/main/java/org/apache/isis/applib/client/RepresentationTypeSimplifiedV2.java
@@ -104,15 +104,21 @@ public enum RepresentationTypeSimplifiedV2 {
 
     // -- HELPER
 
-    private static String trimFirstAndLastCharacter(String s) {
+    private static String trimQuotesIfAny(String s) {
         if(s.length()<2) {
             return s;
         }
-        return s.substring(1, s.length()-1);
+        if(s.charAt(0) == '"'
+                || s.charAt(0) == '\'') {
+            // just assuming we have quotes at the end as well
+            return s.substring(1, s.length()-1);
+        }
+        return s;
     }
 
     private static Optional<String> extractReprType(final @NonNull Stream<String> stringStream) {
         return stringStream
+                .peek(System.out::println)
         .map(String::trim)
         .filter(_Strings::isNotEmpty)
         .filter(s->s.startsWith("repr-type"))
@@ -121,7 +127,7 @@ public enum RepresentationTypeSimplifiedV2 {
         .map(KeyValuePair::getValue)
         .filter(_Strings::isNotEmpty)
         .findAny()
-        .map(RepresentationTypeSimplifiedV2::trimFirstAndLastCharacter);
+        .map(RepresentationTypeSimplifiedV2::trimQuotesIfAny);
     }
 
 
diff --git a/api/applib/src/test/java/org/apache/isis/applib/client/RepresentationTypeSimplifiedV2Test.java b/api/applib/src/test/java/org/apache/isis/applib/client/RepresentationTypeSimplifiedV2Test.java
new file mode 100644
index 0000000..303c2ef
--- /dev/null
+++ b/api/applib/src/test/java/org/apache/isis/applib/client/RepresentationTypeSimplifiedV2Test.java
@@ -0,0 +1,43 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.applib.client;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import lombok.val;
+
+class RepresentationTypeSimplifiedV2Test {
+
+    @Test
+    void parseContentTypeHeaderString() {
+
+        val contentTypeHeaderString = "application/json;profile=\"urn:org.apache.isis/v2\";repr-type=value";
+
+        val representationType =
+                RepresentationTypeSimplifiedV2
+                .parseContentTypeHeaderString(contentTypeHeaderString)
+                .orElse(null);
+
+        assertEquals(RepresentationTypeSimplifiedV2.VALUE, representationType);
+
+    }
+
+}
diff --git a/core/pom.xml b/core/pom.xml
index 9960e5b..d6af6ba 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -170,8 +170,8 @@
 
 		<quartz-scheduler.version>2.3.2</quartz-scheduler.version>
 
-		<resteasy-spring-boot-starter.version>4.8.0.Final</resteasy-spring-boot-starter.version>
-		<resteasy.version>4.6.0.Final</resteasy.version> <!-- keep in sync with property defined in resteasy4-spring-boot-starter -->
+		<resteasy-spring-boot-starter.version>4.8.1.Final</resteasy-spring-boot-starter.version>
+		<resteasy.version>4.6.1.Final</resteasy.version> <!-- keep in sync with property defined in resteasy4-spring-boot-starter -->
 
 		<select2.version>4.0.13</select2.version>
 		<shiro.version>1.7.1</shiro.version>
diff --git a/starters/pom.xml b/starters/pom.xml
index 41db1a9..4e1c278 100644
--- a/starters/pom.xml
+++ b/starters/pom.xml
@@ -44,7 +44,7 @@
 		<spring-boot.version>2.5.2</spring-boot.version>
 		<approvaltests.version>11.7.0</approvaltests.version>
 		
-		<resteasy.version>4.6.0.Final</resteasy.version> <!-- keep in sync with property defined in resteasy4-spring-boot-starter -->
+		<resteasy.version>4.6.1.Final</resteasy.version> <!-- keep in sync with property defined in resteasy4-spring-boot-starter -->
 
 	</properties>