From a502d96a860456ec5e8c96761db70f7cabb74751 Mon Sep 17 00:00:00 2001
From: Paul Martin <paul@paulsputer.com>
Date: Sat, 30 Apr 2016 04:19:14 -0400
Subject: [PATCH] Merge pull request #1073 from gitblit/1062-DocEditorUpdates

---
 src/main/java/com/gitblit/guice/WebModule.java |   42 ++++++++++++++++++++++--------------------
 1 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/src/main/java/com/gitblit/guice/WebModule.java b/src/main/java/com/gitblit/guice/WebModule.java
index 4a0cfcd..7c83e45 100644
--- a/src/main/java/com/gitblit/guice/WebModule.java
+++ b/src/main/java/com/gitblit/guice/WebModule.java
@@ -18,6 +18,7 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import com.gitblit.AvatarGenerator;
 import com.gitblit.Constants;
 import com.gitblit.servlet.AccessDeniedServlet;
 import com.gitblit.servlet.BranchGraphServlet;
@@ -25,6 +26,7 @@
 import com.gitblit.servlet.DownloadZipServlet;
 import com.gitblit.servlet.EnforceAuthenticationFilter;
 import com.gitblit.servlet.FederationServlet;
+import com.gitblit.servlet.FilestoreServlet;
 import com.gitblit.servlet.GitFilter;
 import com.gitblit.servlet.GitServlet;
 import com.gitblit.servlet.LogoServlet;
@@ -53,21 +55,22 @@
 public class WebModule extends ServletModule {
 
 	final static String ALL = "/*";
-	private boolean isGO;
-
-	public WebModule(boolean isGO) {
-		this.isGO=isGO;
-	}
 
 	@Override
 	protected void configureServlets() {
+
+		// bind web component providers
+		bind(AvatarGenerator.class).toProvider(AvatarGeneratorProvider.class);
+
 		// servlets
+		serveRegex(FilestoreServlet.REGEX_PATH).with(FilestoreServlet.class);
 		serve(fuzzy(Constants.R_PATH), fuzzy(Constants.GIT_PATH)).with(GitServlet.class);
 		serve(fuzzy(Constants.RAW_PATH)).with(RawServlet.class);
 		serve(fuzzy(Constants.PAGES)).with(PagesServlet.class);
 		serve(fuzzy(Constants.RPC_PATH)).with(RpcServlet.class);
 		serve(fuzzy(Constants.ZIP_PATH)).with(DownloadZipServlet.class);
 		serve(fuzzy(Constants.SYNDICATION_PATH)).with(SyndicationServlet.class);
+		
 
 		serve(fuzzy(Constants.FEDERATION_PATH)).with(FederationServlet.class);
 		serve(fuzzy(Constants.SPARKLESHARE_INVITE_PATH)).with(SparkleShareInviteServlet.class);
@@ -75,20 +78,18 @@
 		serve(Constants.PT_PATH).with(PtServlet.class);
 		serve("/robots.txt").with(RobotsTxtServlet.class);
 		serve("/logo.png").with(LogoServlet.class);
-		if(isGO)
-		{
-			/* Prevent accidental access to 'resources' such as GitBlit java classes
-			 *
-			 * In the GO setup the JAR containing the application and the WAR injected
-			 * into Jetty are the same file. However Jetty expects to serve the entire WAR
-			 * contents, except the WEB-INF folder. Thus, all java binary classes in the
-			 * JAR are served by default as is they were legitimate resources.
-			 *
-			 * The below servlet mappings prevent that behavior
-			 */
-			serve(fuzzy("/com/")).with(AccessDeniedServlet.class);
-			serve(fuzzy("/org/")).with(AccessDeniedServlet.class);
-		}
+
+		/* Prevent accidental access to 'resources' such as GitBlit java classes
+		 *
+		 * In the GO setup the JAR containing the application and the WAR injected
+		 * into Jetty are the same file. However Jetty expects to serve the entire WAR
+		 * contents, except the WEB-INF folder. Thus, all java binary classes in the
+		 * JAR are served by default as is they were legitimate resources.
+		 *
+		 * The below servlet mappings prevent that behavior
+		 */
+		serve(fuzzy("/com/")).with(AccessDeniedServlet.class);
+
 		// global filters
 		filter(ALL).through(ProxyFilter.class);
 		filter(ALL).through(EnforceAuthenticationFilter.class);
@@ -100,7 +101,8 @@
 		filter(fuzzy(Constants.RPC_PATH)).through(RpcFilter.class);
 		filter(fuzzy(Constants.ZIP_PATH)).through(DownloadZipFilter.class);
 		filter(fuzzy(Constants.SYNDICATION_PATH)).through(SyndicationFilter.class);
-
+		
+		
 		// Wicket
 		String toIgnore = Joiner.on(",").join(Constants.R_PATH, Constants.GIT_PATH, Constants.RAW_PATH,
 				Constants.PAGES, Constants.RPC_PATH, Constants.ZIP_PATH, Constants.SYNDICATION_PATH,

--
Gitblit v1.9.1