Open starinfor opened 7 years ago
Can you share your code?
Can't share exact code but a similar sample would look like this:
public class Test extends HttpServlet
{
@Override
public void init(ServletConfig config) throws ServletException
{
super.init(config);
//init code
}
@Override
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws IOException, ServletException
{
String pathInfo = req.getPathInfo();
if (pathInfo != null && !"".equals(pathInfo))
{
//based on different values call methods/classes accordingly
//ex: I want to create api for /Test/Ex/test1 , /Test/Example/test2
//and both calls would have different set of query parameters
}
}
@Override
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws IOException, ServletException
{
doGet(req, res);
}
@Override
public void destroy()
{
//destroy context
}
}
The above servlet serves multiple web services based on value of pathinfo.
I don't believe we support that mechanism.
Is it mandatory to have one servlet for each endpoint ? In my code, one servlet serves multiple web services based on path parameter. Can swagger api work in this case?