Improved web indexer. Fixed maven URL.
authorSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Tue, 19 Jun 2018 14:56:32 +0000 (17:56 +0300)
committerSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Tue, 19 Jun 2018 14:56:32 +0000 (17:56 +0300)
meviz.iml
pom.xml
src/main/java/eu/svjatoslav/meviz/htmlindexer/WebIndexer.java
src/main/java/eu/svjatoslav/meviz/htmlindexer/layouts/MixedLayout.java

index f642318..7399dd5 100644 (file)
--- a/meviz.iml
+++ b/meviz.iml
@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
   <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
 <?xml version="1.0" encoding="UTF-8"?>
 <module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
   <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
-    <output url="file://$MODULE_DIR$/../../target/classes" />
-    <output-test url="file://$MODULE_DIR$/../../target/test-classes" />
-    <content url="file://$MODULE_DIR$/../..">
-      <sourceFolder url="file://$MODULE_DIR$/../../src/main/java" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/../../src/main/resources" type="java-resource" />
-      <excludeFolder url="file://$MODULE_DIR$/../../target" />
+    <output url="file://$MODULE_DIR$/target/classes" />
+    <output-test url="file://$MODULE_DIR$/target/test-classes" />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
+      <excludeFolder url="file://$MODULE_DIR$/target" />
     </content>
     <orderEntry type="inheritedJdk" />
     <orderEntry type="sourceFolder" forTests="false" />
     </content>
     <orderEntry type="inheritedJdk" />
     <orderEntry type="sourceFolder" forTests="false" />
diff --git a/pom.xml b/pom.xml
index eea9a82..b1cbf6d 100644 (file)
--- a/pom.xml
+++ b/pom.xml
         <snapshotRepository>
             <id>svjatoslav.eu</id>
             <name>svjatoslav.eu</name>
         <snapshotRepository>
             <id>svjatoslav.eu</id>
             <name>svjatoslav.eu</name>
-            <url>scpexe://svjatoslav.eu/var/www/svjatoslav.eu/maven</url>
+            <url>scpexe://svjatoslav.eu:10006/srv/maven</url>
         </snapshotRepository>
         <repository>
             <id>svjatoslav.eu</id>
             <name>svjatoslav.eu</name>
         </snapshotRepository>
         <repository>
             <id>svjatoslav.eu</id>
             <name>svjatoslav.eu</name>
-            <url>scpexe://svjatoslav.eu/var/www/svjatoslav.eu/maven</url>
+            <url>scpexe://svjatoslav.eu:10006/srv/maven</url>
         </repository>
     </distributionManagement>
 
         </repository>
     </distributionManagement>
 
index c649d98..dba6f5a 100644 (file)
@@ -11,7 +11,6 @@ import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.UnsupportedEncodingException;
 import java.net.URL;
 import java.io.ObjectInputStream;
 import java.io.UnsupportedEncodingException;
 import java.net.URL;
-import java.net.URLEncoder;
 import java.util.List;
 
 public class WebIndexer extends AbstractIndexer {
 import java.util.List;
 
 public class WebIndexer extends AbstractIndexer {
@@ -35,13 +34,7 @@ public class WebIndexer extends AbstractIndexer {
     @Override
     public String getDirectoryUrl(final AbstractFile directory,
                                   final IndexingContext context) {
     @Override
     public String getDirectoryUrl(final AbstractFile directory,
                                   final IndexingContext context) {
-
-        try {
-            return jspPath + context.getLocalUrl() + "/"
-                    + URLEncoder.encode(directory.fileName, "UTF-8");
-        } catch (final UnsupportedEncodingException e) {
-            throw new RuntimeException(e);
-        }
+        return jspPath + context.getLocalUrl() + "/" + directory.fileName;
     }
 
     public String getHtml(String requestPath) throws
     }
 
     public String getHtml(String requestPath) throws
index e20f875..55c4e80 100755 (executable)
@@ -189,17 +189,8 @@ public class MixedLayout implements Layout {
         // assemble final page HTML
         final StringBuilder html = new StringBuilder();
 
         // assemble final page HTML
         final StringBuilder html = new StringBuilder();
 
-        if (doHtmlHeaderAndFooter) {
-            // page header
-            html.append("<HTML>\n");
-            html.append("<HEAD>\n");
-            html.append("    <meta HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=UTF-8\"/>\n");
-            html.append("</HEAD>\n");
-            html.append("<BODY bgcolor=\"#000000\" alink=\"#50ffff\" link=\"#50ffff\" vlink=\"#ff50ff\" text=\"#ffffff\">\n");
-            html.append("<!-- " + Constants.HTML_MAGIC_STRING + " -->\n");
-            html.append("<!-- " + Constants.HTML_MEMO + " -->\n");
-            html.append("<font color=\"#ffffff\">\n");
-        }
+        if (doHtmlHeaderAndFooter)
+            appendHtmlHeader(html);
 
         if (showTitle)
             html.append("<CENTER><H1>" + galleryTitle + "</H1></CENTER>\n");
 
         if (showTitle)
             html.append("<CENTER><H1>" + galleryTitle + "</H1></CENTER>\n");
@@ -210,11 +201,27 @@ public class MixedLayout implements Layout {
         html.append(filesHtml.toString());
 
         if (doHtmlHeaderAndFooter)
         html.append(filesHtml.toString());
 
         if (doHtmlHeaderAndFooter)
-            html.append("</font></BODY></HTML>\n");
+            appendHtmlFooter(html);
 
         return html.toString();
     }
 
 
         return html.toString();
     }
 
+    private void appendHtmlFooter(StringBuilder html) {
+        html.append("</font></BODY></HTML>\n");
+    }
+
+    private void appendHtmlHeader(StringBuilder html) {
+        // page header
+        html.append("<HTML>\n");
+        html.append("<HEAD>\n");
+        html.append("    <meta HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=UTF-8\"/>\n");
+        html.append("</HEAD>\n");
+        html.append("<BODY bgcolor=\"#000000\" alink=\"#50ffff\" link=\"#50ffff\" vlink=\"#ff50ff\" text=\"#ffffff\">\n");
+        html.append("<!-- " + Constants.HTML_MAGIC_STRING + " -->\n");
+        html.append("<!-- " + Constants.HTML_MEMO + " -->\n");
+        html.append("<font color=\"#ffffff\">\n");
+    }
+
     private String getImageThumbnailUrl(final Picture picture) {
         final Dimension imageSize = picture.getDimensions();
 
     private String getImageThumbnailUrl(final Picture picture) {
         final Dimension imageSize = picture.getDimensions();