in core/src/main/java/org/apache/oozie/servlet/BaseJobServlet.java [284:384]
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String jobId = getResourceName(request);
String show = request.getParameter(RestConstants.JOB_SHOW_PARAM);
String timeZoneId = request.getParameter(RestConstants.TIME_ZONE_PARAM) == null
? "GMT" : request.getParameter(RestConstants.TIME_ZONE_PARAM);
try {
AuthorizationService auth = Services.get().get(AuthorizationService.class);
auth.authorizeForJob(getUser(request), jobId, false);
}
catch (AuthorizationException ex) {
throw new XServletException(HttpServletResponse.SC_UNAUTHORIZED, ex);
}
if (show == null || show.equals(RestConstants.JOB_SHOW_INFO)) {
stopCron();
JsonBean job = null;
try {
job = getJob(request, response);
}
catch (BaseEngineException e) {
// TODO Auto-generated catch block
// e.printStackTrace();
throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, e);
}
startCron();
sendJsonResponse(response, HttpServletResponse.SC_OK, job, timeZoneId);
}
else if (show.equals(RestConstants.ALL_WORKFLOWS_FOR_COORD_ACTION)) {
stopCron();
JSONObject json = getJobsByParentId(request, response);
startCron();
sendJsonResponse(response, HttpServletResponse.SC_OK, json);
}
else if (show.equals(RestConstants.JOB_SHOW_JMS_TOPIC)) {
stopCron();
String jmsTopicName = getJMSTopicName(request, response);
JSONObject json = new JSONObject();
json.put(JsonTags.JMS_TOPIC_NAME, jmsTopicName);
startCron();
sendJsonResponse(response, HttpServletResponse.SC_OK, json);
}
else if (show.equals(RestConstants.JOB_SHOW_LOG)) {
response.setContentType(TEXT_UTF8);
streamJobLog(request, response);
}
else if (show.equals(RestConstants.JOB_SHOW_ERROR_LOG)) {
response.setContentType(TEXT_UTF8);
streamJobErrorLog(request, response);
}
else if (show.equals(RestConstants.JOB_SHOW_AUDIT_LOG)) {
response.setContentType(TEXT_UTF8);
streamJobAuditLog(request, response);
}
else if (show.equals(RestConstants.JOB_SHOW_DEFINITION)) {
stopCron();
response.setContentType(XML_UTF8);
String wfDefinition = getJobDefinition(request, response);
startCron();
response.setStatus(HttpServletResponse.SC_OK);
response.getWriter().write(wfDefinition);
}
else if (show.equals(RestConstants.JOB_SHOW_GRAPH)) {
stopCron();
streamJobGraph(request, response);
startCron(); // -- should happen before you stream anything in response?
} else if (show.equals(RestConstants.JOB_SHOW_STATUS)) {
stopCron();
String status = getJobStatus(request, response);
JSONObject json = new JSONObject();
json.put(JsonTags.STATUS, status);
startCron();
sendJsonResponse(response, HttpServletResponse.SC_OK, json);
} else if (show.equals(RestConstants.JOB_SHOW_ACTION_RETRIES_PARAM)) {
stopCron();
JSONArray retries = getActionRetries(request, response);
JSONObject json = new JSONObject();
json.put(JsonTags.WORKFLOW_ACTION_RETRIES, retries);
startCron();
sendJsonResponse(response, HttpServletResponse.SC_OK, json);
}
else if (show.equals(RestConstants.COORD_ACTION_MISSING_DEPENDENCIES)) {
stopCron();
JSONObject json = getCoordActionMissingDependencies(request, response);
startCron();
sendJsonResponse(response, HttpServletResponse.SC_OK, json);
}
else if (show.equals(RestConstants.JOB_SHOW_WF_ACTIONS_IN_COORD)) {
stopCron();
JSONObject json = getWfActionByJobIdAndName(request, response);
startCron();
sendJsonResponse(response, HttpServletResponse.SC_OK, json);
}
else {
throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.E0303,
RestConstants.JOB_SHOW_PARAM, show);
}
}