/** * Pulls a string off the queue (like consumeTo), and then pulls off the matched string (but does not return it). * <p> * If the queue runs out of characters before finding the seq, will return as much as it can (and queue will go * isEmpty() == true). * @param seq String to match up to, and not include in return, and to pull off queue. <b>Case sensitive.</b> * @return Data matched from queue. */ public String chompTo(String seq) { String data = consumeTo(seq); matchChomp(seq); return data; }
void processResponseHeaders(Map<String, List<String>> resHeaders) { for (Map.Entry<String, List<String>> entry : resHeaders.entrySet()) { String name = entry.getKey(); if (name == null) continue; // http/1.1 line List<String> values = entry.getValue(); if (name.equalsIgnoreCase("Set-Cookie")) { for (String value : values) { if (value == null) continue; TokenQueue cd = new TokenQueue(value); String cookieName = cd.chompTo("=").trim(); String cookieVal = cd.consumeTo(";").trim(); // ignores path, date, domain, validateTLSCertificates et al. req'd? // name not blank, value not null if (cookieName.length() > 0) cookie(cookieName, cookieVal); } } for (String value : values) { addHeader(name, value); } } }
private void parseTextNode() { String text = tq.consumeTo("<"); String annotationText = AnnotationParser.readAnnotation(text); text = AnnotationParser.stripAnnotation(text); if (text.length() > 0) { TextNode textNode = TextNode.createFromEncoded(text, baseUri); // if (pendingAnnotation != null) { pendingAnnotation.apply(textNode); } lines(textNode, text); add(textNode); } if (null != annotationText) { AnnotationNode annotation = new AnnotationNode(annotationText); lines(annotation, annotationText); add(annotation); } }
private void parseTextNode() { String rawText = tq.consumeTo("<"); String annotationText = AnnotationParser.readAnnotation(rawText); String text = AnnotationParser.stripAnnotation(rawText); if (text.length() > 0) { TextNode textNode = TextNode.createFromEncoded(text, baseUri); // if (pendingAnnotation != null) { pendingAnnotation.apply(textNode); } lines(textNode, rawText); add(textNode); } if (null != annotationText) { AnnotationNode annotation = new AnnotationNode(annotationText); lines(annotation, annotationText); add(annotation); } }
private void parseTextNode() { String rawText = tq.consumeTo("<"); String annotationText = AnnotationParser.readAnnotation(rawText); String text = AnnotationParser.stripAnnotation(rawText); if (text.length() > 0) { TextNode textNode = TextNode.createFromEncoded(text, baseUri); // if (pendingAnnotation != null) { pendingAnnotation.apply(textNode); } lines(textNode, rawText); add(textNode); } if (null != annotationText) { AnnotationNode annotation = new AnnotationNode(annotationText); lines(annotation, annotationText); add(annotation); } }