提交 106d95a7 编写于 作者: K kohsuke

Prototype.js calls eval() on the response when the content type is set to...

Prototype.js calls eval() on the response when the content type is set to JavaScript, and eval() fails without the surrounding bracket.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@35344 71c3de6d-444a-0410-be80-ed276b4c234a
上级 447765a2
......@@ -31,6 +31,7 @@ import org.kohsuke.stapler.export.Flavor;
import javax.servlet.ServletException;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collection;
......@@ -59,6 +60,9 @@ public class ComboBoxModel extends ArrayList<String> implements HttpResponse {
public void generateResponse(StaplerRequest req, StaplerResponse rsp, Object node) throws IOException, ServletException {
rsp.setContentType(Flavor.JSON.contentType);
JSONArray.fromObject(this).write(rsp.getWriter());
PrintWriter w = rsp.getWriter();
w.print('(');
JSONArray.fromObject(this).write(w);
w.print(')');
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册