Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@

package io.opentelemetry.instrumentation.jaxrs.v2_0.test;

import static javax.ws.rs.core.MediaType.TEXT_PLAIN;

import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;

@Path("/ignored")
public interface Resource {
Expand All @@ -24,6 +27,7 @@ interface SubResource extends Cloneable, Resource {

class Test1 implements SubResource {
@Override
@Produces(TEXT_PLAIN)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this avoids the XSS warning since it's not returning HTML

public String hello(String name) {
return "Test1 " + name + "!";
}
Expand All @@ -32,6 +36,7 @@ public String hello(String name) {
@Path("/test2")
class Test2 implements SubResource {
@Override
@Produces(TEXT_PLAIN)
public String hello(String name) {
return "Test2 " + name + "!";
}
Expand All @@ -42,12 +47,14 @@ class Test3 implements SubResource {
@Override
@POST
@Path("/hi/{name}")
@Produces(TEXT_PLAIN)
public String hello(@PathParam("name") String name) {
return "Test3 " + name + "!";
}

@POST
@Path("/nested")
@Produces(TEXT_PLAIN)
public String nested() {
return hello("nested");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@

package io.opentelemetry.instrumentation.jaxrs.v3_0.test;

import static jakarta.ws.rs.core.MediaType.TEXT_PLAIN;

import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;

@Path("/ignored")
public interface Resource {
Expand All @@ -24,6 +27,7 @@ interface SubResource extends Cloneable, Resource {

class Test1 implements SubResource {
@Override
@Produces(TEXT_PLAIN)
public String hello(String name) {
return "Test1 " + name + "!";
}
Expand All @@ -32,6 +36,7 @@ public String hello(String name) {
@Path("/test2")
class Test2 implements SubResource {
@Override
@Produces(TEXT_PLAIN)
public String hello(String name) {
return "Test2 " + name + "!";
}
Expand All @@ -42,12 +47,14 @@ class Test3 implements SubResource {
@Override
@POST
@Path("/hi/{name}")
@Produces(TEXT_PLAIN)
public String hello(@PathParam("name") String name) {
return "Test3 " + name + "!";
}

@POST
@Path("/nested")
@Produces(TEXT_PLAIN)
public String nested() {
return hello("nested");
}
Expand Down
Loading