当前位置: 首页>>代码示例>>Java>>正文


Java Response.SC_NOT_FOUND属性代码示例

本文整理汇总了Java中com.google.gwt.http.client.Response.SC_NOT_FOUND属性的典型用法代码示例。如果您正苦于以下问题:Java Response.SC_NOT_FOUND属性的具体用法?Java Response.SC_NOT_FOUND怎么用?Java Response.SC_NOT_FOUND使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.google.gwt.http.client.Response的用法示例。


在下文中一共展示了Response.SC_NOT_FOUND属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isExpected

/** Is the Gerrit Code Review server likely to return this status? */
public static boolean isExpected(int statusCode) {
  switch (statusCode) {
    case SC_UNAVAILABLE:
    case Response.SC_BAD_REQUEST:
    case Response.SC_UNAUTHORIZED:
    case Response.SC_FORBIDDEN:
    case Response.SC_NOT_FOUND:
    case Response.SC_METHOD_NOT_ALLOWED:
    case Response.SC_CONFLICT:
    case Response.SC_PRECONDITION_FAILED:
    case 422: // Unprocessable Entity
    case 429: // Too Many Requests (RFC 6585)
      return true;

    default:
      // Assume any other code is not expected. These may be
      // local proxy server errors outside of our control.
      return false;
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:21,代码来源:RestApi.java

示例2: downloadLogo

/**
 * See {@link ServletMethod#DOWNLOAD_LOGO} for JavaDoc.
 * 
 * @param request
 *          The HTTP request containing the file id parameter.
 * @param response
 *          The HTTP response on which the file content is written.
 * @param context
 *          The execution context.
 * @throws Exception
 *           If an error occurs during process.
 */
protected void downloadLogo(final HttpServletRequest request, final HttpServletResponse response, final ServletExecutionContext context) throws Exception {

	// Retrieves the file id.
	final String id = getParameter(request, RequestParameter.ID, false);

	if (LOG.isDebugEnabled()) {
		LOG.debug("Downloads logo with id '{}'.", id);
	}

	try {

		downloadBase64(id, fileStorageProvider.open(id), response);

	} catch (final NoSuchFileException e) {
		if (LOG.isInfoEnabled()) {
			LOG.info("No logo found for id '" + id + "'.", e);
		}
		throw new StatusServletException(Response.SC_NOT_FOUND, e);
	}
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:32,代码来源:FileServlet.java

示例3: downloadArchive

/**
 * See {@link ServletMethod#DOWNLOAD_ARCHIVE} for JavaDoc.
 * 
 * @param request
 *          The HTTP request containing the file id parameter.
 * @param response
 *          The HTTP response on which the file content is written.
 * @param context
 *          The execution context.
 * @throws Exception
 *           If an error occurs during process.
 */
protected void downloadArchive(final HttpServletRequest request, final HttpServletResponse response, final ServletExecutionContext context) throws Exception {

	// Retrieves the file id.
	final String id = getParameter(request, RequestParameter.ID, false);

	if (LOG.isDebugEnabled()) {
		LOG.debug("Downloads archive with id '{}'.", id);
	}

	try {

		download(id, backupArchiveManager.open(id), response);

	} catch (final NoSuchFileException e) {
		if (LOG.isInfoEnabled()) {
			LOG.info("No archive found for id '" + id + "'.", e);
		}
		throw new StatusServletException(Response.SC_NOT_FOUND, e);
	}
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:32,代码来源:FileServlet.java

示例4: downloadFile

/**
 * See {@link ServletMethod#DOWNLOAD_FILE} for JavaDoc.
 * 
 * @param request
 *          The HTTP request containing the file id parameter.
 * @param response
 *          The HTTP response on which the file content is written.
 * @param context
 *          The execution context.
 * @throws Exception
 *           If an error occurs during process.
 */
protected void downloadFile(final HttpServletRequest request, final HttpServletResponse response, final ServletExecutionContext context) throws Exception {

	// Retrieves the file version id.
	final Integer fileVersionId = getIntegerParameter(request, RequestParameter.ID, false);

	LOG.debug("Downloads file with version id '{}'.", fileVersionId);

	try {

		final FileVersion version = fileDAO.getVersion(fileVersionId);

		final String name = version.getName() + '.' + version.getExtension();
		final String path = version.getPath();

		download(path, name, fileStorageProvider.open(path), response);

	} catch (final NoSuchFileException e) {
		LOG.info("No file found for version id '" + fileVersionId + "'.", e);
		throw new StatusServletException(Response.SC_NOT_FOUND, e);
	}
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:33,代码来源:FileServlet.java


注:本文中的com.google.gwt.http.client.Response.SC_NOT_FOUND属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。