source: src/main/java/geniusweb/runserver/Info.java@ 18

Last change on this file since 18 was 14, checked in by bart, 4 years ago

Update to version 1.41

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