@@ -48,13 +48,14 @@ public JobWithDetails details() throws IOException {
4848 /**
4949 * Get a file from workspace.
5050 *
51- * @param fileName The name of the file to download from workspace.
52- * You can also access files which are in sub folders of the workspace.
51+ * @param fileName
52+ * The name of the file to download from workspace. You can also
53+ * access files which are in sub folders of the workspace.
5354 * @return The string which contains the content of the file.
5455 * @throws IOException
5556 */
5657 public String getFileFromWorkspace (String fileName ) throws IOException {
57- InputStream is = client .getFile ( URI .create ( url + "/ws/" + fileName ));
58+ InputStream is = client .getFile (URI .create (url + "/ws/" + fileName ));
5859 ByteArrayOutputStream result = new ByteArrayOutputStream ();
5960 byte [] buffer = new byte [1024 ];
6061 int length ;
@@ -66,30 +67,44 @@ public String getFileFromWorkspace(String fileName) throws IOException {
6667
6768 /**
6869 * Trigger a build without parameters
70+ *
71+ * @return {@link QueueReference} for further analysis of the queued build.
72+ * @throws IOException
73+ * in case of an error.
6974 */
70- public void build () throws IOException {
71- client .post (url + "build" );
75+ public QueueReference build () throws IOException {
76+ ExtractHeader location = client .post (url + "build" , null , ExtractHeader .class , false );
77+ return new QueueReference (location .getLocation ());
78+
7279 }
7380
7481 /**
7582 * Trigger a build with crumbFlag.
76- * @param crumbFlag true or false.
77- * @throws IOException in case of an error.
83+ *
84+ * @param crumbFlag
85+ * true or false.
86+ * @return {@link QueueReference} for further analysis of the queued build.
87+ * @throws IOException
88+ * in case of an error.
7889 */
79- public void build (boolean crumbFlag ) throws IOException {
80- client .post (url + "build" , crumbFlag );
90+ public QueueReference build (boolean crumbFlag ) throws IOException {
91+ ExtractHeader location = client .post (url + "build" , null , ExtractHeader .class , crumbFlag );
92+ return new QueueReference (location .getLocation ());
8193 }
8294
8395 /**
8496 * Trigger a parameterized build
8597 *
8698 * @param params
8799 * the job parameters
100+ * @return {@link QueueReference} for further analysis of the queued build.
88101 * @throws IOException
89102 */
90- public void build (Map <String , String > params ) throws IOException {
103+ public QueueReference build (Map <String , String > params ) throws IOException {
91104 String qs = join (Collections2 .transform (params .entrySet (), new MapEntryToQueryStringPair ()), "&" );
92105 client .post (url + "buildWithParameters?" + qs );
106+ ExtractHeader location = client .post (url + "buildWithParameters?" + qs , null , ExtractHeader .class , false );
107+ return new QueueReference (location .getLocation ());
93108 }
94109
95110 /**
@@ -99,6 +114,7 @@ public void build(Map<String, String> params) throws IOException {
99114 * the job parameters
100115 * @param crumbFlag
101116 * determines whether crumb flag is used
117+ * @return {@link QueueReference} for further analysis of the queued build.
102118 * @throws IOException
103119 */
104120 public QueueReference build (Map <String , String > params , boolean crumbFlag ) throws IOException {
0 commit comments