/** * Extracts the session id out of the first request line. */ protected static Long extractSessionId (final String firstLine) throws java.io.IOException { try { final String value = RestUtils.extractFromLine (firstLine, "session"); if (log.isDebugEnabled()) log.debug("extractSessionId() sessionId = \""+value+"\""); return new Long(Long.parseLong(value)); } catch (Exception e) { //log.debug("extractSessionId() Failed to extract sessionId", e); return null; } }
/** * Same thing a extractParams(), but it works with * HttpServletRequest.getQueryString() returns (which don't entail the * '/documentation.pl?' part). */ public static java.util.Map extractParamsFromQueryString (final String line) { return extractParams("?"+line); }
public void do_getheaders (final SelectionKey key, final String[] headers) throws Exception { final String storeName = extractStoreName(headers[0]); int limit = -1; try { limit = Integer.parseInt (RestUtils.extractFromLine(headers[0], "limit")); } catch (Exception e) { // ignore } final java.util.List owfeHeaders = this.session.getHeaders(storeName, limit); reply(key, getCoder().encodeHeadersAsXml(owfeHeaders)); }
extractStoreName(headers[0]); String targetStore = RestUtils.extractFromLine(headers[0], "targetstore"); String targetParticipant = RestUtils.extractFromLine(headers[0], "targetparticipant");
public void do_launchflow (final SelectionKey key, final String[] headers) throws Exception { final String engineId = RestUtils.extractFromLine (headers[0], "engineid"); org.jdom.Element reqElt = parseBody(key, headers); LaunchItem item = (LaunchItem)getCoder().decode(reqElt, null, null); //log.debug // ("do_launchflow() field is >"+item.getAttributes().sget("field")+ // "<"); final String flowId = this.session.launch(engineId, item); org.jdom.Element eReply = new org.jdom.Element("ok"); eReply.setAttribute("flow-id", flowId); reply(key, eReply); }
public void do_findflowinstance (final SelectionKey key, final String[] headers) throws Exception { String storeName = extractStoreName(headers[0]); String wfid = null; try { wfid = RestUtils.extractFromLine(headers[0], "id"); } catch (Exception e) { // ignore } java.util.List feis = this.session.findFlowInstance(storeName, wfid); reply(key, getCoder().encodeIdsAsXml(feis)); }
log.debug("handle() firstLine is >"+firstLine+"<"); action = RestUtils.extractFromLine(firstLine, "action");
public void do_getandlockworkitem (final SelectionKey key, final String[] headers) throws Exception { final String storeName = extractStoreName(headers[0]); InFlowWorkItem item = null; try { if (headers[0].startsWith("GET ")) { String sid = RestUtils.extractFromLine(headers[0], "id"); item = this.session.getAndLock(storeName, sid); } else { final org.jdom.Element reqElt = parseBody(key, headers); final FlowExpressionId fei = getCoder().decodeFlowExpressionId(reqElt); item = this.session.getAndLock(storeName, fei); } } catch (final Exception e) { log.debug("do_getandlockworkitem() trouble", e); rethrowAsHttpException(404, e); } reply(key, getCoder().encodeAsXml(item)); }
public void do_getworkitem (final SelectionKey key, final String[] headers) throws Exception { final String storeName = extractStoreName(headers[0]); InFlowWorkItem item = null; if (headers[0].startsWith("GET ")) { String sid = RestUtils.extractFromLine(headers[0], "id"); item = this.session.get(storeName, sid); } else { final org.jdom.Element reqElt = parseBody(key, headers); //log.debug // ("getWorkItem() : request body >\n"+ // openwfe.org.Utils.toString(reqElt, "ISO-8859-1")); final FlowExpressionId itemId = getCoder().decodeFlowExpressionId(reqElt); item = this.session.get(storeName, itemId); } // debug //openwfe.org.Utils.dump // ("rest_4_", // item.getAttributes().sget("field") // .getBytes(openwfe.org.Utils.getEncoding())); reply(key, getCoder().encodeAsXml(item)); }