Issue
My API receives following parameters:
http://hostname/api?tag_1=<value1>&tag_2=<value2>
So my Servlet looks like:
protected doGet(HttpServletRequest req, HttpServletResponse resp) {
Map<Integer, String> paramMap = new HashMap<>();
Enumeration<String> en = req.getParameterNames();
while (en.hasMoreElements()) {
String name = en.nextElement();
if (name.startsWith("tag_")) {
paramMap.put(Integer.parseInt(name.substring(4)), req.getParameter(name));
}
}
...
}
How can I integrate Swagger into this Servlet ?
Solution
Checkout this one. I haven't tried by myself though. https://github.com/swagger-api/swagger-samples/blob/master/java/java-servlet/src/main/java/io/swagger/sample/servlet/SampleServlet.java
Answered By - Sunny0427
Answer Checked By - Senaida (JavaFixing Volunteer)