提交 ed431fe3 编写于 作者: K kohsuke

added form field validation for shell executable.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@6315 71c3de6d-444a-0410-be80-ed276b4c234a
上级 6afcc1e6
......@@ -3,12 +3,15 @@ package hudson.tasks;
import hudson.FilePath;
import hudson.model.Descriptor;
import static hudson.model.Hudson.isWindows;
import hudson.util.FormFieldValidator;
import net.sf.json.JSONObject;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import javax.servlet.ServletException;
import java.io.IOException;
import java.util.Map;
import net.sf.json.JSONObject;
/**
* Executes a series of commands by using a shell.
*
......@@ -70,7 +73,6 @@ public class Shell extends CommandInterpreter {
load();
}
protected void convert(Map<String, Object> oldPropertyBag) {
shell = (String)oldPropertyBag.get("shell");
}
......@@ -102,5 +104,12 @@ public class Shell extends CommandInterpreter {
setShell(req.getParameter("shell"));
return true;
}
/**
* Check the existence of sh in the given location.
*/
public void doCheck(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
new FormFieldValidator.Executable(req,rsp).process();
}
}
}
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<f:section title="Shell">
<f:entry title="Shell executable">
<input class="setting-input" name="shell"
type="text" value="${descriptor.shell}"/>
<f:textbox name="shell" value="${descriptor.shell}" checkUrl="'${rootURL}/builder/Shell/check?value='+encode(this.value)"/>
</f:entry>
</f:section>
</j:jelly>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册