weblib: fixes
[fanfix.git] / src / be / nikiroo / fanfix / library / WebLibraryServerHtml.java
index 77b8efede1a4eb9580219a74cf9d6aee62157469..e96edef95584b5f18a63f62ab630c75abe92f6b0 100644 (file)
@@ -62,6 +62,14 @@ abstract class WebLibraryServerHtml implements Runnable {
        abstract protected Story story(String luid, WLoginResult login)
                        throws IOException;
 
+       protected abstract Response imprt(String uri, String url,
+                       WLoginResult login) throws IOException;
+
+       protected abstract Response imprtProgress(String uri, WLoginResult login);
+
+       protected abstract Response delete(String uri, WLoginResult login)
+                       throws IOException;
+
        public WebLibraryServerHtml(boolean secure) throws IOException {
                Integer port = Instance.getInstance().getConfig()
                                .getInteger(Config.SERVER_PORT);
@@ -193,6 +201,15 @@ abstract class WebLibraryServerHtml implements Runnable {
                                                                session.getCookies().delete("cookie");
                                                                cookies.remove("cookie");
                                                                rep = loginPage(login(false, false), uri);
+                                                       } else if (WebLibraryUrls.isImprtUrl(uri)) {
+                                                               String url = params.get("url");
+                                                               if (url != null) {
+                                                                       rep = imprt(uri, url, login);
+                                                               } else {
+                                                                       rep = imprtProgress(uri, login);
+                                                               }
+                                                       } else if (WebLibraryUrls.isDeleteUrl(uri)) {
+                                                               rep = delete(uri, login);
                                                        } else {
                                                                getTraceHandler().error(
                                                                                "Supported URL was not processed: "