summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/gitblit/LogoServlet.java
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2013-11-17 16:15:24 -0500
committerJames Moger <james.moger@gitblit.com>2013-11-26 16:07:04 -0500
commitdb4f6b5740c6ea45d9e2209dc569bc18904a8b4d (patch)
tree8dd6c651876359ea2d66e844b77af29394f8cd1e /src/main/java/com/gitblit/LogoServlet.java
parent99d0d4fd66f3490b61c700065b7d16bc4e73f226 (diff)
downloadgitblit-db4f6b5740c6ea45d9e2209dc569bc18904a8b4d.tar.gz
gitblit-db4f6b5740c6ea45d9e2209dc569bc18904a8b4d.zip
Define manager interfaces and update all of Gitblit to use managers
These manager interfaces define how the GitBlit singleton will eventually be split into smaller component managers. The Wicket app and all servlets have been updated to request the needed managers. There are _very_ few method signature changes - although there are a handful. This is a surgical sharding of responsibility based on a proof of concept refactor. Instead of random references to GittBlit.self() there are now precise references to the manager interface required to accomplish some task. Some tasks may require references to multiple managers. The code is now littered with calls to GitBlit.getManager(class) and those familiar with the code-base will no doubt notice the duplication of methods from IUserService in IUserManager and the addition of implementation methods in the GitBlit context class. When the GitBlit class is broken apart and the existing external authentication user service classes are refactored to AuthenticationService classes, this will again simplify and flatten. But in order to safely and cleanly modularize the stable code-base we will have to live with a little duplication for a short while. Change-Id: I7314ec8acaab2dcc6092785ed4434cc09fdbbe16
Diffstat (limited to 'src/main/java/com/gitblit/LogoServlet.java')
-rw-r--r--src/main/java/com/gitblit/LogoServlet.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/main/java/com/gitblit/LogoServlet.java b/src/main/java/com/gitblit/LogoServlet.java
index eb167e72..4222f8ff 100644
--- a/src/main/java/com/gitblit/LogoServlet.java
+++ b/src/main/java/com/gitblit/LogoServlet.java
@@ -27,6 +27,8 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import com.gitblit.manager.IRuntimeManager;
+
/**
* Handles requests for logo.png
*
@@ -45,7 +47,8 @@ public class LogoServlet extends HttpServlet {
@Override
protected long getLastModified(HttpServletRequest req) {
- File file = GitBlit.getFileOrFolder(Keys.web.headerLogo, "${baseFolder}/logo.png");
+ IRuntimeManager runtimeManager = GitBlit.getManager(IRuntimeManager.class);
+ File file = runtimeManager.getFileOrFolder(Keys.web.headerLogo, "${baseFolder}/logo.png");
if (file.exists()) {
return Math.max(lastModified, file.lastModified());
} else {
@@ -59,7 +62,8 @@ public class LogoServlet extends HttpServlet {
InputStream is = null;
try {
String contentType = null;
- File file = GitBlit.getFileOrFolder(Keys.web.headerLogo, "${baseFolder}/logo.png");
+ IRuntimeManager runtimeManager = GitBlit.getManager(IRuntimeManager.class);
+ File file = runtimeManager.getFileOrFolder(Keys.web.headerLogo, "${baseFolder}/logo.png");
if (file.exists()) {
// custom logo
ServletContext context = request.getSession().getServletContext();
@@ -88,7 +92,7 @@ public class LogoServlet extends HttpServlet {
} catch (Exception e) {
e.printStackTrace();
} finally {
- if(is != null) {
+ if (is != null) {
is.close();
}
}