Skip to content

Commit 3cc8295

Browse files
committed
attempt to make it recognize xss
1 parent 3143b48 commit 3cc8295

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/main/java/com/acme/search/SearchController.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
import org.springframework.web.bind.annotation.GetMapping;
55
import org.springframework.web.bind.annotation.RequestParam;
66

7+
import javax.servlet.http.HttpServletResponse;
8+
import java.io.IOException;
9+
import java.io.PrintWriter;
10+
711
@Controller
812
public final class SearchController {
913

@@ -16,8 +20,10 @@ public String searchFederal(@RequestParam String q) {
1620

1721
/** Change the code given. */
1822
@GetMapping("/search/federify")
19-
public String createFedSearchToken(@RequestParam String searchCode) {
20-
return "<html><body>FEDSEARCH:" + searchCode.toUpperCase().trim() + "</body></html>";
23+
public void createFedSearchToken(HttpServletResponse response, @RequestParam String searchCode) throws IOException {
24+
PrintWriter writer = response.getWriter();
25+
String html = "<html><body>FEDSEARCH:" + searchCode.toUpperCase().trim() + "</body></html>";
26+
writer.write(html);
2127
}
2228

2329
}

0 commit comments

Comments
 (0)