Package info.aduna.lang

Examples of info.aduna.lang.FileFormat


  public void acceptBoolean()
    throws NoCompatibleMediaType
  {
    if (pool.isPreferredBooleanQueryResultFormatUsed()) {
      FileFormat format = pool.getPreferredBooleanQueryResultFormat();
      method.addRequestHeader(ACCEPT, format.getDefaultMIMEType());
      return;
    }
    // Specify which formats we support using Accept headers
    Set<BooleanQueryResultFormat> booleanFormats = BooleanQueryResultParserRegistry.getInstance().getKeys();
    if (booleanFormats.isEmpty()) {
      throw new NoCompatibleMediaType("No boolean query result parsers have been registered");
    }

    for (BooleanQueryResultFormat format : booleanFormats) {
      // Determine a q-value that reflects the user specified preference
      int qValue = 10;

      TupleQueryResultFormat preferredBQRFormat = pool.getPreferredTupleQueryResultFormat();
      if (preferredBQRFormat != null && !preferredBQRFormat.equals(format)) {
        // Prefer specified format over other formats
        qValue -= 2;
      }

      for (String mimeType : format.getMIMETypes()) {
        String acceptParam = mimeType;

        if (qValue < 10) {
          acceptParam += ";q=0." + qValue;
        }
View Full Code Here


  public void acceptTupleQueryResult()
    throws NoCompatibleMediaType
  {
    if (pool.isPreferredTupleQueryResultFormatUsed()) {
      FileFormat format = pool.getPreferredTupleQueryResultFormat();
      method.addRequestHeader(ACCEPT, format.getDefaultMIMEType());
      return;
    }
    // Specify which formats we support using Accept headers
    Set<TupleQueryResultFormat> tqrFormats = TupleQueryResultParserRegistry.getInstance().getKeys();
    if (tqrFormats.isEmpty()) {
      throw new NoCompatibleMediaType("No tuple query result parsers have been registered");
    }

    for (TupleQueryResultFormat format : tqrFormats) {
      // Determine a q-value that reflects the user specified preference
      int qValue = 10;

      TupleQueryResultFormat preferredTQRFormat = pool.getPreferredTupleQueryResultFormat();
      if (preferredTQRFormat != null && !preferredTQRFormat.equals(format)) {
        // Prefer specified format over other formats
        qValue -= 2;
      }

      for (String mimeType : format.getMIMETypes()) {
        String acceptParam = mimeType;

        if (qValue < 10) {
          acceptParam += ";q=0." + qValue;
        }
View Full Code Here

  public void acceptGraphQueryResult()
    throws NoCompatibleMediaType
  {
    if (pool.isPreferredTupleQueryResultFormatUsed()) {
      FileFormat format = pool.getPreferredTupleQueryResultFormat();
      method.addRequestHeader(ACCEPT, format.getDefaultMIMEType());
      return;
    }
    acceptRDF(false);
  }
View Full Code Here

TOP

Related Classes of info.aduna.lang.FileFormat

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.