private void handleFetchLogEvent( int execId, HttpServletRequest req, HttpServletResponse resp, Map<String, Object> respMap) throws ServletException { String type = getParam(req, "type"); int startByte = getIntParam(req, "offset"); int length = getIntParam(req, "length"); resp.setContentType("text/plain"); resp.setCharacterEncoding("utf-8"); if (type.equals("flow")) { LogData result; try { result = flowRunnerManager.readFlowLogs(execId, startByte, length); respMap.putAll(result.toObject()); } catch (Exception e) { logger.error(e); respMap.put(RESPONSE_ERROR, e.getMessage()); } } else { int attempt = getIntParam(req, "attempt", 0); String jobId = getParam(req, "jobId"); try { LogData result = flowRunnerManager.readJobLogs(execId, jobId, attempt, startByte, length); respMap.putAll(result.toObject()); } catch (Exception e) { logger.error(e); respMap.put("error", e.getMessage()); } } }