本文整理汇总了Java中org.kohsuke.stapler.StaplerRequest.getSubmittedForm方法的典型用法代码示例。如果您正苦于以下问题:Java StaplerRequest.getSubmittedForm方法的具体用法?Java StaplerRequest.getSubmittedForm怎么用?Java StaplerRequest.getSubmittedForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kohsuke.stapler.StaplerRequest
的用法示例。
在下文中一共展示了StaplerRequest.getSubmittedForm方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doParamsSubmit
import org.kohsuke.stapler.StaplerRequest; //导入方法依赖的package包/类
public void doParamsSubmit(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
List<BuildTargetParameter> buildTargetParams;
TargetParameterBuildAction paramAction;
JSONObject jsonObject;
TargetBuildParameterUtil buildParamUtil = new TargetBuildParameterUtil();
jsonObject = req.getSubmittedForm();
buildTargetParams = buildParamUtil.parse(jsonObject);
if (buildTargetParams == null) {
rsp.sendRedirect(400, "Invalid Parameters - All Fields must be filed");
return;
} else {
paramAction = new TargetParameterBuildAction();
paramAction.setBaseBranch(jsonObject.getString("baseBranch"));
paramAction.setParameters(buildTargetParams);
Hudson.getInstance().getQueue().schedule2(project, 0, paramAction, new CauseAction(new Cause.UserIdCause()));
}
rsp.sendRedirect("../");
}
示例2: doProjectsSubmit
import org.kohsuke.stapler.StaplerRequest; //导入方法依赖的package包/类
public void doProjectsSubmit(StaplerRequest req, StaplerResponse rsp)
throws UnsupportedEncodingException, ServletException,
FormException, IOException {
Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
req.setCharacterEncoding("UTF-8");
JSONObject json = req.getSubmittedForm();
AuthorizationStrategy strategy = this.newInstance(req, json);
Jenkins.getInstance().setAuthorizationStrategy(strategy);
Jenkins.getInstance().save();
}
示例3: submit
import org.kohsuke.stapler.StaplerRequest; //导入方法依赖的package包/类
/**
* Used to persist the configuration form upon submission.
*
* @since 1.0
*/
@Override
protected void submit(StaplerRequest req, StaplerResponse rsp)
throws IOException, ServletException, FormException {
super.submit(req, rsp);
JSONObject json = req.getSubmittedForm();
String key = "preTestConfig";
JSONObject viewObject;
if (json.has(key)) {
viewObject = json.getJSONObject(key);
if (viewObject != null) {
key = "testCaseList";
if (viewObject.has(key)) {
this.testCaseList = viewObject.getString(key);
}
key = "testTargetScript";
if (viewObject.has(key)) {
this.testTargetScript = viewObject.getString(key);
}
key = "testListIsRelOrAbs";
if (viewObject.has(key)) {
this.testListIsRelOrAbs = viewObject.getString(key);
}
key = "targetScrIsRelOrAbs";
if (viewObject.has(key)) {
this.targetScrIsRelOrAbs = viewObject.getString(key);
}
key = "slaveTestEnv";
if (viewObject.has(key)) {
this.slaveTestEnv = viewObject.getString(key);
}
key = "statisticsFile";
if (viewObject.has(key)) {
this.statisticsFile = viewObject.getString(key);
}
}
}
}
示例4: doAssignSubmit
import org.kohsuke.stapler.StaplerRequest; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void doAssignSubmit(StaplerRequest req, StaplerResponse rsp)
throws UnsupportedEncodingException, ServletException,
FormException, IOException {
Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
req.setCharacterEncoding("UTF-8");
JSONObject json = req.getSubmittedForm();
AuthorizationStrategy oldStrategy = Jenkins.getInstance()
.getAuthorizationStrategy();
if (json.has(AclType.GLOBAL.getType())
&& json.has(AclType.PROJECT.getType())
&& oldStrategy instanceof CloudCIAuthorizationStrategy) {
CloudCIAuthorizationStrategy strategy = (CloudCIAuthorizationStrategy) oldStrategy;
Map<AclType, CloudProject> maps = strategy
.getCloudProjectMaps();
for (Map.Entry<AclType, CloudProject> map : maps.entrySet()) {
CloudProject roleMap = map.getValue();
roleMap.clearAllProjectMembers();
JSONObject projects = json.getJSONObject(map.getKey()
.getType());
Set<Map.Entry<String, JSONObject>> projectDataSet = (Set<Map.Entry<String, JSONObject>>) projects
.getJSONObject("data").entrySet();
for (Map.Entry<String, JSONObject> r : projectDataSet) {
String sid = r.getKey();
for (Map.Entry<String, Boolean> e : (Set<Map.Entry<String, Boolean>>) r
.getValue().entrySet()) {
if (e.getValue()) {
Project role = roleMap.getProject(e.getKey());
if (role != null && sid != null
&& !sid.equals("")) {
roleMap.addProjectMember(role, sid);
}
}
}
}
}
Jenkins.getInstance().save();
}
}