X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fhttpserver%2FAbstractRequestHandler.java;h=a6e96cb2769adacd5fbef1379b93d20e132874e8;hb=bc1a3842b31a35a7794f4afec4911ad421c7c3e4;hp=964250812bc0549ac07bb436285c8e4532cca694;hpb=2150df780eddbdf72013d29ee8eabb0f235c7bb4;p=jalview.git diff --git a/src/jalview/httpserver/AbstractRequestHandler.java b/src/jalview/httpserver/AbstractRequestHandler.java index 9642508..a6e96cb 100644 --- a/src/jalview/httpserver/AbstractRequestHandler.java +++ b/src/jalview/httpserver/AbstractRequestHandler.java @@ -1,3 +1,23 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.httpserver; import java.io.IOException; @@ -47,15 +67,15 @@ public abstract class AbstractRequestHandler extends AbstractHandler /* * Set server error status on response */ - System.err.println("Exception handling request " + jalview.bin.Console.errPrintln("Exception handling request " + request.getRequestURI() + " : " + t.getMessage()); if (response.isCommitted()) { /* * Can't write an HTTP header once any response content has been written */ - System.err - .println("Unable to return HTTP 500 as response already committed"); + jalview.bin.Console.errPrintln( + "Unable to return HTTP 500 as response already committed"); } else { @@ -73,9 +93,10 @@ public abstract class AbstractRequestHandler extends AbstractHandler * * @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 @@ -84,20 +105,20 @@ public abstract class AbstractRequestHandler extends AbstractHandler */ protected void dumpRequest(HttpServletRequest request) { - System.out.println(request.getMethod()); - System.out.println(request.getRequestURL()); + jalview.bin.Console.outPrintln(request.getMethod()); + jalview.bin.Console.outPrintln(request.getRequestURL()); for (String hdr : Collections.list(request.getHeaderNames())) { for (String val : Collections.list(request.getHeaders(hdr))) { - System.out.println(hdr + ": " + val); + jalview.bin.Console.outPrintln(hdr + ": " + val); } } for (String param : Collections.list(request.getParameterNames())) { for (String val : request.getParameterValues(param)) { - System.out.println(param + "=" + val); + jalview.bin.Console.outPrintln(param + "=" + val); } } } @@ -122,8 +143,8 @@ public abstract class AbstractRequestHandler extends AbstractHandler stop(); } catch (Exception e) { - System.err.println("Error stopping " + getName() + ": " - + e.getMessage()); + jalview.bin.Console.errPrintln( + "Error stopping " + getName() + ": " + e.getMessage()); } }