From issues-return-16657-apmail-struts-issues-archive=struts.apache.org@struts.apache.org Fri Nov 18 18:41:13 2011 Return-Path: X-Original-To: apmail-struts-issues-archive@minotaur.apache.org Delivered-To: apmail-struts-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 766639E4C for ; Fri, 18 Nov 2011 18:41:13 +0000 (UTC) Received: (qmail 46172 invoked by uid 500); 18 Nov 2011 18:41:13 -0000 Delivered-To: apmail-struts-issues-archive@struts.apache.org Received: (qmail 46147 invoked by uid 500); 18 Nov 2011 18:41:13 -0000 Mailing-List: contact issues-help@struts.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@struts.apache.org Delivered-To: mailing list issues@struts.apache.org Received: (qmail 46140 invoked by uid 99); 18 Nov 2011 18:41:13 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Nov 2011 18:41:13 +0000 X-ASF-Spam-Status: No, hits=-2001.2 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Nov 2011 18:41:11 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id A1B7A8E517 for ; Fri, 18 Nov 2011 18:40:51 +0000 (UTC) Date: Fri, 18 Nov 2011 18:40:51 +0000 (UTC) From: "Hudson (Commented) (JIRA)" To: issues@struts.apache.org Message-ID: <749061175.44406.1321641651663.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1653003550.13750.1305455627667.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (WW-3629) Provide a JSON Content Handler based on Jackson Lib MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/WW-3629?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13153032#comment-13153032 ] Hudson commented on WW-3629: ---------------------------- Integrated in Struts2 #374 (See [https://builds.apache.org/job/Struts2/374/]) WW-3629: Provide a JSON Content Handler based on Jackson Lib jogep : Files : * /struts/struts2/trunk/plugins/rest/pom.xml * /struts/struts2/trunk/plugins/rest/src/main/java/org/apache/struts2/rest/handler/JacksonLibHandler.java * /struts/struts2/trunk/plugins/rest/src/test/java/org/apache/struts2/rest/handler/JacksonLibHandlerTest.java > Provide a JSON Content Handler based on Jackson Lib > --------------------------------------------------- > > Key: WW-3629 > URL: https://issues.apache.org/jira/browse/WW-3629 > Project: Struts 2 > Issue Type: Improvement > Components: Plugin - REST > Reporter: Johannes Geppert > Assignee: Johannes Geppert > Priority: Minor > Labels: handler, json > Fix For: 2.3 > > Original Estimate: 4h > Remaining Estimate: 4h > > Provide a JSON Content Handler based on Jackson Lib: > http://jackson.codehaus.org/ > Jackson is a: > Streaming (reading, writing) > FAST (measured to be faster than any other Java json parser and data binder) > Powerful (full data binding for common JDK classes as well as any Java bean class, Collection, Map or Enum) > Zero-dependency (does not rely on other packages beyond JDK) > Open Source (LGPL or AL) > Fully conformant > Extremely configurable > JSON processor (JSON parser + JSON generator) written in Java. Beyond basic JSON reading/writing (parsing, generating), it also offers full node-based Tree Model, as well as full OJM (Object/Json Mapper) data binding functionality. > A Content Handler can look like this: > import java.io.IOException; > import java.io.Writer; > import org.codehaus.jackson.JsonGenerationException; > import org.codehaus.jackson.map.JsonMappingException; > import org.codehaus.jackson.map.ObjectMapper; > import org.codehaus.jackson.map.SerializationConfig.Feature; > public class JsonContentHandler implements ContentHandler { > public void fromObject(Object object, Writer writer) { > try { > ObjectMapper objectMapper = new ObjectMapper(); > objectMapper.configure(Feature.WRITE_NULL_MAP_VALUES, false); > objectMapper.writeValue(writer, object); > } catch (JsonGenerationException e) { > e.printStackTrace(); > } catch (JsonMappingException e) { > e.printStackTrace(); > } catch (IOException e) { > e.printStackTrace(); > } > } > public String getContentType() { > return "application/json"; > } > public String getExtension() { > return "json"; > } > } -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira