Search This Blog

Monday, September 9, 2013

How to create a patch


1. Checkout the code

I checked out the WSO2 JAX-RS Starbucks service from here;

 http://svn.wso2.org/repos/wso2/carbon/platform/branches/4.2.0/products/as/5.2.0/modules/samples/product/Jaxws-Jaxrs/jaxrs_starbucks_service  

2. Make the change

I wanted this service to work as Non-SOAP for HTTP POST requests; So I changed the code as;

From here;
 @Consumes(MediaType.TEXT_XML)  // consumes text/xml  

To this;
 @Consumes(MediaType.APPLICATION_XML)  // consumes application/xml  

3. Create the diff

Now use the following svn command to create the patch diff
 $ svn diff > patch.diff  

4. Patch diff will look like this

 Index: src/main/java/demo/jaxrs/server/StarbucksOutletService.java  
 ===================================================================  
 --- src/main/java/demo/jaxrs/server/StarbucksOutletService.java (revision 184754)  
 +++ src/main/java/demo/jaxrs/server/StarbucksOutletService.java (working copy)  
 @@ -21,7 +21,7 @@  
    @Path("/orders/")  
  //  @Produces(MediaType.TEXT_PLAIN)  
    @Produces(MediaType.APPLICATION_JSON)  // produces application/json  
 -  @Consumes(MediaType.TEXT_XML)  // consumes text/xml  
 +  @Consumes(MediaType.APPLICATION_XML)  // consumes application/xml  
    public Response addOrder (Order orderBean);  
    /**  

No comments:

Post a Comment