Browse Source

Adding support for a bulk downloader based on a CSV upload.

Matt Clark 8 months ago
parent
commit
a27c357666

+ 8 - 1
pom.xml

@@ -1,4 +1,5 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 	<modelVersion>4.0.0</modelVersion>
 
@@ -84,6 +85,12 @@
 		</dependency>
 
 		<dependency>
+			<groupId>com.opencsv</groupId>
+			<artifactId>opencsv</artifactId>
+			<version>5.2</version>
+		</dependency>
+
+		<dependency>
 			<groupId>junit</groupId>
 			<artifactId>junit</artifactId>
 			<version>4.12</version>

+ 14 - 0
resources/bulk.html

@@ -0,0 +1,14 @@
+<html>
+<head>
+<title>Bulk-Barcode Generation</title>
+</head>
+<body>
+	CSV Uploader
+	<br />
+	<form method="post" action="bulk/" enctype="multipart/form-data">
+		<input type="file" name="csvFile" id="csvFile" />
+		<br />
+		<input type="submit">
+	</form>
+</body>
+</html>

+ 18 - 2
src/main/java/org/barcodeapi/core/ServerLoader.java

@@ -3,14 +3,15 @@ package org.barcodeapi.core;
 import java.util.Timer;
 import java.util.concurrent.TimeUnit;
 
-import org.barcodeapi.core.utils.Log;
-import org.barcodeapi.core.utils.Log.LOG;
 import org.barcodeapi.server.api.BarcodeAPIHandler;
+import org.barcodeapi.server.api.BulkHandler;
 import org.barcodeapi.server.api.CacheHandler;
 import org.barcodeapi.server.api.SessionHandler;
 import org.barcodeapi.server.api.StaticHandler;
 import org.barcodeapi.server.api.StatsHandler;
 import org.barcodeapi.server.api.TypesHandler;
+import org.barcodeapi.server.core.Log;
+import org.barcodeapi.server.core.Log.LOG;
 import org.barcodeapi.server.tasks.BarcodeCleanupTask;
 import org.barcodeapi.server.tasks.SessionCleanupTask;
 import org.barcodeapi.server.tasks.StatsDumpTask;
@@ -72,6 +73,8 @@ public class ServerLoader {
 
 		initTypesHandler();
 
+		initBulkHandler();
+
 		initApiHandler();
 
 		initResourceHandler();
@@ -183,6 +186,19 @@ public class ServerLoader {
 	}
 
 	/**
+	 * Initialize the bulk-download end-point.
+	 */
+	private void initBulkHandler() {
+
+		// setup statistics handler
+		Log.out(LOG.SERVER, "Initializing handler: /bulk");
+		ContextHandler bulkHandler = new ContextHandler();
+		bulkHandler.setHandler(new BulkHandler());
+		bulkHandler.setContextPath("/bulk");
+		handlers.addHandler(bulkHandler);
+	}
+
+	/**
 	 * Initialize the main API handler.
 	 */
 	private void initApiHandler() {

+ 73 - 0
src/main/java/org/barcodeapi/core/utils/BulkUtils.java

@@ -0,0 +1,73 @@
+package org.barcodeapi.core.utils;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+import org.barcodeapi.server.cache.CachedBarcode;
+import org.barcodeapi.server.core.GenerationException;
+import org.barcodeapi.server.core.GenerationException.ExceptionType;
+import org.barcodeapi.server.gen.BarcodeGenerator;
+import org.barcodeapi.server.gen.BarcodeRequest;
+
+import com.opencsv.CSVReader;
+import com.opencsv.exceptions.CsvValidationException;
+
+public class BulkUtils {
+
+	public static void getZippedBarcodes(int max, InputStream in, OutputStream out)
+			throws IOException, GenerationException {
+
+		try (CSVReader reader = new CSVReader(new InputStreamReader(in))) {
+
+			ArrayList<BarcodeRequest> requests = new ArrayList<>();
+
+			String[] record;
+			while ((record = reader.readNext()) != null) {
+				if (requests.size() < max) {
+					requests.add(BarcodeRequest.fromCSV(record));
+				} else {
+					break;
+				}
+			}
+			reader.close();
+
+			ArrayList<CachedBarcode> barcodes = generateBarcodes(requests);
+
+			ZipOutputStream zip = new ZipOutputStream(out);
+
+			for (CachedBarcode barcode : barcodes) {
+
+				String niceData = barcode.getProperties().getProperty("nice");
+				ZipEntry zipEntry = new ZipEntry(niceData + ".png");
+				zip.putNextEntry(zipEntry);
+				zip.write(barcode.getData(), 0, barcode.getDataSize());
+				zip.closeEntry();
+			}
+
+			zip.close();
+			out.close();
+
+		} catch (CsvValidationException e) {
+
+			throw new GenerationException(ExceptionType.INVALID, e);
+		}
+	}
+
+	public static ArrayList<CachedBarcode> generateBarcodes(ArrayList<BarcodeRequest> requests)
+			throws GenerationException {
+
+		ArrayList<CachedBarcode> barcodes = new ArrayList<>();
+
+		for (BarcodeRequest request : requests) {
+
+			barcodes.add(BarcodeGenerator.requestBarcode(request));
+		}
+
+		return barcodes;
+	}
+}

+ 39 - 0
src/main/java/org/barcodeapi/core/utils/StringUtils.java

@@ -0,0 +1,39 @@
+package org.barcodeapi.core.utils;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
+
+import org.barcodeapi.server.core.GenerationException;
+import org.barcodeapi.server.core.GenerationException.ExceptionType;
+
+public class StringUtils {
+
+	public static String encode(String data) {
+
+		try {
+
+			return URLEncoder.encode(data, "UTF-8");
+		} catch (Exception e) {
+
+			return null;
+		}
+	}
+
+	public static String decode(String data) throws GenerationException {
+
+		try {
+
+			return URLDecoder.decode(data, "UTF-8");
+
+		} catch (UnsupportedEncodingException | IllegalArgumentException e) {
+
+			throw new GenerationException(ExceptionType.INVALID, e);
+		}
+	}
+
+	public static String stripIllegal(String data) {
+
+		return data.replaceAll("[!@#$%^&*\\(\\)\\[\\]\\{\\};:\\',\\<\\>\\\"]", "");
+	}
+}

+ 10 - 5
src/main/java/org/barcodeapi/server/api/BarcodeAPIHandler.java

@@ -6,12 +6,13 @@ import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.barcodeapi.core.utils.Log;
-import org.barcodeapi.core.utils.Log.LOG;
 import org.barcodeapi.server.cache.CachedBarcode;
 import org.barcodeapi.server.core.GenerationException;
+import org.barcodeapi.server.core.Log;
+import org.barcodeapi.server.core.Log.LOG;
 import org.barcodeapi.server.core.RestHandler;
 import org.barcodeapi.server.gen.BarcodeGenerator;
+import org.barcodeapi.server.gen.BarcodeRequest;
 import org.eclipse.jetty.server.Request;
 
 public class BarcodeAPIHandler extends RestHandler {
@@ -23,8 +24,10 @@ public class BarcodeAPIHandler extends RestHandler {
 
 		try {
 
-			ERR = BarcodeGenerator.requestBarcode("/128/$$@E$$@R$$@R$$@O$$@R$$@");
-			BLK = BarcodeGenerator.requestBarcode("/128/$$@B$$@L$$@A$$@C$$@K$$@L$$@I$$@S$$@T$$@");
+			ERR = BarcodeGenerator.requestBarcode(BarcodeRequest//
+					.fromURI("/128/$$@E$$@R$$@R$$@O$$@R$$@"));
+			BLK = BarcodeGenerator.requestBarcode(BarcodeRequest//
+					.fromURI("/128/$$@B$$@L$$@A$$@C$$@K$$@L$$@I$$@S$$@T$$@"));
 		} catch (GenerationException e) {
 			throw new RuntimeException("init failed");
 		}
@@ -39,7 +42,9 @@ public class BarcodeAPIHandler extends RestHandler {
 		try {
 
 			// generate user requested barcode
-			barcode = BarcodeGenerator.requestBarcode(baseRequest.getOriginalURI());
+			String uri = baseRequest.getOriginalURI();
+			BarcodeRequest barcodeRequest = BarcodeRequest.fromURI(uri);
+			barcode = BarcodeGenerator.requestBarcode(barcodeRequest);
 
 		} catch (GenerationException e) {
 

+ 52 - 0
src/main/java/org/barcodeapi/server/api/BulkHandler.java

@@ -0,0 +1,52 @@
+package org.barcodeapi.server.api;
+
+import java.io.IOException;
+
+import javax.servlet.MultipartConfigElement;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.Part;
+
+import org.barcodeapi.core.utils.BulkUtils;
+import org.barcodeapi.server.core.GenerationException;
+import org.barcodeapi.server.core.RestHandler;
+import org.eclipse.jetty.server.Request;
+
+public class BulkHandler extends RestHandler {
+
+	private static final MultipartConfigElement MULTI_PART_CONFIG = new MultipartConfigElement("./");
+
+	public BulkHandler() {
+	}
+
+	@Override
+	public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
+			throws IOException, ServletException {
+		super.handle(target, baseRequest, request, response);
+
+		// Setup accept multi-part
+		request.setAttribute(Request.__MULTIPART_CONFIG_ELEMENT, MULTI_PART_CONFIG);
+		if (!request.getContentType().startsWith("multipart/")) {
+			return;
+		}
+
+		// Response headers for file download
+		response.setHeader("Content-Type", "application/zip");
+		response.setHeader("Content-Disposition", "filename=bulk.zip");
+
+		try {
+
+			// Get the uploaded file
+			Part part = request.getPart("csvFile");
+
+			// Pass input and output streams to bulk helper
+			BulkUtils.getZippedBarcodes(100, //
+					part.getInputStream(), response.getOutputStream());
+
+		} catch (GenerationException e) {
+
+			e.printStackTrace();
+		}
+	}
+}

+ 1 - 1
src/main/java/org/barcodeapi/server/cache/CachedBarcode.java

@@ -26,7 +26,7 @@ public class CachedBarcode extends CachedObject {
 		return cachedData;
 	}
 
-	public long getDataSize() {
+	public int getDataSize() {
 
 		return cachedData == null ? 0 : cachedData.length;
 	}

+ 1 - 2
src/main/java/org/barcodeapi/server/core/BackgroundTask.java

@@ -2,8 +2,7 @@ package org.barcodeapi.server.core;
 
 import java.util.TimerTask;
 
-import org.barcodeapi.core.utils.Log;
-import org.barcodeapi.core.utils.Log.LOG;
+import org.barcodeapi.server.core.Log.LOG;
 import org.barcodeapi.server.statistics.StatsCollector;
 
 public abstract class BackgroundTask extends TimerTask {

+ 0 - 31
src/main/java/org/barcodeapi/server/core/CodeGenerators.java

@@ -44,37 +44,6 @@ public class CodeGenerators {
 		generators.put(CodeType.PDF417, new PDF417Generator());
 	}
 
-	/**
-	 * Get a CodeType object by any of its associated string IDs.
-	 * 
-	 * Will return null if none are found.
-	 * 
-	 * @param codeType
-	 * @return
-	 */
-	public CodeGenerator getGenerator(String codeType) {
-
-		// Convert to lower case
-		codeType = codeType.toLowerCase();
-
-		// Loop all known types
-		for (CodeType type : generators.keySet()) {
-
-			// Loop each defined type string
-			for (String typeString : type.getTypeStrings()) {
-
-				// Return on match
-				if (codeType.equals(typeString)) {
-
-					return getGenerator(type);
-				}
-			}
-		}
-
-		// Return no matches
-		return null;
-	}
-
 	public CodeGenerator getGenerator(CodeType codeType) {
 
 		return generators.get(codeType);

+ 1 - 1
src/main/java/org/barcodeapi/core/utils/Log.java

@@ -1,4 +1,4 @@
-package org.barcodeapi.core.utils;
+package org.barcodeapi.server.core;
 
 import java.io.File;
 import java.io.FileWriter;

+ 1 - 2
src/main/java/org/barcodeapi/server/core/ObjectCache.java

@@ -4,8 +4,7 @@ import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentHashMap.KeySetView;
 
-import org.barcodeapi.core.utils.Log;
-import org.barcodeapi.core.utils.Log.LOG;
+import org.barcodeapi.server.core.Log.LOG;
 import org.barcodeapi.server.statistics.StatsCollector;
 
 public class ObjectCache {

+ 1 - 2
src/main/java/org/barcodeapi/server/core/RestHandler.java

@@ -8,8 +8,7 @@ import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.barcodeapi.core.utils.Log;
-import org.barcodeapi.core.utils.Log.LOG;
+import org.barcodeapi.server.core.Log.LOG;
 import org.barcodeapi.server.session.CachedSession;
 import org.barcodeapi.server.session.SessionCache;
 import org.barcodeapi.server.statistics.StatsCollector;

+ 32 - 1
src/main/java/org/barcodeapi/server/core/TypeSelector.java

@@ -5,12 +5,43 @@ import org.barcodeapi.server.gen.CodeType;
 public class TypeSelector {
 
 	/**
+	 * Get a CodeType object by any of its associated string IDs.
+	 * 
+	 * Will return null if none are found.
+	 * 
+	 * @param codeType
+	 * @return
+	 */
+	public static CodeType getTypeFromString(String codeType) {
+
+		// Convert to lower case
+		codeType = codeType.toLowerCase();
+
+		// Loop all known types
+		for (CodeType type : CodeType.values()) {
+
+			// Loop each defined type string
+			for (String typeString : type.getTypeStrings()) {
+
+				// Return on match
+				if (codeType.equals(typeString)) {
+
+					return type;
+				}
+			}
+		}
+
+		// Return no matches
+		return null;
+	}
+
+	/**
 	 * Returns a CodeType object best suited for the given data string.
 	 * 
 	 * @param data
 	 * @return
 	 */
-	public static CodeType getType(String data) {
+	public static CodeType getTypeFromData(String data) {
 
 		// Match UPC-E format
 		if (data.matches(CodeType.UPC_E.getAutomatchPattern())) {

+ 12 - 126
src/main/java/org/barcodeapi/server/gen/BarcodeGenerator.java

@@ -1,17 +1,12 @@
 package org.barcodeapi.server.gen;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import java.net.URLEncoder;
-
+import org.barcodeapi.core.utils.StringUtils;
 import org.barcodeapi.server.cache.BarcodeCache;
 import org.barcodeapi.server.cache.CachedBarcode;
 import org.barcodeapi.server.core.Blacklist;
 import org.barcodeapi.server.core.CodeGenerators;
 import org.barcodeapi.server.core.GenerationException;
 import org.barcodeapi.server.core.GenerationException.ExceptionType;
-import org.barcodeapi.server.core.TypeSelector;
-import org.json.JSONObject;
 
 public class BarcodeGenerator {
 
@@ -20,77 +15,10 @@ public class BarcodeGenerator {
 	private BarcodeGenerator() {
 	}
 
-	public static CachedBarcode requestBarcode(String target) throws GenerationException {
-
-		// remove [ /api ]
-		if (target.startsWith("/api")) {
-			target = target.substring(4);
-		}
-
-		// get and decode the request string
-		String[] parts = target.split("\\?");
-		String data = decode(parts[0].substring(1));
-
-		// get and parse options
-		JSONObject options = new JSONObject();
-		if (parts.length == 2) {
-			options = parseOptions(parts[1]);
-		}
-
-		// use cache based on options
-		boolean useCache = true;
-		if (options.length() > 0) {
-			useCache = false;
-		}
-		if (data.length() > 64) {
-			useCache = false;
-		}
-		if (options.optBoolean("no-cache", false)) {
-			useCache = false;
-		}
-
-		// process selected type
-		CodeGenerator generator;
-		CodeType type;
-
-		// parse code type / data string
-		int typeIndex = data.indexOf("/");
-		if (typeIndex > 0) {
-
-			// get the type string
-			String typeString = data.substring(0, typeIndex);
-
-			// type is auto
-			if (typeString.equals("auto")) {
-
-				// no type specified
-				data = data.substring(5);
-				type = TypeSelector.getType(data);
-				generator = generators.getGenerator(type);
-			} else {
-
-				// check if generator found for given type
-				generator = generators.getGenerator(typeString);
-				if (generator == null) {
-
-					// no type specified
-					type = TypeSelector.getType(data);
-					generator = generators.getGenerator(type);
-				} else {
-
-					// get generator type and data string
-					type = generator.getType();
-					data = data.substring(typeIndex + 1);
-				}
-			}
-		} else {
-
-			// no type specified
-			type = TypeSelector.getType(data);
-			generator = generators.getGenerator(type);
-		}
+	public static CachedBarcode requestBarcode(BarcodeRequest request) throws GenerationException {
 
 		// check for valid render data
+		String data = request.getData();
 		if (data == null || data.equals("")) {
 
 			throw new GenerationException(ExceptionType.EMPTY);
@@ -109,71 +37,29 @@ public class BarcodeGenerator {
 		CachedBarcode barcode = null;
 
 		// is cache allowed
-		if (useCache) {
+		if (request.useCache()) {
 
 			// lookup image from cache, serve if found
-			barcode = BarcodeCache.getBarcode(type, data);
+			barcode = BarcodeCache.getBarcode(request.getType(), data);
 			if (barcode != null) {
 				return barcode;
 			}
 		}
 
 		// render new image and create its cached object
-		barcode = new CachedBarcode(generator.getCode(data, options));
-		barcode.getProperties().setProperty("type", type.toString());
+		CodeGenerator generator = generators.getGenerator(request.getType());
+		barcode = new CachedBarcode(generator.getCode(data, request.getOptions()));
+		barcode.getProperties().setProperty("type", request.getType().toString());
 		barcode.getProperties().setProperty("data", data);
-		barcode.getProperties().setProperty("nice", stripIllegal(data));
-		barcode.getProperties().setProperty("encd", encode(data));
+		barcode.getProperties().setProperty("nice", StringUtils.stripIllegal(data));
+		barcode.getProperties().setProperty("encd", StringUtils.encode(data));
 
 		// add to cache if allowed
-		if (useCache) {
+		if (request.useCache()) {
 
-			BarcodeCache.addBarcode(type, data, barcode);
+			BarcodeCache.addBarcode(request.getType(), data, barcode);
 		}
 
 		return barcode;
 	}
-
-	private static JSONObject parseOptions(String opts) {
-
-		JSONObject options = new JSONObject();
-
-		String[] parts = opts.split("&");
-
-		for (String option : parts) {
-
-			String[] kv = option.split("=");
-			options.put(kv[0], kv[1]);
-		}
-
-		return options;
-	}
-
-	public static String decode(String data) throws GenerationException {
-
-		try {
-
-			return URLDecoder.decode(data, "UTF-8");
-
-		} catch (UnsupportedEncodingException | IllegalArgumentException e) {
-
-			throw new GenerationException(ExceptionType.INVALID, e);
-		}
-	}
-
-	private static String encode(String data) {
-
-		try {
-
-			return URLEncoder.encode(data, "UTF-8");
-		} catch (Exception e) {
-
-			return null;
-		}
-	}
-
-	private static String stripIllegal(String data) {
-
-		return data.replaceAll("[!@#$%^&*\\(\\)\\[\\]\\{\\};:\\',\\<\\>\\\"]", "");
-	}
 }

+ 132 - 0
src/main/java/org/barcodeapi/server/gen/BarcodeRequest.java

@@ -0,0 +1,132 @@
+package org.barcodeapi.server.gen;
+
+import org.barcodeapi.core.utils.StringUtils;
+import org.barcodeapi.server.core.GenerationException;
+import org.barcodeapi.server.core.TypeSelector;
+import org.json.JSONObject;
+
+public class BarcodeRequest {
+
+	private final CodeType type;
+	private final String data;
+	private final boolean cached;
+	private final JSONObject options;
+
+	private BarcodeRequest(CodeType type, String data, boolean cached, JSONObject options) {
+		this.type = type;
+		this.data = data;
+		this.cached = cached;
+		this.options = options;
+	}
+
+	public CodeType getType() {
+		return type;
+	}
+
+	public String getData() {
+		return data;
+	}
+
+	public boolean useCache() {
+		return cached;
+	}
+
+	public JSONObject getOptions() {
+		return options;
+	}
+
+	public static BarcodeRequest fromURI(String target) throws GenerationException {
+
+		// remove [ /api ]
+		if (target.startsWith("/api")) {
+			target = target.substring(4);
+		}
+
+		// get and decode the request string
+		String[] parts = target.split("\\?");
+		String data = StringUtils.decode(parts[0].substring(1));
+
+		// get and parse options
+		JSONObject options = new JSONObject();
+		if (parts.length == 2) {
+			options = parseOptions(parts[1]);
+		}
+
+		// use cache based on options
+		boolean useCache = true;
+		if (options.length() > 0) {
+			useCache = false;
+		}
+		if (data.length() > 64) {
+			useCache = false;
+		}
+		if (options.optBoolean("no-cache", false)) {
+			useCache = false;
+		}
+
+		CodeType type;
+
+		// parse code type / data string
+		int typeIndex = data.indexOf("/");
+		if (typeIndex > 0) {
+
+			// get the type string
+			String typeString = data.substring(0, typeIndex);
+
+			// type is auto
+			if (typeString.equals("auto")) {
+
+				// no type specified
+				data = data.substring(5);
+				type = TypeSelector.getTypeFromData(data);
+
+			} else {
+
+				// check if generator found for given type
+				type = TypeSelector.getTypeFromString(typeString);
+				if (type == null) {
+
+					// no type specified
+					type = TypeSelector.getTypeFromData(data);
+				} else {
+
+					// set data string to omit type
+					data = data.substring(typeIndex + 1);
+				}
+			}
+		} else {
+
+			// no type specified
+			type = TypeSelector.getTypeFromData(data);
+		}
+
+		return new BarcodeRequest(type, data, useCache, options);
+	}
+
+	public static BarcodeRequest fromCSV(String[] record) throws GenerationException {
+
+		String type = "auto";
+		if (record.length > 1) {
+			type = record[1];
+		}
+
+		String uri = "/api/" + type + "/" + record[0];
+
+		return BarcodeRequest.fromURI(uri);
+	}
+
+	private static JSONObject parseOptions(String opts) {
+
+		JSONObject options = new JSONObject();
+
+		String[] parts = opts.split("&");
+
+		for (String option : parts) {
+
+			String[] kv = option.split("=");
+			options.put(kv[0], kv[1]);
+		}
+
+		return options;
+	}
+}

+ 2 - 2
src/main/java/org/barcodeapi/server/gen/CodeGenerator.java

@@ -1,9 +1,9 @@
 package org.barcodeapi.server.gen;
 
-import org.barcodeapi.core.utils.Log;
-import org.barcodeapi.core.utils.Log.LOG;
 import org.barcodeapi.server.core.GenerationException;
+import org.barcodeapi.server.core.Log;
 import org.barcodeapi.server.core.GenerationException.ExceptionType;
+import org.barcodeapi.server.core.Log.LOG;
 import org.barcodeapi.server.statistics.StatsCollector;
 import org.json.JSONObject;
 

+ 2 - 2
src/main/java/org/barcodeapi/server/tasks/BarcodeCleanupTask.java

@@ -1,10 +1,10 @@
 package org.barcodeapi.server.tasks;
 
-import org.barcodeapi.core.utils.Log;
-import org.barcodeapi.core.utils.Log.LOG;
 import org.barcodeapi.server.cache.BarcodeCache;
 import org.barcodeapi.server.core.BackgroundTask;
+import org.barcodeapi.server.core.Log;
 import org.barcodeapi.server.core.ObjectCache;
+import org.barcodeapi.server.core.Log.LOG;
 import org.barcodeapi.server.gen.CodeType;
 
 public class BarcodeCleanupTask extends BackgroundTask {

+ 2 - 2
src/main/java/org/barcodeapi/server/tasks/SessionCleanupTask.java

@@ -1,9 +1,9 @@
 package org.barcodeapi.server.tasks;
 
-import org.barcodeapi.core.utils.Log;
-import org.barcodeapi.core.utils.Log.LOG;
 import org.barcodeapi.server.core.BackgroundTask;
+import org.barcodeapi.server.core.Log;
 import org.barcodeapi.server.core.ObjectCache;
+import org.barcodeapi.server.core.Log.LOG;
 import org.barcodeapi.server.session.SessionCache;
 
 public class SessionCleanupTask extends BackgroundTask {

+ 2 - 2
src/main/java/org/barcodeapi/server/tasks/StatsDumpTask.java

@@ -1,8 +1,8 @@
 package org.barcodeapi.server.tasks;
 
-import org.barcodeapi.core.utils.Log;
-import org.barcodeapi.core.utils.Log.LOG;
 import org.barcodeapi.server.core.BackgroundTask;
+import org.barcodeapi.server.core.Log;
+import org.barcodeapi.server.core.Log.LOG;
 
 public class StatsDumpTask extends BackgroundTask {
 

+ 1 - 1
src/test/java/org/barcodeapi/test/api/TestServerRoot.java

@@ -32,7 +32,7 @@ public class TestServerRoot extends ServerTestBase {
 	@Test
 	public void testServer_StaticImage() {
 
-		serverGet("/logo.png");
+		serverGet("/img/barcodeapi-logo.svg");
 
 		Assert.assertEquals("Response Code", //
 				HttpStatus.OK_200, getResponseCode());