import java.io.UnsupportedEncodingException;
import java.lang.reflect.InvocationTargetException;
import java.net.URISyntaxException;
+import java.util.Comparator;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import net.pterodactylus.demoscenemusic.data.Artist;
import net.pterodactylus.demoscenemusic.page.ServletRequest;
import net.pterodactylus.util.io.Closer;
import net.pterodactylus.util.io.StreamCopier;
+import net.pterodactylus.util.template.CollectionSortFilter;
import net.pterodactylus.util.template.HtmlFilter;
import net.pterodactylus.util.template.ReflectionAccessor;
import net.pterodactylus.util.template.Template;
templateContextFactory.addAccessor(Object.class, new ReflectionAccessor());
templateContextFactory.addFilter("html", new HtmlFilter());
+ CollectionSortFilter sortFilter = new CollectionSortFilter();
+ sortFilter.addComparator(Artist.class, new Comparator<Artist>() {
+
+ @Override
+ public int compare(Artist leftArtist, Artist rightArtist) {
+ return leftArtist.name().compareToIgnoreCase(rightArtist.name());
+ }
+
+ });
+ templateContextFactory.addFilter("sort", sortFilter);
templateContextFactory.addTemplateObject("core", core);
templateContextFactory.addTemplateObject("dataManager", core.getDataManager());