|
| 1 | +import java.io.InputStream; |
| 2 | +import java.io.IOException; |
| 3 | +import java.lang.annotation.Annotation; |
| 4 | +import java.lang.reflect.Type; |
| 5 | +import jakarta.ws.rs.GET; |
| 6 | +import jakarta.ws.rs.POST; |
| 7 | +import jakarta.ws.rs.DELETE; |
| 8 | +import jakarta.ws.rs.PUT; |
| 9 | +import jakarta.ws.rs.OPTIONS; |
| 10 | +import jakarta.ws.rs.HEAD; |
| 11 | +import jakarta.ws.rs.Path; |
| 12 | +import jakarta.ws.rs.BeanParam; |
| 13 | +import jakarta.ws.rs.CookieParam; |
| 14 | +import jakarta.ws.rs.FormParam; |
| 15 | +import jakarta.ws.rs.HeaderParam; |
| 16 | +import jakarta.ws.rs.MatrixParam; |
| 17 | +import jakarta.ws.rs.PathParam; |
| 18 | +import jakarta.ws.rs.Produces; |
| 19 | +import jakarta.ws.rs.QueryParam; |
| 20 | +import jakarta.ws.rs.client.Client; |
| 21 | +import jakarta.ws.rs.core.Context; |
| 22 | +import jakarta.ws.rs.core.MediaType; |
| 23 | +import jakarta.ws.rs.core.MultivaluedMap; |
| 24 | +import jakarta.ws.rs.core.Response; |
| 25 | +import jakarta.ws.rs.ext.MessageBodyReader; |
| 26 | + |
| 27 | +class ExtendsJakartaRs3 extends JakartaRs3 { |
| 28 | + @Override |
| 29 | + public int Get() { // $ ResourceMethod |
| 30 | + return 1; |
| 31 | + } |
| 32 | + |
| 33 | + @Override |
| 34 | + public @QueryParam("") // $ InjectionAnnotation |
| 35 | + void Post() { |
| 36 | + } |
| 37 | + |
| 38 | + @Override |
| 39 | + public double Delete() { // $ ResourceMethod=application/json |
| 40 | + return 1.0; |
| 41 | + } |
| 42 | + |
| 43 | + @Override |
| 44 | + public void Put() { // $ ResourceMethod=text/html |
| 45 | + } |
| 46 | + |
| 47 | + @Produces("application/json") // $ ProducesAnnotation=application/json |
| 48 | + @Override |
| 49 | + public void Options() { // not a resource method because it has a jax-rs annotation, so it doesn't inherit any jax-rs annotations |
| 50 | + } |
| 51 | + |
| 52 | + @Produces(MediaType.TEXT_XML) // $ ProducesAnnotation=text/xml |
| 53 | + @Override |
| 54 | + public void Head() { // not a resource method because it has a jax-rs annotation, so it doesn't inherit any jax-rs annotations |
| 55 | + } |
| 56 | + |
| 57 | +} |
| 58 | + |
| 59 | +@Produces(MediaType.TEXT_XML) // $ ProducesAnnotation=text/xml |
| 60 | +class ExtendsJakartaRs3WithProducesAnnotation extends JakartaRs3 { |
| 61 | + @Override |
| 62 | + public int Get() { // $ ResourceMethod=text/xml |
| 63 | + return 2; |
| 64 | + } |
| 65 | + |
| 66 | + @Override |
| 67 | + public @QueryParam("") // $ InjectionAnnotation |
| 68 | + void Post() { |
| 69 | + } |
| 70 | + |
| 71 | + @Override |
| 72 | + public double Delete() { // $ ResourceMethod=application/json |
| 73 | + return 2.0; |
| 74 | + } |
| 75 | + |
| 76 | + @Override |
| 77 | + public void Put() { // $ ResourceMethod=text/html |
| 78 | + } |
| 79 | + |
| 80 | + @Override |
| 81 | + public void Options() { // $ ResourceMethod=text/xml |
| 82 | + } |
| 83 | +} |
| 84 | + |
| 85 | +@Path("") |
| 86 | +public class JakartaRs3 implements JakartaRsInterface { // $ RootResourceClass |
| 87 | + public JakartaRs3() { // $ InjectableConstructor |
| 88 | + } |
| 89 | + |
| 90 | + @Override |
| 91 | + public int Get() { // $ ResourceMethod ResourceMethodOnResourceClass |
| 92 | + return 1; // $ XssSink |
| 93 | + } |
| 94 | + |
| 95 | + @Override |
| 96 | + public void Post() { // $ ResourceMethod ResourceMethodOnResourceClass |
| 97 | + } |
| 98 | + |
| 99 | + @Produces("application/json") // $ ProducesAnnotation=application/json |
| 100 | + @Override |
| 101 | + public double Delete() { // not a resource method because it has a jax-rs annotation, so it doesn't inherit any jax-rs annotations |
| 102 | + return 1.0; |
| 103 | + } |
| 104 | + |
| 105 | + @Produces(MediaType.TEXT_HTML) // $ ProducesAnnotation=text/html |
| 106 | + @Override |
| 107 | + public void Put() { // not a resource method because it has a jax-rs annotation, so it doesn't inherit any jax-rs annotations |
| 108 | + } |
| 109 | + |
| 110 | + @Override |
| 111 | + public void Options() { // $ ResourceMethod ResourceMethodOnResourceClass |
| 112 | + } |
| 113 | + |
| 114 | + @Override |
| 115 | + public void Head() { // $ ResourceMethod ResourceMethodOnResourceClass |
| 116 | + } |
| 117 | + |
| 118 | + |
| 119 | + @Path("") |
| 120 | + NonRootResourceClassJakarta subResourceLocator() { // $ SubResourceLocator |
| 121 | + return null; |
| 122 | + } |
| 123 | + |
| 124 | + public class NonRootResourceClassJakarta { // $ NonRootResourceClass |
| 125 | + @GET |
| 126 | + int Get() { // $ ResourceMethod ResourceMethodOnResourceClass |
| 127 | + return 0; // $ XssSink |
| 128 | + } |
| 129 | + |
| 130 | + @Produces("text/html") // $ ProducesAnnotation=text/html |
| 131 | + @POST |
| 132 | + boolean Post() { // $ ResourceMethod=text/html ResourceMethodOnResourceClass |
| 133 | + return false; // $ XssSink |
| 134 | + } |
| 135 | + |
| 136 | + @Produces(MediaType.TEXT_PLAIN) // $ ProducesAnnotation=text/plain |
| 137 | + @DELETE |
| 138 | + double Delete() { // $ ResourceMethod=text/plain ResourceMethodOnResourceClass |
| 139 | + return 0.0; |
| 140 | + } |
| 141 | + |
| 142 | + @Path("") |
| 143 | + AnotherNonRootResourceClassJakarta subResourceLocator1() { // $ SubResourceLocator |
| 144 | + return null; |
| 145 | + } |
| 146 | + |
| 147 | + @GET |
| 148 | + @Path("") |
| 149 | + NotAResourceClass1Jakarta NotASubResourceLocator1() { // $ ResourceMethod ResourceMethodOnResourceClass |
| 150 | + return null; // $ XssSink |
| 151 | + } |
| 152 | + |
| 153 | + @GET |
| 154 | + NotAResourceClass2Jakarta NotASubResourceLocator2() { // $ ResourceMethod ResourceMethodOnResourceClass |
| 155 | + return null; // $ XssSink |
| 156 | + } |
| 157 | + |
| 158 | + NotAResourceClass2Jakarta NotASubResourceLocator3() { |
| 159 | + return null; |
| 160 | + } |
| 161 | + } |
| 162 | +} |
0 commit comments