View Javadoc

1   package com.atlassian.plugins.rest.validation;
2   
3   import com.atlassian.plugins.rest.common.interceptor.InterceptorChain;
4   import com.atlassian.plugins.rest.common.transaction.TransactionInterceptor;
5   import com.atlassian.plugins.rest.common.validation.ValidationInterceptor;
6   
7   import javax.ws.rs.Consumes;
8   import javax.ws.rs.POST;
9   import javax.ws.rs.Path;
10  import javax.ws.rs.Produces;
11  
12  @Path("/validatedResource")
13  @InterceptorChain({ValidationInterceptor.class, TransactionInterceptor.class})
14  public class ValidatedResource
15  {
16      @POST
17      @Consumes("application/xml")
18      @Produces("application/xml")
19      public PersonResponse addPerson(Person person)
20      {
21          PersonResponse res = new PersonResponse();
22          res.setName(person.getName());
23          return res;
24      }
25  }