%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page trimDirectiveWhitespaces="true" %> <%@ page import="java.io.IOException" %> <%@ page import="java.io.InputStream" %> <%@ page import="java.io.BufferedReader" %> <%@ page import="java.io.File" %> <%@ page import="java.nio.charset.Charset" %> <%@ page import="java.io.InputStreamReader" %> <%@ page import="org.apache.log4j.Logger" %> <%@ page import="javax.servlet.http.Cookie" %> <%! public static void dumpCallInfo(HttpServletRequest request, Logger logger) { logger.info("CallInfo..."); logger.info("request.getContentType: " + request.getContentType()); logger.info("Headers: "); for (Object o: java.util.Collections.list(request.getHeaderNames())) { logger.info(o + "=" + request.getHeader(o.toString())); } logger.info("Attributes: "); for (Object o: java.util.Collections.list(request.getAttributeNames())) { logger.info(o + "=" + request.getAttribute(o.toString())); } logger.info("Parameters: "); for (Object o: java.util.Collections.list(request.getParameterNames())) { for (String v: request.getParameterValues(o.toString())) { logger.info(o + "=" + v); } } } %> <% Logger logger = Logger.getLogger("collation_editor/vmrcre_collation"); String requestURI = request.getRequestURI(); // strip the webapp name off the URI requestURI = requestURI.substring(requestURI.indexOf("/", 2)); File collate_cli = new File(getServletContext().getRealPath(requestURI)); collate_cli = new File(collate_cli.getParent(), "collate_cli.py"); boolean reEncode = false; //dumpCallInfo(request, logger); String options = request.getParameter("options"); String action = request.getParameter("action"); if (options != null) { response.setContentType("application/json"); // collation if ("collation".equals(action)) { } // apparatus export else { response.setContentType("text/plain"); response.setHeader("Content-Disposition", "attachment; filename=\"negative-apparatus.xml\""); response.setHeader("Set-Cookie", "fileDownload=true; path=/"); reEncode = true; } String args[] = new String[] { "python3", collate_cli.getAbsolutePath(), "--action=" + action, }; StringBuffer resultBuf = new StringBuffer(); StringBuffer errorBuf = new StringBuffer(); logger.info("About to call Cat's stuff."); logger.info("********************************************************* Action: " + action); logger.info("********************************************************* Input: " + options); runCommand(args, resultBuf, errorBuf, options, logger); logger.info("Finished calling Cat's stuff."); if (reEncode) resultBuf = new StringBuffer(new String(resultBuf.toString().getBytes("iso8859-1"), "UTF-8")); //logger.info("Result: " + resultBuf); logger.info("********************************************************* Result: " + resultBuf + "***** END RESULT *****"); if (errorBuf.length() > 0) logger.error("*********************************************** Collation Error: " + errorBuf); %> <%= resultBuf %> <% return; } %>
collation from the collation_editor to collatex
options | data from collation_editor |