/** * Converts a RequestCtx object to its string representation. * * @param reqCtx * the RequestCtx object * @return the String representation of the RequestCtx object */ public String makeRequestCtx(RequestCtx reqCtx) { ByteArrayOutputStream request = new ByteArrayOutputStream(); reqCtx.encode(request, new Indenter()); return new String(request.toByteArray()); }
public ResponseCtx evaluate(RequestCtx request) throws PEPException { try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); request.encode(bos); String response = this.client.evaluate(bos.toString()); ByteArrayInputStream bis = new ByteArrayInputStream(response.getBytes()); return ResponseCtx.getInstance(bis); } catch (Exception e) { logger.error("Error evaluating request.", e); throw new PEPException("Error evaluating request", e); } } /*
private static String toString(RequestCtx req) { ByteArrayOutputStream buf = new ByteArrayOutputStream(); req.encode(buf); return new String(buf.toByteArray()); }