-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* New datastructure in JSON responses. * Lowering log-level i Jenkins server log.
- Loading branch information
1 parent
69703bf
commit 898775b
Showing
3 changed files
with
64 additions
and
14 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
src/main/java/org/jenkinsci/plugins/gwt/GenericResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.jenkinsci.plugins.gwt; | ||
|
||
import java.util.Map; | ||
import net.sf.json.JSONObject; | ||
import org.kohsuke.stapler.HttpResponse; | ||
import org.kohsuke.stapler.json.JsonHttpResponse; | ||
|
||
public class GenericResponse { | ||
|
||
static HttpResponse jsonResponse( | ||
final int httpStatusCode, final String message, final Map<String, Object> jobs) { | ||
final GenericWebhookResponse genericResponse = new GenericWebhookResponse(message, jobs); | ||
return new JsonHttpResponse(JSONObject.fromObject(genericResponse), httpStatusCode); | ||
} | ||
|
||
static HttpResponse jsonResponse(final int httpStatusCode, final String message) { | ||
final GenericWebhookResponse genericResponse = new GenericWebhookResponse(message); | ||
return new JsonHttpResponse(JSONObject.fromObject(genericResponse), httpStatusCode); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/main/java/org/jenkinsci/plugins/gwt/GenericWebhookResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.jenkinsci.plugins.gwt; | ||
|
||
import java.util.Map; | ||
|
||
public class GenericWebhookResponse { | ||
|
||
private final String message; | ||
private Map<String, Object> jobs; | ||
|
||
public GenericWebhookResponse(final String message) { | ||
this.message = message; | ||
} | ||
|
||
public GenericWebhookResponse(final String message, final Map<String, Object> jobs) { | ||
this.message = message; | ||
this.jobs = jobs; | ||
} | ||
|
||
public String getMessage() { | ||
return message; | ||
} | ||
|
||
public Map<String, Object> getJobs() { | ||
return jobs; | ||
} | ||
} |