</display-name>\r
\r
<!-- PARAMS --> \r
- \r
- <!-- Gitblit Context Listener --><!-- STRIP \r
- <listener>\r
- <listener-class>com.gitblit.GitBlit</listener-class>\r
- </listener>STRIP --> \r
- \r
- \r
- <!-- Git Servlet\r
- <url-pattern> MUST match: \r
- * GitFilter\r
- * com.gitblit.Constants.GIT_PATH\r
- * Wicket Filter ignorePaths parameter -->\r
- <servlet>\r
- <servlet-name>GitServlet</servlet-name>\r
- <servlet-class>com.gitblit.git.GitServlet</servlet-class>\r
- </servlet>\r
- <servlet-mapping>\r
- <servlet-name>GitServlet</servlet-name> \r
- <url-pattern>/git/*</url-pattern>\r
- </servlet-mapping>\r
-\r
- \r
- <!-- SparkleShare Invite Servlet\r
- <url-pattern> MUST match: \r
- * com.gitblit.Constants.SPARKLESHARE_INVITE_PATH\r
- * Wicket Filter ignorePaths parameter -->\r
- <servlet>\r
- <servlet-name>SparkleShareInviteServlet</servlet-name>\r
- <servlet-class>com.gitblit.SparkleShareInviteServlet</servlet-class>\r
- </servlet>\r
- <servlet-mapping>\r
- <servlet-name>SparkleShareInviteServlet</servlet-name> \r
- <url-pattern>/sparkleshare/*</url-pattern>\r
- </servlet-mapping>\r
-\r
- \r
- <!-- Syndication Servlet\r
- <url-pattern> MUST match: \r
- * SyndicationFilter\r
- * com.gitblit.Constants.SYNDICATION_PATH\r
- * Wicket Filter ignorePaths parameter -->\r
- <servlet>\r
- <servlet-name>SyndicationServlet</servlet-name>\r
- <servlet-class>com.gitblit.SyndicationServlet</servlet-class> \r
- </servlet>\r
- <servlet-mapping>\r
- <servlet-name>SyndicationServlet</servlet-name>\r
- <url-pattern>/feed/*</url-pattern>\r
- </servlet-mapping>\r
- \r
- \r
- <!-- Zip Servlet\r
- <url-pattern> MUST match: \r
- * ZipServlet\r
- * com.gitblit.Constants.ZIP_PATH\r
- * Wicket Filter ignorePaths parameter -->\r
- <servlet>\r
- <servlet-name>ZipServlet</servlet-name>\r
- <servlet-class>com.gitblit.DownloadZipServlet</servlet-class> \r
- </servlet>\r
- <servlet-mapping>\r
- <servlet-name>ZipServlet</servlet-name>\r
- <url-pattern>/zip/*</url-pattern>\r
- </servlet-mapping>\r
- \r
- \r
- <!-- Federation Servlet\r
- <url-pattern> MUST match: \r
- * com.gitblit.Constants.FEDERATION_PATH \r
- * Wicket Filter ignorePaths parameter -->\r
- <servlet>\r
- <servlet-name>FederationServlet</servlet-name>\r
- <servlet-class>com.gitblit.FederationServlet</servlet-class> \r
- </servlet>\r
- <servlet-mapping>\r
- <servlet-name>FederationServlet</servlet-name>\r
- <url-pattern>/federation/*</url-pattern>\r
- </servlet-mapping> \r
- \r
- \r
- <!-- Rpc Servlet\r
- <url-pattern> MUST match: \r
- * com.gitblit.Constants.RPC_PATH \r
- * Wicket Filter ignorePaths parameter -->\r
- <servlet>\r
- <servlet-name>RpcServlet</servlet-name>\r
- <servlet-class>com.gitblit.RpcServlet</servlet-class> \r
- </servlet>\r
- <servlet-mapping>\r
- <servlet-name>RpcServlet</servlet-name>\r
- <url-pattern>/rpc/*</url-pattern>\r
- </servlet-mapping> \r
-\r
-\r
- <!-- Pages Servlet\r
- <url-pattern> MUST match: \r
- * PagesFilter\r
- * com.gitblit.Constants.PAGES_PATH\r
- * Wicket Filter ignorePaths parameter -->\r
- <servlet>\r
- <servlet-name>PagesServlet</servlet-name>\r
- <servlet-class>com.gitblit.PagesServlet</servlet-class>\r
- </servlet>\r
- <servlet-mapping>\r
- <servlet-name>PagesServlet</servlet-name> \r
- <url-pattern>/pages/*</url-pattern>\r
- </servlet-mapping> \r
-\r
- \r
- <!-- Logo Servlet\r
- <url-pattern> MUST match: \r
- * Wicket Filter ignorePaths parameter -->\r
- <servlet>\r
- <servlet-name>LogoServlet</servlet-name>\r
- <servlet-class>com.gitblit.LogoServlet</servlet-class>\r
- </servlet>\r
- <servlet-mapping>\r
- <servlet-name>LogoServlet</servlet-name> \r
- <url-pattern>/logo.png</url-pattern>\r
- </servlet-mapping>\r
-\r
- <!-- Branch Graph Servlet\r
- <url-pattern> MUST match: \r
- * Wicket Filter ignorePaths parameter -->\r
- <servlet>\r
- <servlet-name>BranchGraphServlet</servlet-name>\r
- <servlet-class>com.gitblit.BranchGraphServlet</servlet-class>\r
- </servlet>\r
- <servlet-mapping>\r
- <servlet-name>BranchGraphServlet</servlet-name> \r
- <url-pattern>/graph/*</url-pattern>\r
- </servlet-mapping>\r
-\r
- <!-- Robots.txt Servlet\r
- <url-pattern> MUST match: \r
- * Wicket Filter ignorePaths parameter -->\r
- <servlet>\r
- <servlet-name>RobotsTxtServlet</servlet-name>\r
- <servlet-class>com.gitblit.RobotsTxtServlet</servlet-class>\r
- </servlet>\r
- <servlet-mapping>\r
- <servlet-name>RobotsTxtServlet</servlet-name> \r
- <url-pattern>/robots.txt</url-pattern>\r
- </servlet-mapping>\r
-\r
- \r
- <!-- Git Access Restriction Filter\r
- <url-pattern> MUST match: \r
- * GitServlet\r
- * com.gitblit.Constants.GIT_PATH\r
- * Wicket Filter ignorePaths parameter -->\r
- <filter>\r
- <filter-name>GitFilter</filter-name>\r
- <filter-class>com.gitblit.GitFilter</filter-class>\r
- </filter>\r
- <filter-mapping>\r
- <filter-name>GitFilter</filter-name>\r
- <url-pattern>/git/*</url-pattern>\r
- </filter-mapping>\r
- \r
- \r
- <!-- Syndication Restriction Filter\r
- <url-pattern> MUST match: \r
- * SyndicationServlet\r
- * com.gitblit.Constants.SYNDICATION_PATH\r
- * Wicket Filter ignorePaths parameter -->\r
- <filter>\r
- <filter-name>SyndicationFilter</filter-name>\r
- <filter-class>com.gitblit.SyndicationFilter</filter-class>\r
- </filter>\r
- <filter-mapping>\r
- <filter-name>SyndicationFilter</filter-name>\r
- <url-pattern>/feed/*</url-pattern>\r
- </filter-mapping>\r
- \r
- \r
- <!-- Download Zip Restriction Filter\r
- <url-pattern> MUST match: \r
- * DownloadZipServlet\r
- * com.gitblit.Constants.ZIP_PATH\r
- * Wicket Filter ignorePaths parameter -->\r
- <filter>\r
- <filter-name>ZipFilter</filter-name>\r
- <filter-class>com.gitblit.DownloadZipFilter</filter-class>\r
- </filter>\r
- <filter-mapping>\r
- <filter-name>ZipFilter</filter-name>\r
- <url-pattern>/zip/*</url-pattern>\r
- </filter-mapping>\r
-\r
- \r
- <!-- Rpc Restriction Filter\r
- <url-pattern> MUST match: \r
- * RpcServlet\r
- * com.gitblit.Constants.RPC_PATH\r
- * Wicket Filter ignorePaths parameter -->\r
- <filter>\r
- <filter-name>RpcFilter</filter-name>\r
- <filter-class>com.gitblit.RpcFilter</filter-class>\r
- </filter>\r
- <filter-mapping>\r
- <filter-name>RpcFilter</filter-name>\r
- <url-pattern>/rpc/*</url-pattern>\r
- </filter-mapping>\r
-\r
-\r
- <!-- Pges Restriction Filter\r
- <url-pattern> MUST match: \r
- * PagesServlet\r
- * com.gitblit.Constants.PAGES_PATH\r
- * Wicket Filter ignorePaths parameter -->\r
- <filter>\r
- <filter-name>PagesFilter</filter-name>\r
- <filter-class>com.gitblit.PagesFilter</filter-class>\r
- </filter>\r
- <filter-mapping>\r
- <filter-name>PagesFilter</filter-name>\r
- <url-pattern>/pages/*</url-pattern>\r
- </filter-mapping>\r
- \r
- <filter>\r
- <filter-name>EnforceAuthenticationFilter</filter-name>\r
- <filter-class>com.gitblit.EnforceAuthenticationFilter</filter-class>\r
- </filter>\r
- <filter-mapping>\r
- <filter-name>EnforceAuthenticationFilter</filter-name>\r
- <url-pattern>/*</url-pattern>\r
- </filter-mapping>\r
-\r
-\r
- <!-- Wicket Filter -->\r
- <filter>\r
- <filter-name>wicketFilter</filter-name>\r
- <filter-class>\r
- com.gitblit.wicket.GitblitWicketFilter\r
- </filter-class>\r
- <init-param>\r
- <param-name>applicationClassName</param-name>\r
- <param-value>com.gitblit.wicket.GitBlitWebApp</param-value>\r
- </init-param>\r
- <init-param>\r
- <param-name>ignorePaths</param-name>\r
- <!-- Paths should match \r
- * SyndicationFilter <url-pattern>\r
- * SyndicationServlet <url-pattern>\r
- * com.gitblit.Constants.SYNDICATION_PATH\r
- * GitFilter <url-pattern>\r
- * GitServlet <url-pattern>\r
- * com.gitblit.Constants.GIT_PATH\r
- * SparkleshareInviteServlet <url-pattern>\r
- * com.gitblit.Constants.SPARKLESHARE_INVITE_PATH\r
- * Zipfilter <url-pattern>\r
- * ZipServlet <url-pattern>\r
- * com.gitblit.Constants.ZIP_PATH\r
- * FederationServlet <url-pattern>\r
- * RpcFilter <url-pattern>\r
- * RpcServlet <url-pattern>\r
- * PagesFilter <url-pattern>\r
- * PagesServlet <url-pattern>\r
- * com.gitblit.Constants.PAGES_PATH -->\r
- <param-value>git/,feed/,zip/,federation/,rpc/,pages/,robots.txt,logo.png,graph/,sparkleshare/</param-value>\r
- </init-param>\r
- </filter>\r
- <filter-mapping>\r
- <filter-name>wicketFilter</filter-name>\r
- <url-pattern>/*</url-pattern>\r
- </filter-mapping>\r
</web-app>
\ No newline at end of file
*/\r
public class DownloadZipFilter extends AccessRestrictionFilter {\r
\r
+ public DownloadZipFilter() {\r
+ }\r
+\r
/**\r
* Extract the repository name from the url.\r
*\r
protected transient Logger logger = LoggerFactory.getLogger(getClass());
+ public EnforceAuthenticationFilter() {
+ }
+
/*
* @see javax.servlet.Filter#init(javax.servlet.FilterConfig)
*/
import javax.naming.NamingException;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
-import javax.servlet.ServletContextListener;
+import javax.servlet.annotation.WebListener;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jgit.util.FS;
import org.eclipse.jgit.util.FileUtils;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import com.gitblit.Constants.AccessPermission;
import com.gitblit.Constants.AccessRestrictionType;
import com.gitblit.fanout.FanoutService;
import com.gitblit.fanout.FanoutSocketService;
import com.gitblit.git.GitDaemon;
+import com.gitblit.git.GitServlet;
import com.gitblit.manager.IFederationManager;
import com.gitblit.manager.IGitblitManager;
import com.gitblit.manager.INotificationManager;
import com.gitblit.utils.TimeUtils;
import com.gitblit.utils.X509Utils.X509Metadata;
import com.gitblit.wicket.GitBlitWebSession;
+import com.gitblit.wicket.GitblitWicketFilter;
import com.gitblit.wicket.WicketUtils;
import com.google.gson.Gson;
import com.google.gson.JsonIOException;
/**
* GitBlit is the servlet context listener singleton that acts as the core for
* the web ui and the servlets. This class is either directly instantiated by
- * the GitBlitServer class (Gitblit GO) or is reflectively instantiated from the
- * definition in the web.xml file (Gitblit WAR).
+ * the GitBlitServer class (Gitblit GO) or is reflectively instantiated by the
+ * servlet 3 container (Gitblit WAR or Express).
*
* This class is the central logic processor for Gitblit. All settings, user
* object, and repository object operations pass through this class.
*
- * Repository Resolution. There are two pathways for finding repositories. One
- * pathway, for web ui display and repository authentication & authorization, is
- * within this class. The other pathway is through the standard GitServlet.
- *
* @author James Moger
*
*/
-public class GitBlit implements ServletContextListener,
- IRuntimeManager,
+@WebListener
+public class GitBlit extends InjectionContextListener
+ implements IRuntimeManager,
INotificationManager,
IUserManager,
ISessionManager,
private final IStoredSettings goSettings;
- private final Logger logger = LoggerFactory.getLogger(GitBlit.class);
-
private final ScheduledExecutorService scheduledExecutor = Executors.newScheduledThreadPool(10);
private final List<FederationModel> federationRegistrations = Collections
private final ObjectCache<String> projectRepositoriesMarkdownCache = new ObjectCache<String>();
- private ServletContext servletContext;
-
private File baseFolder;
private File repositoriesFolder;
* @see ServletContextListener.contextInitialize(ServletContextEvent)
*/
@Override
- public void contextInitialized(ServletContextEvent contextEvent) {
- servletContext = contextEvent.getServletContext();
+ protected void beforeServletInjection(ServletContext context) {
if (settings == null) {
// Gitblit is running in a servlet container
- ServletContext context = contextEvent.getServletContext();
WebXmlSettings webxmlSettings = new WebXmlSettings(context);
String contextRealPath = context.getRealPath("/");
File contextFolder = (contextRealPath != null) ? new File(contextRealPath) : null;
}
settingsModel = loadSettingModels();
- serverStatus.servletContainer = servletContext.getServerInfo();
+ serverStatus.servletContainer = context.getServerInfo();
}
protected void extractResources(ServletContext context, String path, File toDir) {
setCookie(response, null);
userService.logout(user);
}
+
+ /**
+ * Instantiate and inject all filters and servlets into the container using
+ * the servlet 3 specification.
+ */
+ @Override
+ protected void injectServlets(ServletContext context) {
+ // access restricted servlets
+ serve(context, Constants.GIT_PATH, GitServlet.class, GitFilter.class);
+ serve(context, Constants.PAGES, PagesServlet.class, PagesFilter.class);
+ serve(context, Constants.RPC_PATH, RpcServlet.class, RpcFilter.class);
+ serve(context, Constants.ZIP_PATH, DownloadZipServlet.class, DownloadZipFilter.class);
+ serve(context, Constants.SYNDICATION_PATH, SyndicationServlet.class, SyndicationFilter.class);
+
+ // servlets
+ serve(context, Constants.FEDERATION_PATH, FederationServlet.class);
+ serve(context, Constants.SPARKLESHARE_INVITE_PATH, SparkleShareInviteServlet.class);
+ serve(context, Constants.BRANCH_GRAPH_PATH, BranchGraphServlet.class);
+ file(context, "/robots.txt", RobotsTxtServlet.class);
+ file(context, "/logo.png", LogoServlet.class);
+
+ // optional force basic authentication
+ filter(context, "/*", EnforceAuthenticationFilter.class, null);
+
+ // Wicket
+ String toIgnore = StringUtils.flattenStrings(getRegisteredPaths(), ",");
+ Map<String, String> params = new HashMap<String, String>();
+ params.put(GitblitWicketFilter.FILTER_MAPPING_PARAM, "/*");
+ params.put(GitblitWicketFilter.IGNORE_PATHS_PARAM, toIgnore);
+ filter(context, "/*", GitblitWicketFilter.class, params);
+ }
}
protected static final String[] suffixes = { gitReceivePack, gitUploadPack, "/info/refs", "/HEAD",\r
"/objects" };\r
\r
+ public GitFilter() {\r
+ }\r
+\r
/**\r
* Extract the repository name from the url.\r
*\r
--- /dev/null
+/*
+ * Copyright 2013 gitblit.com.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gitblit;
+
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.DispatcherType;
+import javax.servlet.Filter;
+import javax.servlet.FilterRegistration;
+import javax.servlet.Servlet;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import javax.servlet.ServletRegistration;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Injection context listener instantiates and injects servlets, filters, and
+ * anything else you might want into a servlet context. This class provides
+ * convenience methods for servlet & filter registration and also tracks
+ * registered paths.
+ *
+ * @author James Moger
+ *
+ */
+public abstract class InjectionContextListener implements ServletContextListener {
+
+ protected final Logger logger = LoggerFactory.getLogger(getClass());
+
+ private final List<String> registeredPaths = new ArrayList<String>();
+
+ protected final List<String> getRegisteredPaths() {
+ return registeredPaths;
+ }
+
+ /**
+ * Hook for subclasses to manipulate context initialization before
+ * standard initialization procedure.
+ *
+ * @param context
+ */
+ protected void beforeServletInjection(ServletContext context) {
+ // NOOP
+ }
+
+ /**
+ * Hook for subclasses to instantiate and inject servlets and filters
+ * into the servlet context.
+ *
+ * @param context
+ */
+ protected abstract void injectServlets(ServletContext context);
+
+ /**
+ * Hook for subclasses to manipulate context initialization after
+ * servlet registration.
+ *
+ * @param context
+ */
+ protected void afterServletInjection(ServletContext context) {
+ // NOOP
+ }
+
+ /**
+ * Configure Gitblit from the web.xml, if no configuration has already been
+ * specified.
+ *
+ * @see ServletContextListener.contextInitialize(ServletContextEvent)
+ */
+ @Override
+ public final void contextInitialized(ServletContextEvent contextEvent) {
+ ServletContext context = contextEvent.getServletContext();
+ beforeServletInjection(context);
+ injectServlets(context);
+ afterServletInjection(context);
+ }
+
+
+ /**
+ * Registers a file path.
+ *
+ * @param context
+ * @param file
+ * @param servletClass
+ */
+ protected void file(ServletContext context, String file, Class<? extends Servlet> servletClass) {
+ file(context, file, servletClass, null);
+ }
+
+ /**
+ * Registers a file path with init parameters.
+ *
+ * @param context
+ * @param file
+ * @param servletClass
+ * @param initParams
+ */
+ protected void file(ServletContext context, String file, Class<? extends Servlet> servletClass, Map<String, String> initParams) {
+ Servlet servlet = instantiate(context, servletClass);
+ ServletRegistration.Dynamic d = context.addServlet(sanitize(servletClass.getSimpleName() + file), servlet);
+ d.addMapping(file);
+ if (initParams != null) {
+ d.setInitParameters(initParams);
+ }
+ registeredPaths.add(file);
+ }
+
+ /**
+ * Serves a path (trailing wildcard will be appended).
+ *
+ * @param context
+ * @param route
+ * @param servletClass
+ */
+ protected void serve(ServletContext context, String route, Class<? extends Servlet> servletClass) {
+ serve(context, route, servletClass, (Class<Filter>) null);
+ }
+
+ /**
+ * Serves a path (trailing wildcard will be appended) with init parameters.
+ *
+ * @param context
+ * @param route
+ * @param servletClass
+ * @param initParams
+ */
+ protected void serve(ServletContext context, String route, Class<? extends Servlet> servletClass, Map<String, String> initParams) {
+ Servlet servlet = instantiate(context, servletClass);
+ ServletRegistration.Dynamic d = context.addServlet(sanitize(servletClass.getSimpleName() + route), servlet);
+ d.addMapping(route + "*");
+ if (initParams != null) {
+ d.setInitParameters(initParams);
+ }
+ registeredPaths.add(route);
+ }
+
+ /**
+ * Serves a path (trailing wildcard will be appended) and also maps a filter
+ * to that path.
+ *
+ * @param context
+ * @param route
+ * @param servletClass
+ * @param filterClass
+ */
+ protected void serve(ServletContext context, String route, Class<? extends Servlet> servletClass, Class<? extends Filter> filterClass) {
+ Servlet servlet = instantiate(context, servletClass);
+ ServletRegistration.Dynamic d = context.addServlet(sanitize(servletClass.getSimpleName() + route), servlet);
+ d.addMapping(route + "*");
+ if (filterClass != null) {
+ filter(context, route + "*", filterClass);
+ }
+ registeredPaths.add(route);
+ }
+
+ /**
+ * Registers a path filter.
+ *
+ * @param context
+ * @param route
+ * @param filterClass
+ */
+ protected void filter(ServletContext context, String route, Class<? extends Filter> filterClass) {
+ filter(context, route, filterClass, null);
+ }
+
+ /**
+ * Registers a path filter with init parameters.
+ *
+ * @param context
+ * @param route
+ * @param filterClass
+ * @param initParams
+ */
+ protected void filter(ServletContext context, String route, Class<? extends Filter> filterClass, Map<String, String> initParams) {
+ Filter filter = instantiate(context, filterClass);
+ FilterRegistration.Dynamic d = context.addFilter(sanitize(filterClass.getSimpleName() + route), filter);
+ d.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), true, route);
+ if (initParams != null) {
+ d.setInitParameters(initParams);
+ }
+ }
+
+ /**
+ * Limit the generated servlet/filter names to alpha-numeric values with a
+ * handful of acceptable other characters.
+ *
+ * @param name
+ * @return a sanitized name
+ */
+ protected String sanitize(String name) {
+ StringBuilder sb = new StringBuilder();
+ for (char c : name.toCharArray()) {
+ if (Character.isLetterOrDigit(c)) {
+ sb.append(c);
+ } else if ('-' == c) {
+ sb.append(c);
+ } else if ('*' == c) {
+ sb.append("all");
+ } else if ('.' == c) {
+ sb.append('.');
+ } else {
+ sb.append('_');
+ }
+ }
+ return sb.toString();
+ }
+
+ /**
+ * Instantiates an object.
+ *
+ * @param clazz
+ * @return the object
+ */
+ protected <X> X instantiate(ServletContext context, Class<X> clazz) {
+ try {
+ return clazz.newInstance();
+ } catch (Throwable t) {
+ logger.error(null, t);
+ }
+ return null;
+ }
+}
*/\r
public class PagesFilter extends AccessRestrictionFilter {\r
\r
+ public PagesFilter() {\r
+ }\r
+\r
/**\r
* Extract the repository name from the url.\r
*\r
*/\r
public class RpcFilter extends AuthenticationFilter {\r
\r
+ public RpcFilter() {\r
+ }\r
+\r
/**\r
* doFilter does the actual work of preprocessing the request to ensure that\r
* the user may proceed.\r
*/\r
public class SyndicationFilter extends AuthenticationFilter {\r
\r
+ public SyndicationFilter() {\r
+ }\r
+\r
/**\r
* Extract the repository name from the url.\r
*\r
\r
private transient Logger logger = LoggerFactory.getLogger(SyndicationServlet.class);\r
\r
+ public SyndicationServlet() {\r
+ }\r
+\r
/**\r
* Create a feed link for the specified repository and branch/tag/commit id.\r
*\r
\r
private static final long serialVersionUID = 1L;\r
\r
+ public GitServlet() {\r
+ }\r
+\r
@Override\r
public void init(ServletConfig config) throws ServletException {\r
IRepositoryManager repositoryManager = GitBlit.getManager(IRepositoryManager.class);\r
\r
import javax.servlet.http.HttpServletRequest;\r
\r
+import org.apache.wicket.protocol.http.IWebApplicationFactory;\r
+import org.apache.wicket.protocol.http.WebApplication;\r
import org.apache.wicket.protocol.http.WicketFilter;\r
import org.apache.wicket.util.string.Strings;\r
import org.eclipse.jgit.lib.Repository;\r
*/\r
public class GitblitWicketFilter extends WicketFilter {\r
\r
+ public GitblitWicketFilter() {\r
+ }\r
+\r
+ @Override\r
+ protected IWebApplicationFactory getApplicationFactory() {\r
+ return new IWebApplicationFactory() {\r
+ @Override\r
+ public WebApplication createApplication(WicketFilter filter) {\r
+ return new GitBlitWebApp();\r
+ }\r
+ };\r
+ }\r
+\r
/**\r
* Determines the last-modified date of the requested resource.\r
*\r
@Override\r
protected long getLastModified(final HttpServletRequest servletRequest) {\r
final String pathInfo = getRelativePath(servletRequest);\r
- if (Strings.isEmpty(pathInfo))\r
+ if (Strings.isEmpty(pathInfo)) {\r
return -1;\r
+ }\r
long lastModified = super.getLastModified(servletRequest);\r
if (lastModified > -1) {\r
return lastModified;\r