本文整理汇总了Java中com.gitblit.Keys类的典型用法代码示例。如果您正苦于以下问题:Java Keys类的具体用法?Java Keys怎么用?Java Keys使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Keys类属于com.gitblit包,在下文中一共展示了Keys类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setHeaders
import com.gitblit.Keys; //导入依赖的package包/类
@Override
protected void setHeaders(WebResponse response) {
// set canonical link as http header for SEO (issue-304)
// https://support.google.com/webmasters/answer/139394?hl=en
response.setHeader("Link", MessageFormat.format("<{0}>; rel=\"canonical\"", getCanonicalUrl()));
int expires = app().settings().getInteger(Keys.web.pageCacheExpires, 0);
if (expires > 0) {
// pages are personalized for the authenticated user so they must be
// marked private to prohibit proxy servers from caching them
response.setHeader("Cache-Control", "private, must-revalidate");
setLastModified();
} else {
// use default Wicket caching behavior
super.setHeaders(response);
}
// XRF vulnerability. issue-500 / ticket-166
response.setHeader("X-Frame-Options", "SAMEORIGIN");
}
开发者ID:tomaswolf,项目名称:gerrit-gitblit-plugin,代码行数:20,代码来源:BasePage.java
示例2: asLink
import com.gitblit.Keys; //导入依赖的package包/类
/**
* Returns an url to this servlet for the specified parameters.
*
* @param baseURL
* @param repository
* @param branch
* @param path
* @return an url
*/
public static String asLink(String baseURL, String repository, String branch, String path) {
if (baseURL.length() > 0 && baseURL.charAt(baseURL.length() - 1) == '/') {
baseURL = baseURL.substring(0, baseURL.length() - 1);
}
char fsc = '!';
char c = GitblitContext.getManager(IRuntimeManager.class).getSettings().getChar(Keys.web.forwardSlashCharacter, '/');
if (c != '/') {
fsc = c;
}
if (branch != null) {
branch = Repository.shortenRefName(branch).replace('/', fsc);
}
String encodedPath = path == null ? "" : path.replace('/', fsc);
return baseURL + Constants.RAW_PATH + repository + "/" + (branch == null ? "" : (branch + "/" + encodedPath));
}
开发者ID:tomaswolf,项目名称:gerrit-gitblit-plugin,代码行数:27,代码来源:RawServlet.java
示例3: getRootPageParameters
import com.gitblit.Keys; //导入依赖的package包/类
private PageParameters getRootPageParameters() {
if (reusePageParameters()) {
PageParameters pp = getPageParameters();
if (pp != null) {
PageParameters params = new PageParameters(pp);
// remove named project parameter
params.remove("p");
// remove named repository parameter
params.remove("r");
// remove named user parameter
params.remove("user");
// remove days back parameter if it is the default value
if (params.containsKey("db") && params.getInt("db") == app().settings().getInteger(Keys.web.activityDuration, 7)) {
params.remove("db");
}
return params;
}
}
return null;
}
开发者ID:tomaswolf,项目名称:gerrit-gitblit-plugin,代码行数:24,代码来源:RootPage.java
示例4: setLastModified
import com.gitblit.Keys; //导入依赖的package包/类
/**
* Sets the last-modified header field and the expires field.
*
* @param when
*/
protected final void setLastModified(Date when) {
if (when == null) {
return;
}
if (when.before(app().getBootDate())) {
// last-modified can not be before the Gitblit boot date
// this helps ensure that pages are properly refreshed after a
// server config change
when = app().getBootDate();
}
int expires = app().settings().getInteger(Keys.web.pageCacheExpires, 0);
WebResponse response = (WebResponse) getResponse();
response.setLastModifiedTime(Time.valueOf(when));
response.setDateHeader("Expires", System.currentTimeMillis() + Duration.minutes(expires).getMilliseconds());
}
开发者ID:tomaswolf,项目名称:gerrit-gitblit-plugin,代码行数:23,代码来源:BasePage.java
示例5: configureCommitCache
import com.gitblit.Keys; //导入依赖的package包/类
@Override
protected void configureCommitCache() {
int daysToCache = runtimeManager.getSettings().getInteger(Keys.web.activityCacheDays, 14);
if (daysToCache <= 0) {
log.info("Commit cache is disabled");
return;
}
CommitCache.instance().setCacheDays(daysToCache);
// Run this potentially long-running operation in the background
Thread loader = new Thread() {
@Override
public void run() {
log.info("Starting to populate commit cache in background");
GerritGitBlitRepositoryManager.super.configureCommitCache();
log.info("Done populating commit cache in background");
}
};
loader.setName("CommitCacheLoader");
loader.setDaemon(true);
loader.start();
}
开发者ID:tomaswolf,项目名称:gerrit-gitblit-plugin,代码行数:22,代码来源:GerritGitBlitRepositoryManager.java
示例6: GerritGitBlitUserManager
import com.gitblit.Keys; //导入依赖的package包/类
@Inject
public GerritGitBlitUserManager(final ProjectControl.GenericFactory projectControl, final GitBlitSettings settings,
final DynamicItem<WebSession> gerritSession, final Provider<AnonymousUser> anonymousUser, final GetDiffPreferences getDiffPreferences) {
this.projectControl = projectControl;
this.userProvider = new Provider<CurrentUser>() {
@Override
public CurrentUser get() {
return gerritSession.get().getUser();
}
};
this.anonymousUser = anonymousUser;
this.getDiffPreferences = getDiffPreferences;
if (!settings.getBoolean(Keys.web.authenticateViewPages, false) && !fixAnonymousUser()) {
settings.saveSettings(ImmutableMap.of(Keys.web.authenticateViewPages, Boolean.TRUE.toString()));
}
}
开发者ID:tomaswolf,项目名称:gerrit-gitblit-plugin,代码行数:17,代码来源:GerritGitBlitUserManager.java
示例7: setCookie
import com.gitblit.Keys; //导入依赖的package包/类
@Override
public void setCookie(HttpServletRequest request, HttpServletResponse response, UserModel user) {
if (settings.getBoolean(Keys.web.allowCookieAuthentication, true) && isStandardLogin(request)) {
Cookie userCookie;
if (user == null) {
// clear cookie for logout
userCookie = new Cookie(Constants.NAME, "");
} else {
// set cookie for login
String cookie = userManager.getCookie(user);
if (Strings.isNullOrEmpty(cookie)) {
// create empty cookie
userCookie = new Cookie(Constants.NAME, "");
} else {
// create real cookie
userCookie = new Cookie(Constants.NAME, cookie);
// expire the cookie in 7 days
userCookie.setMaxAge((int) TimeUnit.DAYS.toSeconds(7));
}
}
userCookie.setPath(hostRelativePluginPath);
response.addCookie(userCookie);
}
}
开发者ID:tomaswolf,项目名称:gerrit-gitblit-plugin,代码行数:25,代码来源:GerritGitBlitAuthenticationManager.java
示例8: test
import com.gitblit.Keys; //导入依赖的package包/类
/**
* This method will test for know issues in certain containers where %2F
* is blocked from use in URLs. It will emit a warning to the logger if
* the configuration of Tomcat causes the URL processing to fail on %2F.
*/
public static void test()
{
if (GitBlit.getBoolean(Keys.web.mountParameters, true)
&& ((GitBlit.getChar(Keys.web.forwardSlashCharacter, '/')) == '/' || (GitBlit.getChar(
Keys.web.forwardSlashCharacter, '/')) == '\\'))
{
try
{
if (GitBlit.isGO())
;
else if (logCVE_2007_0450Tomcat())
;
// else if (logCVE_2007_0450xxx());
else
{
LOGGER.info("Unknown container, cannot check for CVE-2007-0450 aplicability");
}
}
catch (Throwable t)
{
LOGGER.warn("Failure in checking for CVE-2007-0450 aplicability", t);
}
}
}
开发者ID:warpfork,项目名称:gitblit,代码行数:31,代码来源:ContainerUtils.java
示例9: setMetadataDefaults
import com.gitblit.Keys; //导入依赖的package包/类
private void setMetadataDefaults(X509Metadata metadata) {
metadata.serverHostname = gitblitSettings.getString(Keys.web.siteName, Constants.NAME);
if (StringUtils.isEmpty(metadata.serverHostname)) {
metadata.serverHostname = Constants.NAME;
}
// set default values from config file
File certificatesConfigFile = new File(folder, X509Utils.CA_CONFIG);
FileBasedConfig config = new FileBasedConfig(certificatesConfigFile, FS.detect());
if (certificatesConfigFile.exists()) {
try {
config.load();
} catch (Exception e) {
Utils.showException(GitblitAuthority.this, e);
}
NewCertificateConfig certificateConfig = NewCertificateConfig.KEY.parse(config);
certificateConfig.update(metadata);
}
}
开发者ID:warpfork,项目名称:gitblit,代码行数:20,代码来源:GitblitAuthority.java
示例10: getURL
import com.gitblit.Keys; //导入依赖的package包/类
public String getURL(String action, String repository, String objectId) {
boolean mounted = settings.get(Keys.web.mountParameters).getBoolean(true);
StringBuilder sb = new StringBuilder();
sb.append(url);
sb.append('/');
sb.append(action);
sb.append('/');
if (mounted) {
// mounted url/action/repository/objectId
sb.append(StringUtils.encodeURL(repository));
if (!StringUtils.isEmpty(objectId)) {
sb.append('/');
sb.append(objectId);
}
return sb.toString();
} else {
// parameterized url/action/&r=repository&h=objectId
sb.append("?r=");
sb.append(repository);
if (!StringUtils.isEmpty(objectId)) {
sb.append("&h=");
sb.append(objectId);
}
return sb.toString();
}
}
开发者ID:warpfork,项目名称:gitblit,代码行数:27,代码来源:GitblitClient.java
示例11: getPreReceiveScriptsInherited
import com.gitblit.Keys; //导入依赖的package包/类
/**
* Returns the list of pre-receive scripts the repository inherited from the
* global settings and team affiliations.
*
* @param repository
* if null only the globally specified scripts are returned
* @return a list of scripts
*/
public List<String> getPreReceiveScriptsInherited(RepositoryModel repository) {
Set<String> scripts = new LinkedHashSet<String>();
// Globals
for (String script : settings.get(Keys.groovy.preReceiveScripts).getStrings()) {
if (script.endsWith(".groovy")) {
scripts.add(script.substring(0, script.lastIndexOf('.')));
} else {
scripts.add(script);
}
}
// Team Scripts
if (repository != null) {
for (String teamname : getPermittedTeamnames(repository)) {
TeamModel team = getTeamModel(teamname);
if (!ArrayUtils.isEmpty(team.preReceiveScripts)) {
scripts.addAll(team.preReceiveScripts);
}
}
}
return new ArrayList<String>(scripts);
}
开发者ID:warpfork,项目名称:gitblit,代码行数:31,代码来源:GitblitClient.java
示例12: getPostReceiveScriptsInherited
import com.gitblit.Keys; //导入依赖的package包/类
/**
* Returns the list of post-receive scripts the repository inherited from
* the global settings and team affiliations.
*
* @param repository
* if null only the globally specified scripts are returned
* @return a list of scripts
*/
public List<String> getPostReceiveScriptsInherited(RepositoryModel repository) {
Set<String> scripts = new LinkedHashSet<String>();
// Global Scripts
for (String script : settings.get(Keys.groovy.postReceiveScripts).getStrings()) {
if (script.endsWith(".groovy")) {
scripts.add(script.substring(0, script.lastIndexOf('.')));
} else {
scripts.add(script);
}
}
// Team Scripts
if (repository != null) {
for (String teamname : getPermittedTeamnames(repository)) {
TeamModel team = getTeamModel(teamname);
if (!ArrayUtils.isEmpty(team.postReceiveScripts)) {
scripts.addAll(team.postReceiveScripts);
}
}
}
return new ArrayList<String>(scripts);
}
开发者ID:warpfork,项目名称:gitblit,代码行数:30,代码来源:GitblitClient.java
示例13: insertActivityGraph
import com.gitblit.Keys; //导入依赖的package包/类
private void insertActivityGraph(List<Metric> metrics) {
if ((metrics != null) && (metrics.size() > 0)
&& GitBlit.getBoolean(Keys.web.generateActivityGraph, true)) {
// daily line chart
GoogleChart chart = new GoogleLineChart("chartDaily", "", "unit",
getString("gb.commits"));
for (Metric metric : metrics) {
chart.addValue(metric.name, metric.count);
}
chart.setWidth(375);
chart.setHeight(150);
GoogleCharts charts = new GoogleCharts();
charts.addChart(chart);
add(new HeaderContributor(charts));
}
}
开发者ID:warpfork,项目名称:gitblit,代码行数:19,代码来源:OverviewPage.java
示例14: addDropDownMenus
import com.gitblit.Keys; //导入依赖的package包/类
@Override
protected void addDropDownMenus(List<PageRegistration> pages) {
DropDownMenuRegistration filters = new DropDownMenuRegistration("gb.filters",
ActivityPage.class);
PageParameters currentParameters = getPageParameters();
int daysBack = GitBlit.getInteger(Keys.web.activityDuration, 7);
if (currentParameters != null && !currentParameters.containsKey("db")) {
currentParameters.put("db", daysBack);
}
// preserve time filter options on repository choices
filters.menuItems.addAll(getRepositoryFilterItems(currentParameters));
// preserve repository filter options on time choices
filters.menuItems.addAll(getTimeFilterItems(currentParameters));
if (filters.menuItems.size() > 0) {
// Reset Filter
filters.menuItems.add(new DropDownMenuItem(getString("gb.reset"), null, null));
}
pages.add(filters);
}
开发者ID:warpfork,项目名称:gitblit,代码行数:24,代码来源:ActivityPage.java
示例15: getRootPageParameters
import com.gitblit.Keys; //导入依赖的package包/类
private PageParameters getRootPageParameters() {
if (reusePageParameters()) {
PageParameters pp = getPageParameters();
if (pp != null) {
PageParameters params = new PageParameters(pp);
// remove named project parameter
params.remove("p");
// remove named repository parameter
params.remove("r");
// remove named user parameter
params.remove("user");
// remove days back parameter if it is the default value
if (params.containsKey("db")
&& params.getInt("db") == GitBlit.getInteger(Keys.web.activityDuration, 7)) {
params.remove("db");
}
return params;
}
}
return null;
}
开发者ID:warpfork,项目名称:gitblit,代码行数:25,代码来源:RootPage.java
示例16: getTimeFilterItems
import com.gitblit.Keys; //导入依赖的package包/类
protected List<DropDownMenuItem> getTimeFilterItems(PageParameters params) {
// days back choices - additive parameters
int daysBack = GitBlit.getInteger(Keys.web.activityDuration, 7);
if (daysBack < 1) {
daysBack = 7;
}
List<DropDownMenuItem> items = new ArrayList<DropDownMenuItem>();
Set<Integer> choicesSet = new TreeSet<Integer>(GitBlit.getIntegers(Keys.web.activityDurationChoices));
if (choicesSet.isEmpty()) {
choicesSet.addAll(Arrays.asList(7, 14, 28, 60, 90, 180));
}
List<Integer> choices = new ArrayList<Integer>(choicesSet);
Collections.sort(choices);
String lastDaysPattern = getString("gb.lastNDays");
for (Integer db : choices) {
String txt = MessageFormat.format(lastDaysPattern, db);
items.add(new DropDownMenuItem(txt, "db", db.toString(), params));
}
items.add(new DropDownMenuItem());
return items;
}
开发者ID:warpfork,项目名称:gitblit,代码行数:22,代码来源:RootPage.java
示例17: EditRepositoryPage
import com.gitblit.Keys; //导入依赖的package包/类
public EditRepositoryPage() {
// create constructor
super();
isCreate = true;
RepositoryModel model = new RepositoryModel();
String restriction = GitBlit.getString(Keys.git.defaultAccessRestriction, null);
model.accessRestriction = AccessRestrictionType.fromName(restriction);
String authorization = GitBlit.getString(Keys.git.defaultAuthorizationControl, null);
model.authorizationControl = AuthorizationControl.fromName(authorization);
GitBlitWebSession session = GitBlitWebSession.get();
UserModel user = session.getUser();
if (user != null && user.canCreate() && !user.canAdmin()) {
// personal create permissions, inject personal repository path
model.name = user.getPersonalPath() + "/";
model.projectPath = user.getPersonalPath();
model.addOwner(user.username);
// personal repositories are private by default
model.accessRestriction = AccessRestrictionType.VIEW;
model.authorizationControl = AuthorizationControl.NAMED;
}
setupPage(model);
setStatelessHint(false);
setOutputMarkupId(true);
}
开发者ID:warpfork,项目名称:gitblit,代码行数:27,代码来源:EditRepositoryPage.java
示例18: FederationPage
import com.gitblit.Keys; //导入依赖的package包/类
public FederationPage() {
super();
setupPage("", "");
boolean showFederation = showAdmin && GitBlit.canFederate();
add(new FederationTokensPanel("federationTokensPanel", showFederation)
.setVisible(showFederation));
FederationProposalsPanel proposalsPanel = new FederationProposalsPanel(
"federationProposalsPanel");
if (showFederation) {
proposalsPanel.hideIfEmpty();
} else {
proposalsPanel.setVisible(false);
}
boolean showRegistrations = GitBlit.getBoolean(Keys.web.showFederationRegistrations, false);
FederationRegistrationsPanel registrationsPanel = new FederationRegistrationsPanel(
"federationRegistrationsPanel");
if (showAdmin || showRegistrations) {
registrationsPanel.hideIfEmpty();
} else {
registrationsPanel.setVisible(false);
}
add(proposalsPanel);
add(registrationsPanel);
}
开发者ID:warpfork,项目名称:gitblit,代码行数:27,代码来源:FederationPage.java
示例19: insertActivityGraph
import com.gitblit.Keys; //导入依赖的package包/类
private void insertActivityGraph(List<Metric> metrics) {
if ((metrics != null) && (metrics.size() > 0)
&& GitBlit.getBoolean(Keys.web.generateActivityGraph, true)) {
IChartData data = WicketUtils.getChartData(metrics);
ChartProvider provider = new ChartProvider(new Dimension(290, 100), ChartType.LINE,
data);
ChartAxis dateAxis = new ChartAxis(ChartAxisType.BOTTOM);
dateAxis.setLabels(new String[] { metrics.get(0).name,
metrics.get(metrics.size() / 2).name, metrics.get(metrics.size() - 1).name });
provider.addAxis(dateAxis);
ChartAxis commitAxis = new ChartAxis(ChartAxisType.LEFT);
commitAxis.setLabels(new String[] { "",
String.valueOf((int) WicketUtils.maxValue(metrics)) });
provider.addAxis(commitAxis);
provider.setLineStyles(new LineStyle[] { new LineStyle(2, 4, 0), new LineStyle(0, 4, 1) });
provider.addShapeMarker(new ShapeMarker(MarkerType.CIRCLE, Color.decode("#002060"), 1, -1, 5));
add(new Chart("commitsChart", provider));
} else {
add(WicketUtils.newBlankImage("commitsChart"));
}
}
开发者ID:warpfork,项目名称:gitblit,代码行数:25,代码来源:SummaryPage.java
示例20: setupPage
import com.gitblit.Keys; //导入依赖的package包/类
protected void setupPage(String repositoryName, String pageName) {
String siteName = GitBlit.getString(Keys.web.siteName, Constants.NAME);
if (StringUtils.isEmpty(siteName)) {
siteName = Constants.NAME;
}
if (repositoryName != null && repositoryName.trim().length() > 0) {
add(new Label("title", repositoryName + " - " + siteName));
} else {
add(new Label("title", siteName));
}
ExternalLink rootLink = new ExternalLink("rootLink", urlFor(GitBlitWebApp.HOME_PAGE_CLASS, null).toString());
WicketUtils.setHtmlTooltip(rootLink, GitBlit.getString(Keys.web.siteName, Constants.NAME));
add(rootLink);
// Feedback panel for info, warning, and non-fatal error messages
add(new FeedbackPanel("feedback"));
add(new Label("gbVersion", "v" + Constants.getVersion()));
if (GitBlit.getBoolean(Keys.web.aggressiveHeapManagement, false)) {
System.gc();
}
}
开发者ID:warpfork,项目名称:gitblit,代码行数:24,代码来源:BasePage.java
注:本文中的com.gitblit.Keys类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论