private static String getLinkFromRequest(final String topic, final Props azkProps, final HttpServletRequest req) { String urlTemplate = getURLForTopic(topic, azkProps); if (urlTemplate.isEmpty()) { logger.error("No URL specified for topic " + topic); return ""; } String flowExecutionURL = ""; flowExecutionURL += req.getRequestURL(); flowExecutionURL += "?"; flowExecutionURL += req.getQueryString(); flowExecutionURL = encodeToUTF8(flowExecutionURL); urlTemplate = urlTemplate.replace("${url}", flowExecutionURL); logger.info("Creating link: " + urlTemplate); return urlTemplate; }
private static String getLinkFromJobAndExecId(final String topic, final Props azkProps, final String jobId, final Props jobProps) { String urlTemplate = getURLForTopic(topic, azkProps); if (urlTemplate.isEmpty()) { logger.error("No URL specified for topic " + topic); return ""; } final String job = encodeToUTF8(jobId); final String execid = encodeToUTF8( jobProps.getString(Constants.FlowProperties.AZKABAN_FLOW_EXEC_ID)); urlTemplate = urlTemplate.replace("${jobid}", job).replace("${execid}", execid); logger.info("Creating link: " + urlTemplate); return urlTemplate; }
/** * Make sure that URLs for analyzers and logviewers are fetched correctly by setting it manually * and then fetching them */ @Test public void testFetchURL() { this.azkProps.put(Constants.ConfigurationKeys.AZKABAN_SERVER_EXTERNAL_TOPIC_URL .replace("${topic}", "someTopic"), "This is a link"); assertTrue( ExternalLinkUtils.getURLForTopic("someTopic", this.azkProps).equals("This is a link")); } }
private static String getLinkFromRequest(final String topic, final Props azkProps, final HttpServletRequest req) { String urlTemplate = getURLForTopic(topic, azkProps); if (urlTemplate.isEmpty()) { logger.error("No URL specified for topic " + topic); return ""; } String flowExecutionURL = ""; flowExecutionURL += req.getRequestURL(); flowExecutionURL += "?"; flowExecutionURL += req.getQueryString(); flowExecutionURL = encodeToUTF8(flowExecutionURL); urlTemplate = urlTemplate.replace("${url}", flowExecutionURL); logger.info("Creating link: " + urlTemplate); return urlTemplate; }
private static String getLinkFromJobAndExecId(final String topic, final Props azkProps, final String jobId, final Props jobProps) { String urlTemplate = getURLForTopic(topic, azkProps); if (urlTemplate.isEmpty()) { logger.error("No URL specified for topic " + topic); return ""; } final String job = encodeToUTF8(jobId); final String execid = encodeToUTF8( jobProps.getString(Constants.FlowProperties.AZKABAN_FLOW_EXEC_ID)); urlTemplate = urlTemplate.replace("${jobid}", job).replace("${execid}", execid); logger.info("Creating link: " + urlTemplate); return urlTemplate; }