[30] | 1 | package geniusweb.runserver;
|
---|
| 2 |
|
---|
| 3 | import java.io.IOException;
|
---|
| 4 | import java.util.HashMap;
|
---|
| 5 | import java.util.Map;
|
---|
| 6 |
|
---|
| 7 | import javax.servlet.ServletException;
|
---|
| 8 | import javax.servlet.http.HttpServlet;
|
---|
| 9 | import javax.servlet.http.HttpServletRequest;
|
---|
| 10 | import javax.servlet.http.HttpServletResponse;
|
---|
| 11 |
|
---|
| 12 | import geniusweb.protocol.NegoSettings;
|
---|
| 13 |
|
---|
| 14 | /**
|
---|
| 15 | * Contains incoming connection to run a Nego. runserver/runsession with the
|
---|
| 16 | * JSON {@link NegoSettings} in the request header. After the session is
|
---|
| 17 | * started, the new Nego ID is returned. This can be used to find back the log
|
---|
| 18 | * files..
|
---|
| 19 | */
|
---|
| 20 | @SuppressWarnings("serial")
|
---|
| 21 | public class Info extends HttpServlet {
|
---|
| 22 |
|
---|
| 23 | /**
|
---|
| 24 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
|
---|
| 25 | * response).
|
---|
| 26 | *
|
---|
| 27 | * @return the ID of the new started run. Or SC_BAD_REQUEST if the request
|
---|
| 28 | * can not be processed.
|
---|
| 29 | */
|
---|
| 30 | @Override
|
---|
| 31 | protected void doGet(HttpServletRequest request,
|
---|
| 32 | HttpServletResponse response) throws ServletException, IOException {
|
---|
| 33 | response.setContentType("text/plain");
|
---|
| 34 | // HACK but should be generizable easy in the future.
|
---|
| 35 | Map<String, Object> info = new HashMap<>();
|
---|
| 36 | info.put("version", getClass().getPackage().getImplementationVersion());
|
---|
| 37 | response.getWriter()
|
---|
| 38 | .append(Jackson.instance().writeValueAsString(info));
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | }
|
---|