You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@turbine.apache.org by gk...@apache.org on 2017/07/04 11:00:03 UTC
svn commit: r1800753 - in /turbine/fulcrum/trunk/json: gson/xdocs/
jackson2/src/test/org/apache/fulcrum/json/jackson/
jackson2/src/test/org/apache/fulcrum/json/jackson/concurrent/
jackson2/xdocs/ xdocs/
Author: gk
Date: Tue Jul 4 11:00:03 2017
New Revision: 1800753
URL: http://svn.apache.org/viewvc?rev=1800753&view=rev
Log:
- update documentation and use more logger in tests.
Modified:
turbine/fulcrum/trunk/json/gson/xdocs/index.xml
turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/DefaultServiceTest.java
turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/JacksonMapperEnabledDefaultTypingTest.java
turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/JacksonMapperEnabledDefaultTyping_OBJECT_AND_NON_CONCRETE_Test.java
turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/JacksonMapperTest.java
turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/JsonPathJacksonTest.java
turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/concurrent/JSONConcurrentTest.java
turbine/fulcrum/trunk/json/jackson2/xdocs/index.xml
turbine/fulcrum/trunk/json/xdocs/index.xml
Modified: turbine/fulcrum/trunk/json/gson/xdocs/index.xml
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/json/gson/xdocs/index.xml?rev=1800753&r1=1800752&r2=1800753&view=diff
==============================================================================
--- turbine/fulcrum/trunk/json/gson/xdocs/index.xml (original)
+++ turbine/fulcrum/trunk/json/gson/xdocs/index.xml Tue Jul 4 11:00:03 2017
@@ -28,7 +28,7 @@
<body>
<section name="Overview">
- <p>The intent of this component is to provide a configurable and customized integration of JSON De-/Seriallizers ousing GSON, Jackson 1 and Jackson 2 APIs into Avalon/Turbine.
+ <p>The intent of this component is to provide a configurable and customized integration of JSON De-/Seriallizers using <a href="https://github.com/google/gson/">GSON</a>, Jackson 1 and Jackson 2 APIs into Avalon/Turbine.
It is written for use in Turbine but it can be used in any container compatible
with Avalon's ECM container. There are three implementations
Modified: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/DefaultServiceTest.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/DefaultServiceTest.java?rev=1800753&r1=1800752&r2=1800753&view=diff
==============================================================================
--- turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/DefaultServiceTest.java (original)
+++ turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/DefaultServiceTest.java Tue Jul 4 11:00:03 2017
@@ -1,5 +1,4 @@
package org.apache.fulcrum.json.jackson;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -31,6 +30,7 @@ import java.util.List;
import java.util.Map;
import org.apache.avalon.framework.logger.ConsoleLogger;
+import org.apache.avalon.framework.logger.Logger;
import org.apache.fulcrum.json.JsonService;
import org.apache.fulcrum.json.Rectangle;
import org.apache.fulcrum.json.TestClass;
@@ -61,10 +61,12 @@ import com.fasterxml.jackson.databind.se
public class DefaultServiceTest extends BaseUnit4Test {
private JsonService sc = null;
private final String preDefinedOutput = "{\"container\":{\"cf\":\"Config.xml\"},\"configurationName\":\"Config.xml\",\"name\":\"mytest\"}";
+ Logger logger;
@Before
public void setUp() throws Exception {
setLogLevel(ConsoleLogger.LEVEL_DEBUG);
+ logger = new ConsoleLogger(ConsoleLogger.LEVEL_DEBUG);
sc = (JsonService) this.lookup(JsonService.ROLE);
}
@@ -79,7 +81,7 @@ public class DefaultServiceTest extends
ObjectMapper objectMapper = customMapper(true);
String expected = "{\"type\":\"org.apache.fulcrum.json.TestClass\",\"container\":{\"type\":\"java.util.HashMap\",\"cf\":\"Config.xml\"},\"configurationName\":\"Config.xml\"}";
String serJson = customAllExceptFilter(objectMapper, new TestClass("mytest"), TestClass.class,"name");
- System.out.println("serJson:"+ serJson);
+ logger.debug("serJson:"+ serJson);
assertEquals("Serialization with custom mapper failed ",expected, serJson);
}
@@ -133,7 +135,7 @@ public class DefaultServiceTest extends
}
ObjectMapper objectMapper = customMapper(false);
String serJson = customAllExceptFilter(objectMapper, beanList, Bean.class,"name","profession");
- System.out.println("serJson:"+ serJson);
+ logger.debug("serJson:"+ serJson);
assertEquals("Serialization with custom mapper failed ",expected, serJson);
}
@@ -147,7 +149,7 @@ public class DefaultServiceTest extends
beanList.add(bean);
}
String serJson = sc.serializeAllExceptFilter(beanList, Bean.class, "name","profession");
- System.out.println("serJsonByService:"+ serJson);
+ logger.debug("serJsonByService:"+ serJson);
assertEquals("Serialization with service mapper failed",expected, serJson);
}
@@ -224,7 +226,7 @@ public class DefaultServiceTest extends
sc.setDateFormat(MMddyyyy);
String serJson = sc.ser(map);
- System.out.println("serJson:" + serJson);
+ logger.debug("serJson:" + serJson);
assertTrue("Serialize with Adapater failed ",
serJson.matches("\\{\"date\":\"\\d\\d-\\d\\d-\\d{4}\"\\}"));
}
@@ -307,7 +309,7 @@ public class DefaultServiceTest extends
String serColl = sc.ser(rectList);
TypeReference<List<Rectangle>> typeRef = new TypeReference<List<Rectangle>>(){};
Collection<Rectangle> resultList0 = sc.deSerCollection(serColl, typeRef, Rectangle.class);
- //System.out.println("resultList0 class:" +resultList0.getClass());
+ //logger.debug("resultList0 class:" +resultList0.getClass());
for (int i = 0; i < 10; i++) {
assertEquals("deser reread size failed", (i * i), ((List<Rectangle>)resultList0)
.get(i).getSize());
@@ -322,7 +324,7 @@ public class DefaultServiceTest extends
}
String serColl = sc.ser(rectList);
Collection<Rectangle> resultList0 = sc.deSerCollection(serColl, new ArrayList(), Rectangle.class);
- System.out.println("resultList0 class:" +resultList0.getClass());
+ logger.debug("resultList0 class:" +resultList0.getClass());
for (int i = 0; i < 10; i++) {
assertEquals("deser reread size failed", (i * i), ((List<Rectangle>)resultList0)
.get(i).getSize());
@@ -338,7 +340,7 @@ public class DefaultServiceTest extends
String serColl = sc.ser(rectList);
//Collection<Rectangle> resultList0 = sc.deSerCollection(serColl, List.class, Rectangle.class);
List<Rectangle> resultList0 = ((Jackson2MapperService)sc).deSerList(serColl, ArrayList.class,List.class, Rectangle.class);
- System.out.println("resultList0 class:" +resultList0.getClass());
+ logger.debug("resultList0 class:" +resultList0.getClass());
for (int i = 0; i < 10; i++) {
assertEquals("deser reread size failed", (i * i), resultList0
.get(i).getSize());
@@ -353,7 +355,7 @@ public class DefaultServiceTest extends
}
String serColl = sc.ser(rectList);
Map<String,Rectangle> resultList0 = ((Jackson2MapperService)sc).deSerMap(serColl, Map.class, String.class,Rectangle.class);
- System.out.println("resultList0 class:" +resultList0.getClass());
+ logger.debug("resultList0 class:" +resultList0.getClass());
for (int i = 0; i < 10; i++) {
assertEquals("deser reread size failed", (i * i), resultList0
.get(""+i).getSize());
@@ -532,7 +534,7 @@ public class DefaultServiceTest extends
}
TypeReference<List<TypedRectangle>> typeRef = new TypeReference<List<TypedRectangle>>(){};
String jsonResult = ((Jackson2MapperService)sc).serCollectionWithTypeReference(rectList,typeRef, false);
- System.out.println("aa:" +jsonResult);
+ logger.debug("aa:" +jsonResult);
// could deserialize with type information
Collection<TypedRectangle> result2 =checkDeserCollection(jsonResult, List.class, TypedRectangle.class);
assertTrue("expect at least one entry ", !result2.isEmpty());
@@ -540,12 +542,13 @@ public class DefaultServiceTest extends
}
@Test
- // jackson does not escape anything, except double quotes and backslash, you could provide
+ // jackson does not escape anything, except double quotes and backslash, additional characters could be provided
+ // by activationg escapeCharsGlobal xml characters are added
public void testSerializeHTMLEscape() throws Exception {
Rectangle filteredRect = new Rectangle(2, 3, "rectÃber<strong>StockundStein ï</strong></script><script>alert('xss')</script>" + 0);
String adapterSer = sc.ser(filteredRect);
- System.out.println(adapterSer);
- assertEquals("html entities ser",
+ logger.debug("Escaped serialized string:"+ adapterSer);
+ assertEquals("escaped html entities ser expected, iei <,>,&,\\ escaped (requires escapeCharsGlobal in json component configuration",
"{'w':2,'h':3,'name':'rectÃber\\u003Cstrong\\u003EStockundStein \\u0026iuml;\\u003C/strong\\u003E\\u003C/script\\u003E\\u003Cscript\\u003Ealert(\\u0027xss\\u0027)\\u003C/script\\u003E0','size':6}",
adapterSer.replace('"', '\''));
// you could set your own escapes here in class esc extending from CharacterEscapes.
Modified: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/JacksonMapperEnabledDefaultTypingTest.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/JacksonMapperEnabledDefaultTypingTest.java?rev=1800753&r1=1800752&r2=1800753&view=diff
==============================================================================
--- turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/JacksonMapperEnabledDefaultTypingTest.java (original)
+++ turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/JacksonMapperEnabledDefaultTypingTest.java Tue Jul 4 11:00:03 2017
@@ -82,7 +82,7 @@ public class JacksonMapperEnabledDefault
Map<String, Date> map = new HashMap<String, Date>();
map.put("date", Calendar.getInstance().getTime());
String serJson = sc.ser(map);
- System.out.println("serJson:" +serJson);
+ logger.debug("serJson:" +serJson);
assertEquals(
"Serialize with Adapater failed ",true,
serJson.matches(".*\"java.util.Date\",\"\\d\\d/\\d\\d/\\d{4}\".*"));
@@ -92,9 +92,9 @@ public class JacksonMapperEnabledDefault
Map<String, Date> map = new HashMap<String, Date>();
map.put("date", Calendar.getInstance().getTime());
String serJson0 = sc.ser(map);
- System.out.println("serJson0:"+ serJson0);
+ logger.debug("serJson0:"+ serJson0);
String serJson = sc.ser(map, Map.class);
- System.out.println("serJsonwithmap:"+ serJson);
+ logger.debug("serJsonwithmap:"+ serJson);
Map<String, Date> serDate = sc.deSer(serJson, Map.class);
assertEquals("Date DeSer failed ", Date.class, serDate.get("date")
.getClass());
@@ -139,7 +139,7 @@ public class JacksonMapperEnabledDefault
private <T> T checkDeserialization(String serJson, Class<T> target, Class mixin) throws Exception {
sc.addAdapter("TestClass Adapter", target, mixin);
T result = sc.deSer(serJson,target);
- //System.out.println("result:"+ result + " is of type "+ target.getName());
+ //logger.debug("result:"+ result + " is of type "+ target.getName());
assertTrue("result instance check", target.isAssignableFrom(result.getClass()));
return result;
}
Modified: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/JacksonMapperEnabledDefaultTyping_OBJECT_AND_NON_CONCRETE_Test.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/JacksonMapperEnabledDefaultTyping_OBJECT_AND_NON_CONCRETE_Test.java?rev=1800753&r1=1800752&r2=1800753&view=diff
==============================================================================
--- turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/JacksonMapperEnabledDefaultTyping_OBJECT_AND_NON_CONCRETE_Test.java (original)
+++ turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/JacksonMapperEnabledDefaultTyping_OBJECT_AND_NON_CONCRETE_Test.java Tue Jul 4 11:00:03 2017
@@ -84,7 +84,7 @@ public class JacksonMapperEnabledDefault
Map<String, Date> map = new HashMap<String, Date>();
map.put("date", Calendar.getInstance().getTime());
String serJson = sc.ser(map);
- System.out.println("serJson:" +serJson);
+ logger.debug("serJson:" +serJson);
assertTrue(
"Serialize with Adapater failed ",
serJson.matches(".*\"java.util.Date\",\"\\d\\d/\\d\\d/\\d{4}\".*"));
@@ -99,7 +99,7 @@ public class JacksonMapperEnabledDefault
map.put("mydate2",mydate2.getTime());
String serJson0 = sc.ser(map, false);
String serJson = sc.ser(map, Map.class, false);
- System.out.println("serJson:"+ serJson0);
+ logger.debug("serJson:"+ serJson0);
assertEquals(serJson0, serJson);
//sc.addAdapter("Collection Adapter", Object.class, DateKeyMixin.class);
DateKeyMixin serObject =sc.deSer(serJson0, DateKeyMixin.class);
@@ -304,7 +304,7 @@ public class JacksonMapperEnabledDefault
}
String result = sc.addAdapter("M4RMixin", Bean.class, BeanMixin.class)
.ser(beanList);
- System.out.println("result:::"+ result);
+ logger.debug("result:::"+ result);
// Type List.class / TypeReference -> Exception: need JSON String that contains type id (for subtype of java.util.List)
// Type: Bean.class -> Exception: Can not deserialize instance of org.apache.fulcrum.json.jackson.Bean out of START_ARRAY token
Modified: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/JacksonMapperTest.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/JacksonMapperTest.java?rev=1800753&r1=1800752&r2=1800753&view=diff
==============================================================================
--- turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/JacksonMapperTest.java (original)
+++ turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/JacksonMapperTest.java Tue Jul 4 11:00:03 2017
@@ -334,7 +334,7 @@ public class JacksonMapperTest extends B
List typeRectList = new ArrayList(); //empty
// could not use Mixins here, but Adapters are still set
Collection<Rectangle> resultList0 = sc.deSerCollection(deSerTest, typeRectList, Rectangle.class);
- System.out.println("resultList0 class:" +resultList0.getClass());
+ logger.debug("resultList0 class:" +resultList0.getClass());
for (int i = 0; i < 5; i++) {
// name and h should be null as it is ignored, cft. Mixin
assertTrue(((List<Rectangle>)resultList0).get(i).getName()==null);
@@ -342,9 +342,9 @@ public class JacksonMapperTest extends B
}
// could not use Mixins here, but Adapters are still set
Collection<Bean> resultList1 = sc.deSerCollection(deSerTest, typeRectList, Bean.class);
- System.out.println("resultList1 class:" +resultList1.getClass());
+ logger.debug("resultList1 class:" +resultList1.getClass());
for (int i = 0; i < 5; i++) {
- System.out.println("resultList1 "+i+ " name:"+((List<Bean>)resultList1).get(i).getName());
+ logger.debug("resultList1 "+i+ " name:"+((List<Bean>)resultList1).get(i).getName());
// name should NOT be null, age should be ignored, cft. BeanMixin
assertTrue(((List<Bean>)resultList1).get(i).getName()!=null);
assertTrue(((List<Bean>)resultList1).get(i).getAge()==0);
Modified: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/JsonPathJacksonTest.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/JsonPathJacksonTest.java?rev=1800753&r1=1800752&r2=1800753&view=diff
==============================================================================
--- turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/JsonPathJacksonTest.java (original)
+++ turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/JsonPathJacksonTest.java Tue Jul 4 11:00:03 2017
@@ -66,14 +66,14 @@ public class JsonPathJacksonTest extends
logger = new ConsoleLogger(ConsoleLogger.LEVEL_DEBUG);
try {
Configuration conf = Configuration.defaultConfiguration();
- System.out.println("jayway jsonpath conf:"+ conf.jsonProvider());
+ logger.debug("jayway jsonpath conf:"+ conf.jsonProvider());
assertEquals("Jackson JsonPath JsonProvider match failed ", JacksonJsonProvider.class.getName(), conf.jsonProvider().getClass().getName());
- System.out.println("Jackson2MapperService.mapper:"+ ((Jackson2MapperService)sc).getMapper() + " confjsonProvider:" + conf.jsonProvider());
+ logger.debug("Jackson2MapperService.mapper:"+ ((Jackson2MapperService)sc).getMapper() + " confjsonProvider:" + conf.jsonProvider());
assertTrue("JsonProvider is not a JacksonJsonProvider ", conf.jsonProvider() instanceof JacksonJsonProvider);
assertEquals("JacksonJsonProvider mapper is not configured mapper", ((Jackson2MapperService)sc).getMapper(), ((JacksonJsonProvider)conf.jsonProvider()).getObjectMapper());
} catch (Throwable e) {
if (e.getCause() != null && e.getCause() instanceof ClassNotFoundException) {
- System.out.println(e.getCause());
+ logger.error(e.getMessage(), e.getCause());
fail("Check correct initialization with useJsonPath = true):");
} else {
fail(e.getMessage());
@@ -85,7 +85,7 @@ public class JsonPathJacksonTest extends
@Test
public void testSerialize() throws Exception {
String serJson = sc.ser(new TestClass("mytest"));
- System.out.println("serJson:"+ serJson);
+ logger.debug("serJson:"+ serJson);
String cf = JsonPath.parse(serJson).read("$.container.cf");// .using(conf)
assertEquals("Serialization failed ", "Config.xml", cf);
}
@@ -130,7 +130,7 @@ public class JsonPathJacksonTest extends
// could not use as TestClass constructor generates configurationName again
//String serJson = sc.serializeAllExceptFilter(new TestClass("mytest"), "configurationName");
String serJson = sc.serializeAllExceptFilter(new TestClass("mytest"), "name");
- System.out.println("serJson: "+ serJson);
+ logger.debug("serJson: "+ serJson);
TypeRef<TestClass> typeRef = new TypeRef<TestClass>() { };
// could not use as TestClass constructor generates configurationName again
TestClass result = JsonPath.parse(serJson).read("$",typeRef); // TestClass.class
@@ -146,7 +146,7 @@ public class JsonPathJacksonTest extends
rectList.add(filteredRect);
}
String serColl = sc.ser(rectList);
- System.out.println("serColl: "+ serColl);
+ logger.debug("serColl: "+ serColl);
TypeRef<List<Rectangle>> typeRef = new TypeRef<List<Rectangle>>() { };
List<Rectangle> result = JsonPath.parse(serColl).read("$",typeRef);
//System.out.println("result: "+ result);
Modified: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/concurrent/JSONConcurrentTest.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/concurrent/JSONConcurrentTest.java?rev=1800753&r1=1800752&r2=1800753&view=diff
==============================================================================
--- turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/concurrent/JSONConcurrentTest.java (original)
+++ turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/concurrent/JSONConcurrentTest.java Tue Jul 4 11:00:03 2017
@@ -31,7 +31,6 @@ import java.util.Collection;
import java.util.List;
import java.util.Random;
import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
import org.apache.avalon.framework.component.ComponentException;
import org.apache.fulcrum.json.JsonService;
Modified: turbine/fulcrum/trunk/json/jackson2/xdocs/index.xml
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/json/jackson2/xdocs/index.xml?rev=1800753&r1=1800752&r2=1800753&view=diff
==============================================================================
--- turbine/fulcrum/trunk/json/jackson2/xdocs/index.xml (original)
+++ turbine/fulcrum/trunk/json/jackson2/xdocs/index.xml Tue Jul 4 11:00:03 2017
@@ -28,7 +28,7 @@
<body>
<section name="Overview">
- <p>This component is to provide a configurable and customized integration of JSON De-/Serializer Jackson 2 JSON Processing APIs into Avalon/Turbine.
+ <p>This component is to provide a configurable and customized integration of JSON De-/Serializer <a href="http://wiki.fasterxml.com/JacksonHome">Jackson 2 JSON Processing APIs</a> into Avalon/Turbine.
</p>
</section>
Modified: turbine/fulcrum/trunk/json/xdocs/index.xml
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/json/xdocs/index.xml?rev=1800753&r1=1800752&r2=1800753&view=diff
==============================================================================
--- turbine/fulcrum/trunk/json/xdocs/index.xml (original)
+++ turbine/fulcrum/trunk/json/xdocs/index.xml Tue Jul 4 11:00:03 2017
@@ -28,7 +28,7 @@
<body>
<section name="Overview">
- <p>The intent of this component is to provide a configurable and customized integration of JSON De-/Serializers using GSON, Jackson 1 and Jackson 2 APIs into Avalon/Turbine. It is a common pattern with client-side MVC applications to embed data for a base set of objects in a page instead of making a separate AJAX request to load them.
+ <p>The intent of this component is to provide a configurable and customized integration of JSON De-/Serializers using <a href="https://github.com/google/gson/">GSON</a>, <a href="http://wiki.fasterxml.com/JacksonHome">Jackson 1 and Jackson 2 APIs</a> into Avalon/Turbine. It is a common pattern with client-side MVC applications to embed data for a base set of objects in a page instead of making a separate AJAX request to load them.
It is written for use in Turbine but it can be used in any container compatible
with Avalon's ECM container. There are three implementations
@@ -115,7 +115,23 @@
This implicits, that you cannot retrieve for the same class/bean different properties in different calls.
Otherwise different serializations per call are possible. You could invalidate (refresh) the cache per class, in most methods providing a Boolean parameter, cft. method parameters named <code>refresh*</code> or <code>clean*</code>. The default value is <code>true</code>.
</td>
- </tr>
+ </tr>
+ <tr>
+ <td>escapeCharsGlobal</td>
+ <td>boolean</td>
+ <td>[0|1]</td>
+ <td>
+ If set to <code>true</code>, by default ASCII characters <= 32 character code and the four characters '<','>','&','\' (backslash) are escaped using com.fasterxml.jackson.core.io.CharacterEscapes.ESCAPE_STANDARD ('\u'). for details cft. com.fasterxml.jackson.core.io.CharTypes. The default value is <code>false</code>.
+ </td>
+ </tr>
+ <tr>
+ <td>useJsonPath</td>
+ <td>boolean</td>
+ <td>[0|1]</td>
+ <td>
+ If set to <code>true</code>, JsonPath is enabled, which allows to apply JsonPath expressions using the integrated jackson provider by default (without setting this property to <code>true</code>, com.jayway.jsonpath.spi.mapper.JsonSmartMappingProvider will be used and would need to implement net.minidev.json.writer.JsonReaderI by default - which would fail as net.minidev.json package is excluded from dependencies; you would need to include this transitive dependency manually). The default value is <code>false</code>.
+ </td>
+ </tr>
</table>
</subsection>
<subsection name="Component Configuration Example">
@@ -138,7 +154,9 @@
</annotationInspectors>
<dateFormat>MM/dd/yyyy</dateFormat>
<defaultTyping type="NON_FINAL" key="type"/><!-- or e.g. OBJECT_AND_NON_CONCRETE -->
- <!-- cacheFilters>false</cacheFilters>
+ <!-- cacheFilters>false</cacheFilters -->
+ <!-- <escapeCharsGlobal>true</escapeCharsGlobal> -->
+ <useJsonPath>true</useJsonPath>
</json>
]]></source>
<p>Jackson Version 1.9.x</p>
@@ -203,7 +221,7 @@ JsonService jsonService = (JsonService)T
<h4>Configuration Requirements</h4>
<p>
- Add <code>org.apache.fulcrum.json.jackson.SimpleNameIntrospector</code> to the annotation inspectors as primary or secondary inspector. <strong>[CHANGE in Version 1.1.0]</strong> SimpleNameIntrospector now extends from <a href="https://github.com/FasterXML/jackson-databind/blob/master/src/main/java/com/fasterxml/jackson/databind/introspect/NopAnnotationIntrospector.java">NopAnnotationIntrospector</a> to cleary divide responsibilities. Default introspector e.g. JacksonAnnotationIntrospector could be provided as a primary/secondary introspector in <a href="#compconf">Component Configuration</a>.
+ Add <code>org.apache.fulcrum.json.jackson.SimpleNameIntrospector</code> to the annotation inspectors as primary or secondary inspector. <strong>[CHANGE in Version 1.1.0]:</strong> SimpleNameIntrospector now extends from <a href="https://github.com/FasterXML/jackson-databind/blob/master/src/main/java/com/fasterxml/jackson/databind/introspect/NopAnnotationIntrospector.java">NopAnnotationIntrospector</a> to cleary divide responsibilities. Default introspector e.g. JacksonAnnotationIntrospector could be provided as a primary/secondary introspector in <a href="#compconf">Component Configuration</a>.
</p>
</subsection>
@@ -280,6 +298,14 @@ JsonService jsonService = (JsonService)T
<code>MM/dd/yyyy</code>.
</td>
</tr>
+ <tr>
+ <td>useJsonPath</td>
+ <td>boolean</td>
+ <td>[0|1]</td>
+ <td>
+ If set to <code>true</code>, JsonPath is enabled, which allows to apply JsonPath expressions using the integrated gson provider by default. The default value is <code>false</code>. For more information see jackson2 component configuration property description.
+ </td>
+ </tr>
</table>
</subsection>
@@ -290,6 +316,7 @@ JsonService jsonService = (JsonService)T
<globalAdapters>>
<adapter forClass="x.y.z.Class">a.b.c.d.AdapterForClassXYZ</adapter-->
</globalAdapters>
+ <useJsonPath>true</useJsonPath>
</json>
]]></source>
</subsection>