*
* @param request
* @param response
+ * @throws IOException
*/
protected abstract void processRequest(HttpServletRequest request,
- HttpServletResponse response);
+ HttpServletResponse response) throws IOException;
/**
* For debug - writes HTTP request details to stdout
// "HttpServer started with %d threads", server.getThreadPool()
// .getThreads()));
contextRoot = server.getURI();
- System.out.println("Jalview endpoint " + contextRoot);
} catch (Exception e)
{
System.err.println("Error trying to start HttpServer: "
*/
@Override
protected void processRequest(HttpServletRequest request,
- HttpServletResponse response)
+ HttpServletResponse response) throws IOException
{
/*
* Currently just echoes the request; add helper classes as required to
*/
final String queryString = request.getQueryString();
final String reply = "REST not yet implemented; received "
- + request.getRequestURL()
+ + request.getMethod() + ": " + request.getRequestURL()
+ (queryString == null ? "" : "?" + queryString);
System.out.println(reply);
- try
- {
- final PrintWriter writer = response.getWriter();
- writer.write(reply);
- writer.close();
- } catch (IOException e)
- {
- System.err.println("Error writing REST response: " + e.getMessage());
- }
+ response.setHeader("Cache-Control", "no-cache/no-store");
+ response.setHeader("Content-type", "text/plain");
+ final PrintWriter writer = response.getWriter();
+ writer.write(reply);
+ writer.close();
}
/**