You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Stijn Van Bael (JIRA)" <ji...@apache.org> on 2015/04/29 14:51:06 UTC

[jira] [Created] (CAMEL-8720) Support custom data formats on individual REST DSL routes

Stijn Van Bael created CAMEL-8720:
-------------------------------------

             Summary: Support custom data formats on individual REST DSL routes
                 Key: CAMEL-8720
                 URL: https://issues.apache.org/jira/browse/CAMEL-8720
             Project: Camel
          Issue Type: Wish
          Components: rest
    Affects Versions: 2.15.1
            Reporter: Stijn Van Bael


It would be nice if I could select a custom data format for an individual REST DSL route to marshal objects differently.

For example: Say I have a REST service that returns company data including the company's employees. But when I get an individual employee, I want to include the URI of the company in the response. So I defined a "json-standalone" data format that uses a different Jackson view.

rest("/companies/{companyId}")
  .get()

rest("/employees/{employeeId}")
  .get()
  .dataFormat("json-standalone")

@Bean(name = "json-standalone")
@Scope("prototype")
public JacksonDataFormat dataFormat() {
    return new JacksonDataFormat(objectMapper, HashMap.class, JsonViews.Standalone.class);
}





--
This message was sent by Atlassian JIRA
(v6.3.4#6332)