diff --git a/CHANGELOG.md b/CHANGELOG.md
index a0acbfd..c999a9f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,20 +4,13 @@ Proteus Changelog.
## Unreleased
### No issue
-**Cleanup JsonViewWrapper.**
-
-
-[dc95a16a710813a](https://github.com/noboomu/proteus/commit/dc95a16a710813a) Joshua Bauer *2020-01-31 01:04:26*
-
-**Improvements to JsonViewWrapper.**
-
-
-[ead870ae6ad73d9](https://github.com/noboomu/proteus/commit/ead870ae6ad73d9) Joshua Bauer *2020-01-31 01:02:12*
-
**Update readme.**
+ * Improvements to JsonViewWrapper.
+ * Cleanup JsonViewWrapper.
+ * More JSON work.
-[7bfd78a09ba642d](https://github.com/noboomu/proteus/commit/7bfd78a09ba642d) Joshua Bauer *2020-01-31 00:39:35*
+[594682feb70b27d](https://github.com/noboomu/proteus/commit/594682feb70b27d) Joshua Bauer *2020-01-31 01:23:26*
**Improve JSON view handling.**
diff --git a/pom.xml b/pom.xml
index b6e3830..0725272 100644
--- a/pom.xml
+++ b/pom.xml
@@ -103,54 +103,72 @@
-
-
- sonatype-snapshots
- https://oss.sonatype.org/content/repositories/snapshots
-
- true
-
-
- false
-
-
-
+
+ com.fasterxml.jackson
+ jackson-bom
+ ${jackson.version}
+ import
+ pom
+
+
io.sinistral
proteus-core
- ${proteus.version}
+ ${project.version}
io.sinistral
proteus-openapi
- ${proteus.version}
+ ${project.version}
-
io.sinistral
proteus-swagger
- ${proteus.version}
+ ${project.version}
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- ossrh
+ sonatype-nexus-snapshots
https://oss.sonatype.org/content/repositories/snapshots
- ossrh
+ sonatype-nexus-staging
https://oss.sonatype.org/service/local/staging/deploy/maven2/
@@ -160,17 +178,107 @@
+
- org.apache.maven.plugins
- maven-compiler-plugin
- ${maven-compiler-plugin.version}
-
-
- 1.8
- -parameters
-
-
+ maven-surefire-plugin
+ ${maven-surefire-plugin.version}
+
+
+ org.apache.maven.surefire
+ surefire-junit47
+ ${maven-surefire-plugin.version}
+
+
+
+ -Dconfig.file=src/test/resources/application.conf
+ -Dlogback.configuration=src/test/resources/logback-test.xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+
+
+
+ ${maven-javadoc-plugin.version}
+
+
+ attach-javadocs
+
+ jar
+
+
+ none
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ ${maven-compiler-plugin.version}
+
+
+ 1.8
+ -parameters
+
+
+
+
maven-jar-plugin
@@ -184,6 +292,26 @@
+
+
+ org.apache.maven.plugins
+ maven-enforcer-plugin
+
+
+ enforce-versions
+
+ enforce
+
+
+
+
+ 1.8
+
+
+
+
+
+
maven-surefire-plugin
${maven-surefire-plugin.version}
@@ -199,17 +327,7 @@
-Dlogback.configuration=src/test/resources/logback-test.xml
-
- org.sonatype.plugins
- nexus-staging-maven-plugin
- ${nexus-staging-maven-plugin.version}
- true
-
- ossrh
- https://oss.sonatype.org/
- true
-
-
+
org.apache.maven.plugins
maven-release-plugin
@@ -217,7 +335,7 @@
true
v@{project.version}
- ossrh
+ central
deploy
@@ -229,126 +347,6 @@
-
- org.apache.maven.plugins
- maven-source-plugin
- ${maven-source-plugin.version}
-
-
- attach-sources
-
- jar-no-fork
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-javadoc-plugin
-
-
-
- ${maven-javadoc-plugin.version}
-
-
- attach-javadocs
-
- jar
-
-
- none
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-gpg-plugin
- ${maven-gpg-plugin.version}
-
-
- sign-artifacts
- verify
-
- sign
-
-
-
-
- gpg
-
-
-
- org.sonatype.plugins
- nexus-staging-maven-plugin
- ${nexus-staging-plugin.version}
- true
-
- ossrh
- https://oss.sonatype.org/
- true
-
-
-
- org.apache.maven.plugins
- maven-release-plugin
- ${maven-release-plugin.version}
-
- true
- v@{project.version}
- ossrh
- deploy
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- ${maven-compiler-plugin.version}
-
-
- 1.8
- -parameters
-
-
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
-
-
- enforce-versions
-
- enforce
-
-
-
-
- 1.8
-
-
-
-
-
-
-
- maven-surefire-plugin
- ${maven-surefire-plugin.version}
-
-
- org.apache.maven.surefire
- surefire-junit47
- ${maven-surefire-plugin.version}
-
-
-
- -Dconfig.file=src/test/resources/application.conf
- -Dlogback.configuration=src/test/resources/logback-test.xml
-
-
@@ -360,4 +358,82 @@
+
+
+
+ central
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ ${maven-source-plugin.version}
+
+
+ attach-sources
+
+ jar-no-fork
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ ${maven-javadoc-plugin.version}
+
+
+
+
+
+ attach-javadocs
+
+ jar
+
+
+ none
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-gpg-plugin
+ ${maven-gpg-plugin.version}
+
+
+ sign-artifacts
+ verify
+
+ sign
+
+
+ gpg
+
+
+
+
+
+
+
+ org.sonatype.plugins
+ nexus-staging-maven-plugin
+ ${nexus-staging-maven-plugin.version}
+ true
+
+ sonatype-nexus-stagin
+ https://oss.sonatype.org/
+ true
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/proteus-core/pom.xml b/proteus-core/pom.xml
index b9c79ed..953d38c 100644
--- a/proteus-core/pom.xml
+++ b/proteus-core/pom.xml
@@ -252,43 +252,49 @@ Proteus Changelog.
com.fasterxml.jackson.core
jackson-annotations
- ${jackson.version}
-
+
com.fasterxml.jackson.core
jackson-core
- ${jackson.version}
-
+
com.fasterxml.jackson.dataformat
jackson-dataformat-xml
- ${jackson.version}
-
+
com.fasterxml.jackson.dataformat
jackson-dataformat-yaml
- ${jackson.version}
+
+
+
+ com.fasterxml.jackson.module
+ jackson-module-parameter-names
com.fasterxml.jackson.module
jackson-module-afterburner
- ${jackson.version}
-
+
+
com.fasterxml.jackson.datatype
jackson-datatype-jdk8
- ${jackson.version}
+
+
+
+ com.fasterxml.jackson.datatype
+ jackson-datatype-jsr310
com.fasterxml.jackson.core
jackson-databind
- ${jackson.version}
-
+
+
+
org.apache.commons
commons-lang3
diff --git a/proteus-core/src/main/java/io/sinistral/proteus/modules/JacksonModule.java b/proteus-core/src/main/java/io/sinistral/proteus/modules/JacksonModule.java
index b66e00e..10e59ef 100644
--- a/proteus-core/src/main/java/io/sinistral/proteus/modules/JacksonModule.java
+++ b/proteus-core/src/main/java/io/sinistral/proteus/modules/JacksonModule.java
@@ -3,7 +3,9 @@
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.fasterxml.jackson.module.afterburner.AfterburnerModule;
+import com.fasterxml.jackson.module.paramnames.ParameterNamesModule;
import com.google.inject.AbstractModule;
public class JacksonModule extends AbstractModule
@@ -19,8 +21,11 @@ protected void configure()
objectMapper.configure(DeserializationFeature.EAGER_DESERIALIZER_FETCH, true);
objectMapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
objectMapper.configure(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS, true);
+
objectMapper.registerModule(new AfterburnerModule());
objectMapper.registerModule(new Jdk8Module());
+ objectMapper.registerModule(new JavaTimeModule());
+ objectMapper.registerModule(new ParameterNamesModule());
this.bind(ObjectMapper.class).toInstance(objectMapper);
}
diff --git a/proteus-core/src/main/java/io/sinistral/proteus/server/ServerResponse.java b/proteus-core/src/main/java/io/sinistral/proteus/server/ServerResponse.java
index 996ea59..be160af 100644
--- a/proteus-core/src/main/java/io/sinistral/proteus/server/ServerResponse.java
+++ b/proteus-core/src/main/java/io/sinistral/proteus/server/ServerResponse.java
@@ -638,7 +638,7 @@ public void send(final HttpHandler handler, final HttpServerExchange exchange) t
exchange.getResponseSender().send(ByteBuffer.wrap(XML_MAPPER.writeValueAsBytes(this.entity)));
} else {
- final Class> jsonViewClass = exchange.getAttachment(JsonViewWrapper.JSON_VIEW_KEY);
+ final Class jsonViewClass = exchange.getAttachment(JsonViewWrapper.JSON_VIEW_KEY);
if(jsonViewClass != null)
{
diff --git a/proteus-core/src/main/java/io/sinistral/proteus/wrappers/JsonViewWrapper.java b/proteus-core/src/main/java/io/sinistral/proteus/wrappers/JsonViewWrapper.java
index 39048a0..e6f30a3 100644
--- a/proteus-core/src/main/java/io/sinistral/proteus/wrappers/JsonViewWrapper.java
+++ b/proteus-core/src/main/java/io/sinistral/proteus/wrappers/JsonViewWrapper.java
@@ -18,7 +18,7 @@
@Singleton
public class JsonViewWrapper implements HandlerWrapper
{
- public static AttachmentKey> JSON_VIEW_KEY = AttachmentKey.create(Class.class);
+ public static AttachmentKey JSON_VIEW_KEY = AttachmentKey.create(Class.class);
private static final Logger logger = LoggerFactory.getLogger(JsonViewWrapper.class.getName());
@@ -36,7 +36,7 @@ public class JsonViewWrapper implements HandlerWrapper
private Map CLASS_MAP = new ConcurrentHashMap<>();
- private Class> defaultViewClass = null;
+ private Class defaultViewClass = null;
public JsonViewWrapper()
{
@@ -46,11 +46,11 @@ public JsonViewWrapper()
try {
- Class> clazz = Class.forName(VIEW_CLASS_NAME);
+ Class clazz = Class.forName(VIEW_CLASS_NAME);
- final Class>[] contexts = clazz.getClasses();
+ final Class[] contexts = clazz.getClasses();
- for (Class> c : contexts) {
+ for (Class c : contexts) {
CLASS_MAP.put(c.getSimpleName().toLowerCase(), c);
}
@@ -79,7 +79,7 @@ public HttpHandler wrap(HttpHandler handler)
.map(Deque::getFirst).orElse(null);
if(className != null) {
- Class> viewClass = CLASS_MAP.getOrDefault(className, defaultViewClass);
+ Class viewClass = CLASS_MAP.getOrDefault(className, defaultViewClass);
exchange.putAttachment(JSON_VIEW_KEY, viewClass);
}