import org.apache.log4j.Logger;
import eu.svjatoslav.commons.file.IOHelper;
-import eu.svjatoslav.commons.network.UrlParamEncoder;
import eu.svjatoslav.meviz.htmlindexer.metadata.Dimension;
import eu.svjatoslav.meviz.htmlindexer.metadata.DirectoryMetadata;
import eu.svjatoslav.meviz.htmlindexer.metadata.MetadadaHelper;
desiredDimension.getAwtDimension());
}
return Constants.THUMBNAILS_DIRECTORY_NAME + "/"
- + UrlParamEncoder.encode(thumbnailFileName);
+ + Utils.urlEncode(thumbnailFileName);
}
public void initializeLayouts() {
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
import java.util.HashSet;
import java.util.zip.CRC32;
public class Utils {
private static File lastLoadedFile;
+ private static final String UTF_8 = "UTF-8";
private static BufferedImage lastLoadedBufferedImage;
return isMevizFile;
}
+ public static String urlEncode(String string) {
+ try {
+ return URLEncoder.encode(string, UTF_8);
+ } catch (UnsupportedEncodingException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
}
import java.net.URLEncoder;
import java.util.List;
-import eu.svjatoslav.commons.network.UrlParamEncoder;
import eu.svjatoslav.meviz.htmlindexer.layouts.MixedLayout;
import eu.svjatoslav.meviz.htmlindexer.metadata.Dimension;
import eu.svjatoslav.meviz.htmlindexer.metadata.DirectoryMetadata;
final StringBuffer urlStringBuffer = new StringBuffer();
urlStringBuffer.append(globalPrefix);
- urlStringBuffer.append(UrlParamEncoder.encode(requestPath));
+ urlStringBuffer.append(Utils.urlEncode(requestPath));
urlStringBuffer.append("/.thumbnails/metadata_6.dat");
final String urlString = urlStringBuffer.toString();
return context.getGlobalUrl() + context.getLocalUrl() + "/"
+ Constants.THUMBNAILS_DIRECTORY_NAME + "/"
- + UrlParamEncoder.encode(thumbnailFileName);
+ + Utils.urlEncode(thumbnailFileName);
}
}
import org.apache.log4j.Logger;
import eu.svjatoslav.commons.file.FilePathParser;
-import eu.svjatoslav.commons.network.UrlParamEncoder;
import eu.svjatoslav.meviz.htmlindexer.AbstractIndexer;
import eu.svjatoslav.meviz.htmlindexer.Constants;
import eu.svjatoslav.meviz.htmlindexer.IndexingContext;
import eu.svjatoslav.meviz.htmlindexer.Layout;
+import eu.svjatoslav.meviz.htmlindexer.Utils;
import eu.svjatoslav.meviz.htmlindexer.metadata.Dimension;
import eu.svjatoslav.meviz.htmlindexer.metadata.DirectoryMetadata;
import eu.svjatoslav.meviz.htmlindexer.metadata.fileTypes.AbstractFile;
filesHtml.append("<div style=\"clear: both;\"><a href=\""
+ indexingContext.getGlobalUrl()
- + UrlParamEncoder.encode(indexingContext.getLocalUrl() + "/"
+ + Utils.urlEncode(indexingContext.getLocalUrl() + "/"
+ fullFileName) + "\">" + fullFileName + "</a>\n");
filesHtml.append(" ("
+ FilePathParser.getFileSizeDescription(file.getFileLength())
// clickable image thumbnail
filesHtml.append("<a href=\""
+ indexingContext.getGlobalUrl()
- + UrlParamEncoder.encode(indexingContext.getLocalUrl() + "/"
+ + Utils.urlEncode(indexingContext.getLocalUrl() + "/"
+ picture.fileName) + "\">\n");
+
filesHtml.append("<img border=\"0\" src=\""
+ getImageThumbnailUrl(picture) + "\"/></a><br/>\n");
filesHtml
.append("<source type=\"video/ogg\" codecs=\"theora, vorbis\" src=\""
+ indexingContext.getGlobalUrl()
- + UrlParamEncoder.encode(indexingContext.getLocalUrl()
- + "/" + file.fileName) + "\">\n");
+ + Utils.urlEncode(indexingContext.getLocalUrl() + "/"
+ + file.fileName) + "\">\n");
filesHtml.append("</source>\n");
filesHtml.append("</video>\n");
filesHtml.append("<br/>\n");
// video download link
filesHtml.append("<a href=\""
+ indexingContext.getGlobalUrl()
- + UrlParamEncoder.encode(indexingContext.getLocalUrl() + "/"
+ + Utils.urlEncode(indexingContext.getLocalUrl() + "/"
+ file.fileName) + "\">download as OGV file</a>");
filesHtml.append("</div>\n");
// watchable video
String fileUrl = indexingContext.getGlobalUrl()
- + UrlParamEncoder.encode(indexingContext.getLocalUrl() + "/"
+ + Utils.urlEncode(indexingContext.getLocalUrl() + "/"
+ file.fileName);
filesHtml.append("<video controls>\n");
// video download link
filesHtml.append("<a href=\""
+ indexingContext.getGlobalUrl()
- + UrlParamEncoder.encode(indexingContext.getLocalUrl() + "/"
+ + Utils.urlEncode(indexingContext.getLocalUrl() + "/"
+ file.fileName) + "\">download as WebM file</a>");
filesHtml.append("</div>\n");