X-Git-Url: http://git.nikiroo.be/?p=nikiroo-utils.git;a=blobdiff_plain;f=library%2FWebLibraryServerHtml.java;h=7351d0dd3665bceffb58b02574345dfcb498d940;hp=ac0631dd60ba32abc8f34b7297510bbc78039c95;hb=6d465e886ae46c9da99117cc4302948f700a51c4;hpb=877a44c78f1c4985aa362f6cdce385a4f860b51d diff --git a/library/WebLibraryServerHtml.java b/library/WebLibraryServerHtml.java index ac0631d..7351d0d 100644 --- a/library/WebLibraryServerHtml.java +++ b/library/WebLibraryServerHtml.java @@ -70,6 +70,13 @@ abstract class WebLibraryServerHtml implements Runnable { protected abstract Response delete(String uri, WLoginResult login) throws IOException; + /** + * Wait until all operations are done and stop the server. + *
+ * All the new R/W operations will be refused after a call to stop. + */ + protected abstract Response stop(WLoginResult login); + public WebLibraryServerHtml(boolean secure) throws IOException { Integer port = Instance.getInstance().getConfig() .getInteger(Config.SERVER_PORT); @@ -210,6 +217,8 @@ abstract class WebLibraryServerHtml implements Runnable { } } else if (WebLibraryUrls.isDeleteUrl(uri)) { rep = delete(uri, login); + } else if (WebLibraryUrls.EXIT_URL.equals(uri)) { + rep = WebLibraryServerHtml.this.stop(login); } else { getTraceHandler().error( "Supported URL was not processed: " @@ -272,6 +281,10 @@ abstract class WebLibraryServerHtml implements Runnable { } } + protected void doStop() { + server.stop(); + } + /** * The traces handler for this {@link WebLibraryServerHtml}. *