本文整理了Java中hudson.model.TopLevelItem.getUrl()
方法的一些代码示例,展示了TopLevelItem.getUrl()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TopLevelItem.getUrl()
方法的具体详情如下:
包路径:hudson.model.TopLevelItem
类名称:TopLevelItem
方法名:getUrl
暂无
代码示例来源:origin: jenkinsci/jenkins
/**
* Computes the redirection target URL for the newly created {@link TopLevelItem}.
*/
protected String redirectAfterCreateItem(StaplerRequest req, TopLevelItem result) throws IOException {
return req.getContextPath()+'/'+result.getUrl()+"configure";
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Computes the redirection target URL for the newly created {@link TopLevelItem}.
*/
protected String redirectAfterCreateItem(StaplerRequest req, TopLevelItem result) throws IOException {
return req.getContextPath()+'/'+result.getUrl()+"configure";
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
/**
* Computes the redirection target URL for the newly created {@link TopLevelItem}.
*/
protected String redirectAfterCreateItem(StaplerRequest req, TopLevelItem result) throws IOException {
return req.getContextPath()+'/'+result.getUrl()+"configure";
}
代码示例来源:origin: hudson/hudson-2.x
/**
* Computes the redirection target URL for the newly created {@link TopLevelItem}.
*/
protected String redirectAfterCreateItem(StaplerRequest req, TopLevelItem result) throws IOException {
return req.getContextPath()+'/'+result.getUrl()+"configure";
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
/**
* Computes the redirection target URL for the newly created {@link TopLevelItem}.
*/
protected String redirectAfterCreateItem(StaplerRequest req, TopLevelItem result) throws IOException {
return req.getContextPath()+'/'+result.getUrl()+"configure";
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
/**
* Computes the redirection target URL for the newly created
* {@link TopLevelItem}.
*/
protected String redirectAfterCreateItem(StaplerRequest req, TopLevelItem result) throws IOException {
return req.getContextPath() + '/' + result.getUrl() + "configure";
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
@Override
public String getUrl() {
return item().getUrl();
}
代码示例来源:origin: groupon/DotCi
protected String redirectAfterCreateItem(StaplerRequest req, TopLevelItem result) throws IOException {
return Jenkins.getInstance().getRootUrl() + result.getUrl();
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
/**
*send the browser to the config page
* use View to trim view/{default-view} from URL if possible
*/
@Override
protected String redirectAfterCreateItem(StaplerRequest req, TopLevelItem result) throws IOException {
String redirect = result.getUrl() + "configure";
List<Ancestor> ancestors = req.getAncestors();
for (int i = ancestors.size() - 1; i >= 0; i--) {
Object o = ancestors.get(i).getObject();
if (o instanceof View) {
redirect = req.getContextPath() + '/' + ((View) o).getUrl() + redirect;
break;
}
}
return redirect;
}
};
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
/**
*send the browser to the config page
* use View to trim view/{default-view} from URL if possible
*/
@Override
protected String redirectAfterCreateItem(StaplerRequest req, TopLevelItem result) throws IOException {
String redirect = result.getUrl() + "configure";
List<Ancestor> ancestors = req.getAncestors();
for (int i = ancestors.size() - 1; i >= 0; i--) {
Object o = ancestors.get(i).getObject();
if (o instanceof View) {
redirect = req.getContextPath() + '/' + ((View) o).getUrl() + redirect;
break;
}
}
return redirect;
}
};
代码示例来源:origin: org.eclipse.hudson/hudson-core
/**
* send the browser to the config page use View to trim
* view/{default-view} from URL if possible
*/
@Override
protected String redirectAfterCreateItem(StaplerRequest req, TopLevelItem result) throws IOException {
String redirect = result.getUrl() + "configure";
List<Ancestor> ancestors = req.getAncestors();
for (int i = ancestors.size() - 1; i >= 0; i--) {
Object o = ancestors.get(i).getObject();
if (o instanceof View) {
redirect = req.getContextPath() + '/' + ((View) o).getUrl() + redirect;
break;
}
}
return redirect;
}
};
代码示例来源:origin: hudson/hudson-2.x
/**
*send the browser to the config page
* use View to trim view/{default-view} from URL if possible
*/
@Override
protected String redirectAfterCreateItem(StaplerRequest req, TopLevelItem result) throws IOException {
String redirect = result.getUrl() + "configure";
List<Ancestor> ancestors = req.getAncestors();
for (int i = ancestors.size() - 1; i >= 0; i--) {
Object o = ancestors.get(i).getObject();
if (o instanceof View) {
redirect = req.getContextPath() + '/' + ((View) o).getUrl() + redirect;
break;
}
}
return redirect;
}
};
代码示例来源:origin: jenkinsci/gerrit-trigger-plugin
/**
* Loads the config.xml for the job via http.
* I.e. http://jenkinshost/job/thejob/config.xml
*
* @param job the job
* @return the xml page
* @throws IOException if so
* @throws SAXException if so
*/
XmlPage loadConfigXmlViaHttp(TopLevelItem job) throws IOException, SAXException {
return j.createWebClient().goToXml(job.getUrl() + "config.xml");
}
代码示例来源:origin: jenkinsci/jobConfigHistory-plugin
/**
* Action when 'restore' button is pressed: Restore deleted project.
*
* @param req
* Incoming StaplerRequest
* @param rsp
* Outgoing StaplerResponse
* @throws IOException
* If something goes wrong
*/
public final void doRestore(StaplerRequest req, StaplerResponse rsp)
throws IOException {
getAccessControlledObject().checkPermission(Item.CONFIGURE);
final String deletedName = req.getParameter("name");
final String newName = deletedName.split("_deleted_")[0];
final XmlFile configXml = getLastAvailableConfigXml(deletedName);
final InputStream is = new ByteArrayInputStream(
configXml.asString().getBytes("UTF-8"));
final String calculatedNewName = findNewName(newName);
final TopLevelItem project = getJenkins()
.createProjectFromXML(calculatedNewName, is);
// TODO: Casting here should be removed.
((FileHistoryDao) getHistoryDao()).copyHistoryAndDelete(deletedName,
calculatedNewName);
rsp.sendRedirect(getJenkins().getRootUrl() + project.getUrl());
}
代码示例来源:origin: jenkinsci/gerrit-trigger-plugin
/**
* Tests that configuring an existing project via jenkins http rest doesn't produce duplicated triggers
* and that the trigger is configured for the new project pattern.
*
* @throws Exception if so
*/
@Test
@LocalData
public void testReconfigureUsingRestApi() throws Exception {
assertNrOfEventListeners(0);
TopLevelItem testProj = j.jenkins.getItem("testProj");
String gerritProjectPattern = "someotherproject";
XmlPage xmlPage = loadConfigXmlViaHttp(testProj);
Document document = xmlPage.getXmlDocument();
String xml = changeConfigXml(gerritProjectPattern, document);
URL url = UrlUtils.toUrlUnsafe(j.getURL().toExternalForm() + testProj.getUrl() + "config.xml");
WebRequest request = new WebRequest(url, HttpMethod.POST);
request.setRequestBody(xml);
j.jenkins.setCrumbIssuer(null);
Page page = j.createWebClient().getPage(request);
j.assertGoodStatus(page);
assertNrOfEventListeners(0);
assertEventListenerWithSomeOtherProjectSet(gerritProjectPattern);
}
内容来源于网络,如有侵权,请联系作者删除!