org.restlet.data.Status.isError()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(146)

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

Status.isError介绍

[英]Indicates if the status is an error (client or server) status.
[中]指示状态是否为错误(客户端或服务器)状态。

代码示例

代码示例来源:origin: org.sonatype.nexus/nexus-test-utils

@Override
protected boolean matchesSafely( Status item )
{
  return item.isError();
}

代码示例来源:origin: org.sonatype.nexus/nexus-test-harness-launcher

@Override
protected boolean matchesSafely(Status item) {
 return item.isError();
}

代码示例来源:origin: org.restlet.osgi/org.restlet

/**
 * Indicates if the status is an error (client or server) status.
 * 
 * @return True if the status is an error (client or server) status.
 */
public boolean isError() {
  return isError(getCode());
}

代码示例来源:origin: org.sonatype.nexus/nexus-test-utils

@Override
protected boolean matchesSafely( Response resp )
{
  return resp.getStatus().isError();
}

代码示例来源:origin: org.restlet/org.restlet

/**
 * Indicates if the status is an error (client or server) status.
 * 
 * @return True if the status is an error (client or server) status.
 */
public boolean isError() {
  return isError(getCode());
}

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

/**
 * Indicates if the status is an error (client or server) status.
 * 
 * @return True if the status is an error (client or server) status.
 */
public boolean isError() {
  return isError(getCode());
}

代码示例来源:origin: org.sonatype.nexus/nexus-test-harness-launcher

@Override
protected boolean matchesSafely(Response resp) {
 return resp.getStatus().isError();
}

代码示例来源:origin: org.restlet.osgi/org.restlet.ext.platform

/**
 * Generates a name for the response given the status code.
 * The generated name will be "Success" in case of success, "Error [statusCode]" in case of error and "Status
 * [statusCode] otherwise.
 * 
 * @param statusCode
 *            The status code of the response.
 * @return The generated name.
 */
public static String generateResponseName(int statusCode) {
  String autoGeneratedName = "Status " + statusCode;
  if (Status.isSuccess(statusCode)) {
    autoGeneratedName = "Success";
  } else if (Status.isError(statusCode)) {
    autoGeneratedName = "Error " + statusCode;
  }
  return autoGeneratedName;
}

代码示例来源:origin: org.restlet.jse/org.restlet.ext.platform

/**
 * Generates a name for the response given the status code.
 * The generated name will be "Success" in case of success, "Error [statusCode]" in case of error and "Status
 * [statusCode] otherwise.
 * 
 * @param statusCode
 *            The status code of the response.
 * @return The generated name.
 */
public static String generateResponseName(int statusCode) {
  String autoGeneratedName = "Status " + statusCode;
  if (Status.isSuccess(statusCode)) {
    autoGeneratedName = "Success";
  } else if (Status.isError(statusCode)) {
    autoGeneratedName = "Error " + statusCode;
  }
  return autoGeneratedName;
}

代码示例来源:origin: org.restlet.gae/org.restlet.ext.platform

/**
 * Generates a name for the response given the status code.
 * The generated name will be "Success" in case of success, "Error [statusCode]" in case of error and "Status
 * [statusCode] otherwise.
 * 
 * @param statusCode
 *            The status code of the response.
 * @return The generated name.
 */
public static String generateResponseName(int statusCode) {
  String autoGeneratedName = "Status " + statusCode;
  if (Status.isSuccess(statusCode)) {
    autoGeneratedName = "Success";
  } else if (Status.isError(statusCode)) {
    autoGeneratedName = "Error " + statusCode;
  }
  return autoGeneratedName;
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.apispark

/**
 * Generates a name for the response given the status code.
 * The generated name will be "Success" in case of success, "Error [statusCode]" in case of error and "Status
 * [statusCode] otherwise.
 * 
 * @param statusCode
 *            The status code of the response.
 * @return The generated name.
 */
public static String generateResponseName(int statusCode) {
  String autoGeneratedName = "Status " + statusCode;
  if (Status.isSuccess(statusCode)) {
    autoGeneratedName = "Success";
  } else if (Status.isError(statusCode)) {
    autoGeneratedName = "Error " + statusCode;
  }
  return autoGeneratedName;
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.platform

/**
 * Generates a name for the response given the status code.
 * The generated name will be "Success" in case of success, "Error [statusCode]" in case of error and "Status
 * [statusCode] otherwise.
 * 
 * @param statusCode
 *            The status code of the response.
 * @return The generated name.
 */
public static String generateResponseName(int statusCode) {
  String autoGeneratedName = "Status " + statusCode;
  if (Status.isSuccess(statusCode)) {
    autoGeneratedName = "Success";
  } else if (Status.isError(statusCode)) {
    autoGeneratedName = "Error " + statusCode;
  }
  return autoGeneratedName;
}

代码示例来源:origin: org.restlet.osgi/org.restlet.ext.oauth

@Override
public Representation handleInbound(Response response) {
  Representation result = null;
  // Verify that the request was synchronous
  if (response.getRequest().isSynchronous()) {
    if (response.getStatus().isError()) {
      doError(response.getStatus());
      // DO NOT DISPOSE THE RESPONSE.
    }/* else { */
    result = (response == null) ? null : response.getEntity();
    /* } */
  }
  return result;
}

代码示例来源:origin: org.restlet.osgi/org.restlet

/**
 * Handles the inbound call. Note that only synchronous calls are processed.
 * 
 * @param response
 * @return The response's entity, if any.
 */
public Representation handleInbound(Response response) {
  if (response == null) {
    return null;
  }
  // Verify that the request was synchronous
  if (response.getRequest().isSynchronous()) {
    if (response.getStatus().isError()) {
      doError(response.getStatus());
      return null;
    }
    return response.getEntity();
  }
  return null;
}

代码示例来源:origin: org.sonatype.nexus/nexus-test-harness-launcher

protected Metadata downloadMetadataFromRepository(Gav gav, String repoId)
  throws IOException, XmlPullParserException
{
 String url = String.format("%s%s%s/%s/%s/maven-metadata.xml",
   getBaseNexusUrl(),
   REPOSITORY_RELATIVE_URL,
   repoId,
   gav.getGroupId(),
   gav.getArtifactId());
 Response response = null;
 try {
  response = RequestFacade.sendMessage(new URL(url), Method.GET, null);
  if (response.getStatus().isError()) {
   return null;
  }
  try (InputStream stream = response.getEntity().getStream()) {
   MetadataXpp3Reader metadataReader = new MetadataXpp3Reader();
   return metadataReader.read(stream);
  }
 }
 finally {
  RequestFacade.releaseResponse(response);
 }
}

代码示例来源:origin: org.restlet.osgi/org.restlet

if (response.getStatus().isError()
    && ((response.getEntity() == null) || isOverwriting())) {
  response.setEntity(getStatusService().toRepresentation(

代码示例来源:origin: org.restlet/org.restlet.ext.jetty

@Override
  public void sendResponse(Response response) throws IOException {
    // Add call headers
    Parameter header;
    for (final Iterator<Parameter> iter = getResponseHeaders().iterator(); iter
        .hasNext();) {
      header = iter.next();
      getConnection().getResponse().addHeader(header.getName(),
          header.getValue());
    }

    // Set the status code in the response. We do this after adding the
    // headers because when we have to rely on the 'sendError' method,
    // the Servlet containers are expected to commit their response.
    if (Status.isError(getStatusCode()) && (response.getEntity() == null)) {
      try {
        getConnection().getResponse().sendError(getStatusCode(),
            getReasonPhrase());
      } catch (IOException ioe) {
        getLogger().log(Level.WARNING,
            "Unable to set the response error status", ioe);
      }
    } else {
      // Send the response entity
      getConnection().getResponse().setStatus(getStatusCode());
      super.sendResponse(response);
    }

  }
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.jetty

@Override
  public void sendResponse(Response response) throws IOException {
    // Add call headers
    Parameter header;
    for (final Iterator<Parameter> iter = getResponseHeaders().iterator(); iter
        .hasNext();) {
      header = iter.next();
      getConnection().getResponse().addHeader(header.getName(),
          header.getValue());
    }

    // Set the status code in the response. We do this after adding the
    // headers because when we have to rely on the 'sendError' method,
    // the Servlet containers are expected to commit their response.
    if (Status.isError(getStatusCode()) && (response.getEntity() == null)) {
      try {
        getConnection().getResponse().sendError(getStatusCode(),
            getReasonPhrase());
      } catch (IOException ioe) {
        getLogger().log(Level.WARNING,
            "Unable to set the response error status", ioe);
      }
    } else {
      // Send the response entity
      getConnection().getResponse().setStatus(getStatusCode());
      super.sendResponse(response);
    }

  }
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.jaxrs

@SuppressWarnings("unchecked")
  public void handle(Request request, Response response) {
    if (response.getStatus().isError()) {
      rCallback.onFailure(new ResourceException(response.getStatus()));
    } else {
      if (actualType != null) {
        Object result = null;
        try {
          result = getClientResource().toObject(response.getEntity(), actualType);
          rCallback.onSuccess(result);
        } catch (Exception e) {
          rCallback.onFailure(new ResourceException(e));
        }
      } else {
        rCallback.onSuccess(null);
      }
    }
  }
};

代码示例来源:origin: org.restlet.osgi/org.restlet

@SuppressWarnings("unchecked")
public void handle(Request request,
    Response response) {
  if (response.getStatus().isError()) {
    rCallback
        .onFailure(new ResourceException(

相关文章