本文整理了Java中hudson.Functions.getResourcePath()
方法的一些代码示例,展示了Functions.getResourcePath()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Functions.getResourcePath()
方法的具体详情如下:
包路径:hudson.Functions
类名称:Functions
方法名:getResourcePath
[英]Resoruce path prefix.
[中]解析路径前缀。
代码示例来源:origin: jenkinsci/jenkins
/**
* Resolve an avatar image URL string for the user.
* Note that this method must be called from an HTTP request to be reliable; else use {@link #resolveOrNull}.
* @param u user
* @param avatarSize the preferred image size, "[width]x[height]"
* @return a URL string for a user Avatar image.
*/
public static String resolve(User u, String avatarSize) {
String avatar = resolveOrNull(u, avatarSize);
return avatar != null ? avatar : Jenkins.getInstance().getRootUrl() + Functions.getResourcePath() + "/images/" + avatarSize + "/user.png";
}
代码示例来源:origin: jenkinsci/jenkins
public static void initPageVariables(JellyContext context) {
StaplerRequest currentRequest = Stapler.getCurrentRequest();
String rootURL = currentRequest.getContextPath();
Functions h = new Functions();
context.setVariable("h", h);
// The path starts with a "/" character but does not end with a "/" character.
context.setVariable("rootURL", rootURL);
/*
load static resources from the path dedicated to a specific version.
This "/static/VERSION/abc/def.ghi" path is interpreted by stapler to be
the same thing as "/abc/def.ghi", but this avoids the stale cache
problem when the user upgrades to new Jenkins. Stapler also sets a long
future expiration dates for such static resources.
see https://wiki.jenkins-ci.org/display/JENKINS/Hyperlinks+in+HTML
*/
context.setVariable("resURL",rootURL+getResourcePath());
context.setVariable("imagesURL",rootURL+getResourcePath()+"/images");
context.setVariable("userAgent", currentRequest.getHeader("User-Agent"));
IconSet.initPageVariables(context);
}
代码示例来源:origin: jenkinsci/jenkins
/**
* @see ContextMenuVisibility
*/
public ContextMenu add(Action a) {
if (!Functions.isContextMenuVisible(a)) {
return this;
}
StaplerRequest req = Stapler.getCurrentRequest();
String text = a.getDisplayName();
String base = Functions.getIconFilePath(a);
if (base==null) return this;
String icon = Stapler.getCurrentRequest().getContextPath()+(base.startsWith("images/")?Functions.getResourcePath():"")+'/'+base;
String url = Functions.getActionUrl(req.findAncestor(ModelObject.class).getUrl(),a);
return add(url,icon,text);
}
代码示例来源:origin: jenkinsci/jenkins
@Override protected synchronized JSON data() {
JSONArray r = new JSONArray();
for (User u : modified) {
UserInfo i = users.get(u);
JSONObject entry = new JSONObject().
accumulate("id", u.getId()).
accumulate("fullName", u.getFullName()).
accumulate("url", u.getUrl()).
accumulate("avatar", i.avatar != null ? i.avatar : Stapler.getCurrentRequest().getContextPath() + Functions.getResourcePath() + "/images/" + iconSize + "/user.png").
accumulate("timeSortKey", i.getTimeSortKey()).
accumulate("lastChangeTimeString", i.getLastChangeTimeString());
Job<?,?> p = i.getJob();
if (p != null) {
entry.accumulate("projectUrl", p.getUrl()).accumulate("projectFullDisplayName", p.getFullDisplayName());
}
r.add(entry);
}
modified.clear();
return r;
}
代码示例来源:origin: jenkinsci/android-emulator-plugin
@Override
public String getHelpFile() {
return Functions.getResourcePath() + "/plugin/android-emulator/help-snapshotSave.html";
}
代码示例来源:origin: jenkinsci/shiningpanda-plugin
@Override
public String getHelpFile() {
return Functions.getResourcePath() + "/plugin/shiningpanda/help/workspace/WorkspaceHomeProperty/help.html";
}
代码示例来源:origin: jenkinsci/shiningpanda-plugin
@Override
public String getHelpFile() {
return Functions.getResourcePath() + "/plugin/shiningpanda/help/builders/BuildoutBuilder/help.html";
}
代码示例来源:origin: jenkinsci/android-emulator-plugin
@Override
public String getHelpFile() {
return Functions.getResourcePath() + "/plugin/android-emulator/help-runMonkey.html";
}
代码示例来源:origin: jenkinsci/android-emulator-plugin
@Override
public String getHelpFile() {
return Functions.getResourcePath() + "/plugin/android-emulator/help-uninstallPackage.html";
}
代码示例来源:origin: jenkinsci/android-emulator-plugin
@Override
public String getHelpFile() {
return Functions.getResourcePath() + "/plugin/android-emulator/help-installPrerequisites.html";
}
代码示例来源:origin: jenkinsci/android-emulator-plugin
@Override
public String getHelpFile() {
return Functions.getResourcePath() + "/plugin/android-emulator/help-publishMonkeyOutput.html";
}
代码示例来源:origin: jenkinsci/shiningpanda-plugin
@Override
public String getHelpFile() {
return Functions.getResourcePath() + "/plugin/shiningpanda/help/matrix/ToxAxis/help.html";
}
代码示例来源:origin: jenkinsci/shiningpanda-plugin
@Override
public String getHelpFile() {
return Functions.getResourcePath() + "/plugin/shiningpanda/help/publishers/CoveragePublisher/help.html";
}
代码示例来源:origin: jenkinsci/shiningpanda-plugin
@Override
public String getHelpFile() {
return Functions.getResourcePath() + "/plugin/shiningpanda/help/builders/VirtualenvBuilder/help.html";
}
代码示例来源:origin: jenkinsci/android-emulator-plugin
@Override
public String getHelpFile() {
return Functions.getResourcePath() + "/plugin/android-emulator/help-installPackage.html";
}
代码示例来源:origin: jenkinsci/android-emulator-plugin
@Override
public String getHelpFile() {
return Functions.getResourcePath() + "/plugin/android-emulator/help-createBuildFiles.html";
}
代码示例来源:origin: jenkinsci/android-emulator-plugin
@Override
public String getHelpFile() {
return Functions.getResourcePath() + "/plugin/android-emulator/help-snapshotLoad.html";
}
代码示例来源:origin: jenkinsci/android-emulator-plugin
@Override
public String getHelpFile() {
return Functions.getResourcePath() + "/plugin/android-emulator/help-buildConfig.html";
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Resolve an avatar image URL string for the user.
* Note that this method must be called from an HTTP request to be reliable; else use {@link #resolveOrNull}.
* @param u user
* @param avatarSize the preferred image size, "[width]x[height]"
* @return a URL string for a user Avatar image.
*/
public static String resolve(User u, String avatarSize) {
String avatar = resolveOrNull(u, avatarSize);
return avatar != null ? avatar : Jenkins.getInstance().getRootUrl() + Functions.getResourcePath() + "/images/" + avatarSize + "/user.png";
}
代码示例来源:origin: com.sonymobile.jenkins.plugins.lenientshutdown/lenientshutdown
@Override
public String getIconFileName() {
String icon = null;
if (computer != null && !computer.isTemporarilyOffline()) {
PluginImpl plugin = PluginImpl.getInstance();
if (plugin.isNodeShuttingDown(computer.getName()) && computer.hasPermission(Computer.CONNECT)) {
icon = DISABLE_ICON;
} else if (computer.hasPermission(Computer.DISCONNECT)) {
icon = Functions.getResourcePath() + "/plugin/" + getUrlName() + ENABLE_ICON;
}
}
return icon;
}
内容来源于网络,如有侵权,请联系作者删除!