/** * Get the response payload as a parsed Abdera FOM Document using the specified parser * * @param parser The parser */ public <T extends Element> Document<T> getDocument(Parser parser) throws ParseException { return getDocument(parser, parser.getDefaultParserOptions()); }
@SuppressWarnings("unchecked") public synchronized <T extends Element> Document<T> getDocument(Parser parser) throws ParseException, IOException { log.debug(Localizer.get("PARSING.REQUEST.DOCUMENT")); if (parser == null) parser = getAbdera().getParser(); if (parser == null) throw new IllegalArgumentException("No Parser implementation was provided"); if (document == null) document = getDocument(parser, parser.getDefaultParserOptions()); return (Document<T>)document; }
private <T extends Element> Document<T> getEntry(InputStream stream, RequestContext request) throws ParseException, IOException { Parser parser = request.getAbdera().getParser(); if (parser == null) throw new IllegalArgumentException("No Parser implementation was provided"); Document<?> document = parser.parse(stream, request.getResolvedUri().toString(), parser.getDefaultParserOptions()); return (Document<T>)document; }
protected Element _parse(String value, IRI baseUri) throws ParseException, UnsupportedEncodingException { if (value == null) return null; FOMFactory fomfactory = (FOMFactory)factory; Parser parser = fomfactory.newParser(); ParserOptions options = parser.getDefaultParserOptions(); options.setFactory(fomfactory); Document doc = parser.parse(new StringReader(value), (baseUri != null) ? baseUri.toString() : null, options); return doc.getRoot(); }
public T readFrom(Class<T> clazz, Type t, Annotation[] a, MediaType mt, MultivaluedMap<String, String> headers, InputStream is) throws IOException { Parser parser = ATOM_ENGINE.getParser(); synchronized (parser) { ParserOptions options = parser.getDefaultParserOptions(); if (options != null) { options.setAutodetectCharset(autodetectCharset); } } Document<T> doc = parser.parse(is); return doc.getRoot(); }
public T readFrom(Class<T> clazz, Type t, Annotation[] a, MediaType mt, MultivaluedMap<String, String> headers, InputStream is) throws IOException { Parser parser = ATOM_ENGINE.getParser(); synchronized (parser) { ParserOptions options = parser.getDefaultParserOptions(); if (options != null) { options.setAutodetectCharset(autodetectCharset); } } XMLStreamReader reader = StaxUtils.createXMLStreamReader(is); Document<T> doc = parser.parse(reader); return doc.getRoot(); }
public T readFrom(Class<T> clazz, Type t, Annotation[] a, MediaType mt, MultivaluedMap<String, String> headers, InputStream is) throws IOException { Parser parser = ATOM_ENGINE.getParser(); synchronized (parser) { ParserOptions options = parser.getDefaultParserOptions(); if (options != null) { options.setAutodetectCharset(autodetectCharset); } } XMLStreamReader reader = StaxUtils.createXMLStreamReader(is); Document<T> doc = parser.parse(reader); return doc.getRoot(); }
try { if (options == null) options = parser.getDefaultParserOptions(); String charset = getCharacterEncoding(); if (charset != null)