View Javadoc

1   package com.atlassian.plugins.rest.cors;
2   
3   import com.atlassian.plugins.rest.common.security.CorsAllowed;
4   import com.atlassian.plugins.rest.common.security.AnonymousAllowed;
5   
6   import javax.ws.rs.GET;
7   import javax.ws.rs.POST;
8   import javax.ws.rs.PUT;
9   import javax.ws.rs.Path;
10  
11  /**
12   */
13  @Path ("/cors")
14  @AnonymousAllowed
15  public class CorsProtectedResource
16  {
17      @GET
18      @Path("none")
19      public String getWithNoHeaders()
20      {
21          return "Request succeeded";
22      }
23      
24      @GET
25      @CorsAllowed
26      public String getWithHeaders()
27      {
28          return "Request succeeded";
29      }
30      
31      @POST
32      @Path("none")
33      public String postWithNoHeaders()
34      {
35          return "Request succeeded";
36      }
37      
38      @POST
39      @CorsAllowed
40      public String postWithHeaders()
41      {
42          return "Request succeeded";
43      }
44      
45      @PUT
46      @Path("none")
47      public String putWithNoHeaders()
48      {
49          return "Request succeeded";
50      }
51      
52      @PUT
53      @CorsAllowed
54      public String putWithHeaders()
55      {
56          return "Request succeeded";
57      }
58  }