mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-17 05:52:26 +00:00
[HUDSON-5536] set text/plain content type in doPostBack response so browser won't
try to parse response (resulting in "no element found" in firefox error console). Not the fix for 5536 itself, but nice to avoid js error after successful update. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@27145 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
3af3cc8e9b
commit
207f4c582e
2 files changed
+5
-2
No files matched your search
@@ -39,6 +39,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import net.sf.json.JSONObject;
|
||||
import org.kohsuke.stapler.StaplerRequest;
|
||||
import org.kohsuke.stapler.StaplerResponse;
|
||||
|
||||
/**
|
||||
* Service for plugins to periodically retrieve update data files
|
||||
@@ -200,13 +201,14 @@ public class DownloadService extends PageDecorator {
|
||||
/**
|
||||
* This is where the browser sends us the data.
|
||||
*/
|
||||
public void doPostBack(StaplerRequest req) throws IOException {
|
||||
public void doPostBack(StaplerRequest req, StaplerResponse rsp) throws IOException {
|
||||
long dataTimestamp = System.currentTimeMillis();
|
||||
TextFile df = getDataFile();
|
||||
df.write(IOUtils.toString(req.getInputStream(),"UTF-8"));
|
||||
df.file.setLastModified(dataTimestamp);
|
||||
due = dataTimestamp+getInterval();
|
||||
LOGGER.info("Obtained the updated data file for "+id);
|
||||
rsp.setContentType("text/plain"); // So browser won't try to parse response
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -134,7 +134,7 @@ public class UpdateSite {
|
||||
/**
|
||||
* This is the endpoint that receives the update center data file from the browser.
|
||||
*/
|
||||
public void doPostBack(StaplerRequest req) throws IOException, GeneralSecurityException {
|
||||
public void doPostBack(StaplerRequest req, StaplerResponse rsp) throws IOException, GeneralSecurityException {
|
||||
dataTimestamp = System.currentTimeMillis();
|
||||
String json = IOUtils.toString(req.getInputStream(),"UTF-8");
|
||||
JSONObject o = JSONObject.fromObject(json);
|
||||
@@ -150,6 +150,7 @@ public class UpdateSite {
|
||||
|
||||
LOGGER.info("Obtained the latest update center data file for UpdateSource "+ id);
|
||||
getDataFile().write(json);
|
||||
rsp.setContentType("text/plain"); // So browser won't try to parse response
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user