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 @GET
17 @Path("none")
18 public String getWithNoHeaders() {
19 return "Request succeeded";
20 }
21
22 @GET
23 @CorsAllowed
24 public String getWithHeaders() {
25 return "Request succeeded";
26 }
27
28 @POST
29 @Path("none")
30 public String postWithNoHeaders() {
31 return "Request succeeded";
32 }
33
34 @POST
35 @CorsAllowed
36 public String postWithHeaders() {
37 return "Request succeeded";
38 }
39
40 @PUT
41 @Path("none")
42 public String putWithNoHeaders() {
43 return "Request succeeded";
44 }
45
46 @PUT
47 @CorsAllowed
48 public String putWithHeaders() {
49 return "Request succeeded";
50 }
51 }