diff src/nabble/view/web/seo/WidgetRedir.java @ 0:7ecd1a4ef557

add content
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 21 Mar 2019 19:15:52 -0600
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/nabble/view/web/seo/WidgetRedir.java	Thu Mar 21 19:15:52 2019 -0600
@@ -0,0 +1,44 @@
+
+package nabble.view.web.seo;
+
+import fschmidt.util.servlet.JtpContext;
+import nabble.view.lib.UrlMappable;
+import nabble.model.Init;
+import nabble.view.web.more.ForumStart;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+
+public final class WidgetRedir extends HttpServlet implements UrlMappable {
+
+	private static final Pattern URL_PATTERN = Pattern.compile("/free-forum-widget\\.html$");
+
+	private static final String WIDGET_REDIR = Init.get("widgetRedir", ForumStart.path("forum"));
+
+	private static String path() {
+		return "/free-forum-widget.html";
+	}
+
+	public Map<String,String[]> getParameterMapFromUrl(HttpServletRequest request,String mappedUrl) {
+		return Collections.emptyMap();
+	}
+
+	public Pattern getUrlPattern() {
+		return URL_PATTERN;
+	}
+
+	protected void service(HttpServletRequest request,HttpServletResponse response)
+		throws ServletException, IOException
+	{
+		response.setHeader("Location", WIDGET_REDIR);
+		response.sendError(HttpServletResponse.SC_MOVED_PERMANENTLY);
+	}
+}
+