Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method to launch job with checkpoint argument #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,29 @@ public JobResult launchJob(String jobname) {
return jobResult(postRequest);
}

/**
* Launch a built job in pause state, resuming the crawl from the supplied checkpoint.
* @param jobname job name
* @param checkpoint checkpoint name
* @return job state
*/
public JobResult launchJob(String jobname, String checkpoint) {
HttpPost postRequest = new HttpPost(baseUrl + "job/" + jobname);
List<NameValuePair> nvp = new LinkedList<NameValuePair>();
nvp.add(new BasicNameValuePair("action", "launch"));
nvp.add(new BasicNameValuePair("checkpoint", checkpoint));
StringEntity postEntity = null;
try {
postEntity = new UrlEncodedFormEntity(nvp);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
postEntity.setContentType("application/x-www-form-urlencoded");
postRequest.addHeader("Accept", "application/xml");
postRequest.setEntity(postEntity);
return jobResult(postRequest);
}

/**
* Pause running job.
* @param jobname job name
Expand Down