use of com.google.gwt.http.client.RequestException in project kie-wb-common by kiegroup.
the class FooterPresenter method setupUrl.
void setupUrl(final String url) {
final Command onSuccess = makeOnSuccess(url);
final Command onError = makeOnError();
try {
makeRequest(url, onSuccess, onError).send();
} catch (final RequestException e) {
onError.execute();
}
}
use of com.google.gwt.http.client.RequestException in project pentaho-platform by pentaho.
the class SchedulesPanel method controlJobs.
private void controlJobs(final Set<JsJob> jobs, String function, final Method method, final boolean refreshData) {
for (final JsJob job : jobs) {
RequestBuilder builder = createRequestBuilder(method, "api/scheduler/" + function);
builder.setHeader(HTTP.CONTENT_TYPE, JSON_CONTENT_TYPE);
JSONObject startJobRequest = new JSONObject();
startJobRequest.put("jobId", new JSONString(job.getJobId()));
try {
builder.sendRequest(startJobRequest.toString(), new RequestCallback() {
public void onError(Request request, Throwable exception) {
// showError(exception);
}
public void onResponseReceived(Request request, Response response) {
final String jobState = response.getText();
job.setState(jobState);
table.redraw();
updateJobScheduleButtonStyle(jobState);
if (refreshData) {
refresh();
}
}
});
} catch (RequestException e) {
// showError(e);
}
}
}
use of com.google.gwt.http.client.RequestException in project pentaho-platform by pentaho.
the class SchedulesPanel method refresh.
public void refresh() {
String moduleBaseURL = GWT.getModuleBaseURL();
String moduleName = GWT.getModuleName();
String contextURL = moduleBaseURL.substring(0, moduleBaseURL.lastIndexOf(moduleName));
final String apiEndpoint = "api/scheduler/getJobs";
RequestBuilder executableTypesRequestBuilder = createRequestBuilder(RequestBuilder.GET, apiEndpoint, contextURL);
executableTypesRequestBuilder.setHeader(HTTP_ACCEPT_HEADER, JSON_CONTENT_TYPE);
try {
executableTypesRequestBuilder.sendRequest(null, new RequestCallback() {
public void onError(Request request, Throwable exception) {
// showError(exception);
}
public void onResponseReceived(Request request, Response response) {
if (response.getStatusCode() == Response.SC_OK) {
allJobs = parseJson(JsonUtils.escapeJsonForEval(response.getText()));
filterAndShowData();
}
}
});
} catch (RequestException e) {
// showError(e);
}
}
use of com.google.gwt.http.client.RequestException in project pentaho-platform by pentaho.
the class SchedulesPanel method canAccessJobRequest.
private void canAccessJobRequest(final JsJob job, RequestCallback callback) {
final String jobId = SolutionBrowserPanel.pathToId(job.getFullResourceName());
final String apiEndpoint = "api/repo/files/" + jobId + "/canAccess?cb=" + System.currentTimeMillis() + "&permissions=" + READ_PERMISSION;
final RequestBuilder accessBuilder = createRequestBuilder(RequestBuilder.GET, apiEndpoint);
try {
accessBuilder.sendRequest(null, callback);
} catch (RequestException re) {
// noop
}
}
use of com.google.gwt.http.client.RequestException in project pentaho-platform by pentaho.
the class SchedulesPanel method canAccessJobListRequest.
private void canAccessJobListRequest(final Set<JsJob> jobs, RequestCallback callback) {
final JSONArray jobNameList = new JSONArray();
int idx = 0;
for (JsJob job : jobs) {
jobNameList.set(idx++, new JSONString(job.getFullResourceName()));
}
final JSONObject payload = new JSONObject();
payload.put("strings", jobNameList);
final String accessListEndpoint = "api/repo/files/pathsAccessList?cb=" + System.currentTimeMillis();
RequestBuilder accessListBuilder = createRequestBuilder(RequestBuilder.POST, accessListEndpoint);
accessListBuilder.setHeader(HTTP.CONTENT_TYPE, JSON_CONTENT_TYPE);
accessListBuilder.setHeader(HTTP_ACCEPT_HEADER, JSON_CONTENT_TYPE);
try {
accessListBuilder.sendRequest(payload.toString(), callback);
} catch (RequestException re) {
// noop
}
}
Aggregations