X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Frest%2FRestHandler.java;h=7c8c9a6cefdef63f94db95e7704f4385ca1ba0da;hb=a83adb45bdf9554e270921b4baad94defd314b36;hp=3f00c078aa8841eb35d9a6bfdb5093c2a0e00c28;hpb=ac207fd787051c6e0f4f9f10ea6b94452480d931;p=jalview.git diff --git a/src/jalview/rest/RestHandler.java b/src/jalview/rest/RestHandler.java index 3f00c07..7c8c9a6 100644 --- a/src/jalview/rest/RestHandler.java +++ b/src/jalview/rest/RestHandler.java @@ -1,5 +1,29 @@ +/* + * 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.rest; +import jalview.bin.ApplicationSingletonProvider; +import jalview.bin.ApplicationSingletonProvider.ApplicationSingletonI; +import jalview.httpserver.AbstractRequestHandler; + import java.io.IOException; import java.io.PrintWriter; import java.net.BindException; @@ -7,23 +31,17 @@ import java.net.BindException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import jalview.httpserver.AbstractRequestHandler; - /** - * A simple handler to process (or delegate) HTTP requests on /jalview/rest + * A simple handler to process (or delegate) HTTP requests on /jalview/rest. */ public class RestHandler extends AbstractRequestHandler + implements ApplicationSingletonI { private static final String MY_PATH = "rest"; private static final String MY_NAME = "Rest"; /** - * Singleton instance of this class - */ - private static RestHandler instance = null; - - /** * Returns the singleton instance of this class * * @return @@ -33,12 +51,8 @@ public class RestHandler extends AbstractRequestHandler { synchronized (RestHandler.class) { - if (instance == null) - { - instance = new RestHandler(); - } + return (RestHandler) ApplicationSingletonProvider.getInstance(RestHandler.class); } - return instance; } /**