org.apache.abdera.parser.Parser.getDefaultParserOptions()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(3.9k)|赞(0)|评价(0)|浏览(102)

本文整理了Java中org.apache.abdera.parser.Parser.getDefaultParserOptions()方法的一些代码示例,展示了Parser.getDefaultParserOptions()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parser.getDefaultParserOptions()方法的具体详情如下:
包路径:org.apache.abdera.parser.Parser
类名称:Parser
方法名:getDefaultParserOptions

Parser.getDefaultParserOptions介绍

[英]Return the default parser options for this Parser. This method returns a copy of the default options. Changes to this instance will not affect the defaults returned by subsequent requests.
[中]返回此解析器的默认解析器选项。此方法返回默认选项的副本。对此实例的更改不会影响后续请求返回的默认值。

代码示例

代码示例来源:origin: org.apache.abdera/abdera-client

/**
 * 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());
}

代码示例来源:origin: org.apache.abdera/abdera-server

@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;
}

代码示例来源:origin: org.apache.abdera/abdera-server

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;
}

代码示例来源:origin: org.apache.abdera/abdera-parser

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();
}

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

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();
}

代码示例来源:origin: apache/cxf

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();
}

代码示例来源:origin: org.apache.cxf/cxf-rt-rs-extension-providers

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();
}

代码示例来源:origin: org.apache.abdera/abdera-client

try {
  if (options == null)
    options = parser.getDefaultParserOptions();
  String charset = getCharacterEncoding();
  if (charset != null)

相关文章