com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_link3' is unknown.

JAX-RS Sample on Content Negotiation

Introducing the Sample

This sample demonstrates how to implement content negotiation in the Application Server. Content negotiation is a mechanism which allows to maintain multiple representations of the same resource, and serve the particular representation relevant to a given request and what the requesting server needs.

Infor

For more information on content negotiation , refer to http://en.wikipedia.org/wiki/Content_negotiation

The REST server provides the following services:  

<Customer>
   <id>123</id>
   <name>John</name>
</Customer>
{"Customer":{"id":"123","name":"John"}}
  • A HTTP GET request to URL http://localhost:9000/customerservice/customers/123 without setting "accept header" explicitly, returns a customer instance in JSON  format. This is because the accept header will be absent from the request when using HTTP Client. In that case, the CXF will treat the "Accept" content type as "*/*". The JSON document returns:
{"Customer":{"id":"123","name":"John"}}

Building and Running the Sample    

Using Maven

1. Install and run the WSO2 Application Server. Refer to the  Installing Features for instructions.

2. From the base directory of this sample ( <CARBON_HOME>\samples\Jaxws-Jaxrs\ jaxrs_content_negotiation) , the maven pom.xml file can be used to build and run the sample using either UNIX or Windows.

3. To build the sample and create a WAR file, run mvn clean install command.

4. Start the Application Server (run bin/wso2server.sh/.bat).

  • mvn -Pdeploy (deploys the generated WAR file on WSO2 AS with related logs on the console)
  • mvn -Pclient (runs the client)

Using Apache Ant  

  1. Run "ant" on  <CARBON_HOME>\samples\Jaxws-Jaxrs\ jaxrs_content_negotiation directory to deploy the "jaxrs_content_negotiation" service on the server.

2. Start the application server and access its Management Console at https://localhost:9443/carbon.

3. Go to "Services -> List" menu to find the "jaxrs_content_negotiation" service listed on the "Deployed Services" window.

4. Execute "sh run-client.sh" or "run-client.bat" to run the client.

5. Try the sample with different QoS options which appear on its dashboard. Run "sh run-client.sh -help" for different options.


com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links2' is unknown.