Return-Path: X-Original-To: apmail-cxf-issues-archive@www.apache.org Delivered-To: apmail-cxf-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A43F875EF for ; Thu, 29 Dec 2011 13:33:53 +0000 (UTC) Received: (qmail 88509 invoked by uid 500); 29 Dec 2011 13:33:53 -0000 Delivered-To: apmail-cxf-issues-archive@cxf.apache.org Received: (qmail 88491 invoked by uid 500); 29 Dec 2011 13:33:53 -0000 Mailing-List: contact issues-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list issues@cxf.apache.org Received: (qmail 88483 invoked by uid 99); 29 Dec 2011 13:33:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Dec 2011 13:33:53 +0000 X-ASF-Spam-Status: No, hits=-2001.3 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; Thu, 29 Dec 2011 13:33:52 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id B0CAE12FB19 for ; Thu, 29 Dec 2011 13:33:31 +0000 (UTC) Date: Thu, 29 Dec 2011 13:33:31 +0000 (UTC) From: "Sergey Beryozkin (Commented) (JIRA)" To: issues@cxf.apache.org Message-ID: <1529071519.51454.1325165611725.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <876739472.8285.1318978391139.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (CXF-3861) Allow indentation of xml and json based on query parameter 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/CXF-3861?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13177169#comment-13177169 ] Sergey Beryozkin commented on CXF-3861: --------------------------------------- Hi, finally with Jettison 1.3.1 it is possible to optionally produce a formatted output. However I don't see at the moment how we can support a generic 'indent' (or similar) query because we have no control over the way say Jackson may do it or other XML providers (those working with JAXP Source for ex). The workaround is to register a custom output handler which can check whatever custom query is used to request the optional indentation: http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/FormatResponseHandler.java JAXBElementProvider and JSONProvider are driven by the JAXB Marshaller so by default they check a Marshaller.JAXB_FORMATTED_OUTPUT property on the current message. If needed we can also think of some other (internal) property name to be used by all the providers that CXF ships and which produce XML or JSON, but at the moment I believe that using Marshaller.JAXB_FORMATTED_OUTPUT to control the default JAXB & JSON providers is OK Given that the above is not strictly a 'fix' for this issue, I'll close as it as won't fix, see CXF-4000 for more info > Allow indentation of xml and json based on query parameter > ----------------------------------------------------------- > > Key: CXF-3861 > URL: https://issues.apache.org/jira/browse/CXF-3861 > Project: CXF > Issue Type: Improvement > Components: JAX-RS > Affects Versions: 2.4.3 > Reporter: Jason Chaffee > > I would like to be able to force indent based on a query parameter so that we are not indenting on every call, but only when we need to. > For example, > http://localhost:8080/services/customer?indent=true > It would be nice if indent would accept (yes|y|true|on). > The code might look as follows for the JaxbElementProvider (not sure about Json). > In the marshal method: > if (("on".equalsIgnoreCase(indent)) || > ("yes".equalsIgnoreCase(indent)) || > ("true".equalsIgnoreCase(indent))) { > ms.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); > } -- 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