James Moger
2011-10-25 486ee115abb831b2ec78be6777fb1bca9e931df0
commit | author | age
892570 1 /*
JM 2  * Copyright 2011 gitblit.com.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
896c53 16 package com.gitblit;
JM 17
892570 18 /**
JM 19  * The GitServlet exists to force configuration of the JGit GitServlet based on
20  * the Gitblit settings from either gitblit.properties or from context
21  * parameters in the web.xml file.
22  * 
23  * Access to this servlet is protected by the GitFilter.
24  * 
25  * @author James Moger
26  * 
27  */
896c53 28 public class GitServlet extends org.eclipse.jgit.http.server.GitServlet {
JM 29
30     private static final long serialVersionUID = 1L;
31
892570 32     /**
JM 33      * Configure the servlet from Gitblit's configuration.
34      */
896c53 35     @Override
JM 36     public String getInitParameter(String name) {
37         if (name.equals("base-path")) {
38             return GitBlit.getString(Keys.git.repositoriesFolder, "git");
39         } else if (name.equals("export-all")) {
40             return "1";
41         }
42         return super.getInitParameter(name);
43     }
44 }