From 492279188d6c1b68b37f7d45177916a0d023d954 Mon Sep 17 00:00:00 2001 From: Svjatoslav Agejenko Date: Tue, 19 Jun 2018 17:56:32 +0300 Subject: [PATCH] Improved web indexer. Fixed maven URL. --- meviz.iml | 12 +++---- pom.xml | 4 +-- .../meviz/htmlindexer/WebIndexer.java | 9 +----- .../htmlindexer/layouts/MixedLayout.java | 31 ++++++++++++------- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/meviz.iml b/meviz.iml index f642318..7399dd5 100644 --- a/meviz.iml +++ b/meviz.iml @@ -1,12 +1,12 @@ - - - - - - + + + + + + diff --git a/pom.xml b/pom.xml index eea9a82..b1cbf6d 100644 --- a/pom.xml +++ b/pom.xml @@ -132,12 +132,12 @@ svjatoslav.eu svjatoslav.eu - scpexe://svjatoslav.eu/var/www/svjatoslav.eu/maven + scpexe://svjatoslav.eu:10006/srv/maven svjatoslav.eu svjatoslav.eu - scpexe://svjatoslav.eu/var/www/svjatoslav.eu/maven + scpexe://svjatoslav.eu:10006/srv/maven diff --git a/src/main/java/eu/svjatoslav/meviz/htmlindexer/WebIndexer.java b/src/main/java/eu/svjatoslav/meviz/htmlindexer/WebIndexer.java index c649d98..dba6f5a 100644 --- a/src/main/java/eu/svjatoslav/meviz/htmlindexer/WebIndexer.java +++ b/src/main/java/eu/svjatoslav/meviz/htmlindexer/WebIndexer.java @@ -11,7 +11,6 @@ import java.io.IOException; 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 { @@ -35,13 +34,7 @@ public class WebIndexer extends AbstractIndexer { @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 diff --git a/src/main/java/eu/svjatoslav/meviz/htmlindexer/layouts/MixedLayout.java b/src/main/java/eu/svjatoslav/meviz/htmlindexer/layouts/MixedLayout.java index e20f875..55c4e80 100755 --- a/src/main/java/eu/svjatoslav/meviz/htmlindexer/layouts/MixedLayout.java +++ b/src/main/java/eu/svjatoslav/meviz/htmlindexer/layouts/MixedLayout.java @@ -189,17 +189,8 @@ public class MixedLayout implements Layout { // assemble final page HTML final StringBuilder html = new StringBuilder(); - if (doHtmlHeaderAndFooter) { - // page header - html.append("\n"); - html.append("\n"); - html.append(" \n"); - html.append("\n"); - html.append("\n"); - html.append("\n"); - html.append("\n"); - html.append("\n"); - } + if (doHtmlHeaderAndFooter) + appendHtmlHeader(html); if (showTitle) html.append("

" + galleryTitle + "

\n"); @@ -210,11 +201,27 @@ public class MixedLayout implements Layout { html.append(filesHtml.toString()); if (doHtmlHeaderAndFooter) - html.append("
\n"); + appendHtmlFooter(html); return html.toString(); } + private void appendHtmlFooter(StringBuilder html) { + html.append("\n"); + } + + private void appendHtmlHeader(StringBuilder html) { + // page header + html.append("\n"); + html.append("\n"); + html.append(" \n"); + html.append("\n"); + html.append("\n"); + html.append("\n"); + html.append("\n"); + html.append("\n"); + } + private String getImageThumbnailUrl(final Picture picture) { final Dimension imageSize = picture.getDimensions(); -- 2.20.1