mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-21 15:55:40 +00:00
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
This commit is contained in:
1 parent
447765a211
commit
106d95a79f
1 file changed
+5
-1
@@ -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(')');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user