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


Java RequestMethod.HEAD属性代码示例

本文整理汇总了Java中org.springframework.web.bind.annotation.RequestMethod.HEAD属性的典型用法代码示例。如果您正苦于以下问题:Java RequestMethod.HEAD属性的具体用法?Java RequestMethod.HEAD怎么用?Java RequestMethod.HEAD使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.springframework.web.bind.annotation.RequestMethod的用法示例。


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

示例1: requestMappingAllUnprotectedMethodsAndOneProtectedMethod

/**
 * Mapping to several HTTP request methods is not OK if it's a mix of unprotected and protected HTTP request methods.
 */
@RequestMapping(value = "/request-mapping-all-unprotected-methods-and-one-protected-method",
        method = {RequestMethod.GET, RequestMethod.HEAD, RequestMethod.TRACE, RequestMethod.OPTIONS, RequestMethod.PATCH})
public void requestMappingAllUnprotectedMethodsAndOneProtectedMethod() {
}
 
开发者ID:blackarbiter,项目名称:Android_Code_Arbiter,代码行数:7,代码来源:UnsafeSpringCsrfRequestMappingController.java

示例2: headBucket

/**
 * Operation to determine if a bucket exists.
 *
 * @param bucketName name of the Bucket to be checked.
 * @return ResponseEntity Code 200 OK; 404 Not found.
 */
@RequestMapping(value = "/{bucketName}", method = RequestMethod.HEAD)
public ResponseEntity<String> headBucket(@PathVariable final String bucketName) {
  if (fileStore.doesBucketExist(bucketName)) {
    return new ResponseEntity<>(HttpStatus.OK);
  } else {
    return new ResponseEntity<>(HttpStatus.NOT_FOUND);
  }
}
 
开发者ID:adobe,项目名称:S3Mock,代码行数:14,代码来源:FileStoreController.java

示例3: headObject

/**
 * Retrieves metadata from an object without returning the object itself.
 *
 * @param bucketName name of the bucket to look in
 * @return ResponseEntity containing metadata and status
 */
@RequestMapping(
    value = "/{bucketName:.+}/**",
    method = RequestMethod.HEAD)
public ResponseEntity<String> headObject(@PathVariable final String bucketName,
    final HttpServletRequest request) {
  final String filename = filenameFrom(bucketName, request);

  final S3Object s3Object = fileStore.getS3Object(bucketName, filename);
  if (s3Object != null) {
    final HttpHeaders responseHeaders = new HttpHeaders();
    responseHeaders.setContentLength(Long.valueOf(s3Object.getSize()));
    if (!"".equals(s3Object.getContentType())) {
      responseHeaders.setContentType(MediaType.parseMediaType(s3Object.getContentType()));
    }
    responseHeaders.setETag("\"" + s3Object.getMd5() + "\"");
    responseHeaders.setLastModified(s3Object.getLastModified());

    if (s3Object.isEncrypted()) {
      responseHeaders.add(SERVER_SIDE_ENCRYPTION_AWS_KMS_KEYID,
          s3Object.getKmsKeyId());
    }

    return new ResponseEntity<>(responseHeaders, HttpStatus.OK);
  } else {
    return new ResponseEntity<>(HttpStatus.NOT_FOUND);
  }
}
 
开发者ID:adobe,项目名称:S3Mock,代码行数:33,代码来源:FileStoreController.java

示例4: headJenkins

@ApiOperation(value = "", notes = "Retrieve Jenkins headers", response = Void.class, authorizations = {
    @Authorization(value = "jenkins_auth")
}, tags={ "remoteAccess", })
@ApiResponses(value = { 
    @ApiResponse(code = 200, message = "Successfully retrieved Jenkins headers", response = Void.class),
    @ApiResponse(code = 401, message = "Authentication failed - incorrect username and/or password", response = Void.class),
    @ApiResponse(code = 403, message = "Jenkins requires authentication - please set username and password", response = Void.class) })
@RequestMapping(value = "/api/json",
    method = RequestMethod.HEAD)
ResponseEntity<Void> headJenkins( @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
 
开发者ID:cliffano,项目名称:swaggy-jenkins,代码行数:10,代码来源:ApiApi.java

示例5: head

@RequestMapping(value = "/head", method = RequestMethod.HEAD)
@ResponseBody
public Map<String, String> head() {
  Map<String, String> source = new HashMap<>();
  source.put("now", Calendar.getInstance().getTime().toString());
  log.info("head......");
  return source;
}
 
开发者ID:osswangxining,项目名称:iotplatform,代码行数:8,代码来源:TestController.java

示例6: blogArticlesAtom

/**
 * Blog articles Atom output.
 *
 * @param context
 *            the specified context
 */
@RequestMapping(value = { "/blog-articles-feed.do" }, method = { RequestMethod.GET, RequestMethod.HEAD })
public void blogArticlesAtom(final HttpServletRequest request, final HttpServletResponse response) {
	final AtomRenderer renderer = new AtomRenderer();
	final Feed feed = new Feed();

	try {
		final JSONObject preference = preferenceQueryService.getPreference();

		final String blogTitle = preference.getString(Option.ID_C_BLOG_TITLE);
		final String blogSubtitle = preference.getString(Option.ID_C_BLOG_SUBTITLE);
		final int outputCnt = preference.getInt(Option.ID_C_FEED_OUTPUT_CNT);

		feed.setTitle(StringEscapeUtils.escapeXml(blogTitle));
		feed.setSubtitle(StringEscapeUtils.escapeXml(blogSubtitle));
		feed.setUpdated(new Date());
		feed.setAuthor(StringEscapeUtils.escapeXml(blogTitle));
		feed.setLink(Latkes.getServePath() + "/blog-articles-feed.do");
		feed.setId(Latkes.getServePath() + "/");

		final List<Filter> filters = new ArrayList<>();

		filters.add(new PropertyFilter(Article.ARTICLE_IS_PUBLISHED, FilterOperator.EQUAL, true));
		filters.add(new PropertyFilter(Article.ARTICLE_VIEW_PWD, FilterOperator.EQUAL, ""));
		final Query query = new Query().setCurrentPageNum(1).setPageSize(outputCnt)
				.setFilter(new CompositeFilter(CompositeFilterOperator.AND, filters))
				.addSort(Article.ARTICLE_UPDATE_DATE, SortDirection.DESCENDING).setPageCount(1);

		final boolean hasMultipleUsers = userQueryService.hasMultipleUsers();
		String authorName = "";

		final JSONObject articleResult = articleDao.get(query);
		final JSONArray articles = articleResult.getJSONArray(Keys.RESULTS);

		if (!hasMultipleUsers && 0 != articles.length()) {
			authorName = articleQueryService.getAuthor(articles.getJSONObject(0)).getString(User.USER_NAME);
		}

		final boolean isFullContent = "fullContent".equals(preference.getString(Option.ID_C_FEED_OUTPUT_MODE));

		for (int i = 0; i < articles.length(); i++) {
			Entry entry = getEntry(hasMultipleUsers, authorName, articles, isFullContent, i);
			feed.addEntry(entry);
		}

		renderer.setContent(feed.toString());
	} catch (final Exception e) {
		logger.error("Get blog article feed error", e);

		try {
			response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
		} catch (final IOException ex) {
			throw new RuntimeException(ex);
		}
	}
	renderer.render(request, response);
}
 
开发者ID:daima,项目名称:solo-spring,代码行数:62,代码来源:FeedProcessor.java

示例7: blogArticlesRSS

/**
 * Blog articles RSS output.
 *
 * @param context
 *            the specified context
 */
@RequestMapping(value = { "/blog-articles-rss.do" }, method = { RequestMethod.GET, RequestMethod.HEAD })
public void blogArticlesRSS(final HttpServletRequest request, final HttpServletResponse response) {
	final RssRenderer renderer = new RssRenderer();
	final Channel channel = new Channel();

	try {
		final JSONObject preference = preferenceQueryService.getPreference();

		if (null == preference) {
			response.sendError(HttpServletResponse.SC_NOT_FOUND);
			return;
		}

		final String blogTitle = preference.getString(Option.ID_C_BLOG_TITLE);
		final String blogSubtitle = preference.getString(Option.ID_C_BLOG_SUBTITLE);
		final int outputCnt = preference.getInt(Option.ID_C_FEED_OUTPUT_CNT);

		channel.setTitle(StringEscapeUtils.escapeXml(blogTitle));
		channel.setLastBuildDate(new Date());
		channel.setLink(Latkes.getServePath());
		channel.setAtomLink(Latkes.getServePath() + "/blog-articles-rss.do");
		channel.setGenerator("Solo, ver " + SoloConstant.VERSION);
		final String localeString = preference.getString(Option.ID_C_LOCALE_STRING);
		final String country = Locales.getCountry(localeString).toLowerCase();
		final String language = Locales.getLanguage(localeString).toLowerCase();

		channel.setLanguage(language + '-' + country);
		channel.setDescription(blogSubtitle);

		final List<Filter> filters = new ArrayList<>();

		filters.add(new PropertyFilter(Article.ARTICLE_IS_PUBLISHED, FilterOperator.EQUAL, true));
		filters.add(new PropertyFilter(Article.ARTICLE_VIEW_PWD, FilterOperator.EQUAL, ""));
		final Query query = new Query().setCurrentPageNum(1).setPageSize(outputCnt)
				.setFilter(new CompositeFilter(CompositeFilterOperator.AND, filters))
				.addSort(Article.ARTICLE_UPDATE_DATE, SortDirection.DESCENDING).setPageCount(1);

		final JSONObject articleResult = articleDao.get(query);
		final JSONArray articles = articleResult.getJSONArray(Keys.RESULTS);

		final boolean hasMultipleUsers = userQueryService.hasMultipleUsers();
		String authorName = "";

		if (!hasMultipleUsers && 0 != articles.length()) {
			authorName = articleQueryService.getAuthor(articles.getJSONObject(0)).getString(User.USER_NAME);
		}

		final boolean isFullContent = "fullContent".equals(preference.getString(Option.ID_C_FEED_OUTPUT_MODE));

		for (int i = 0; i < articles.length(); i++) {
			Item item = getItem(articles, hasMultipleUsers, authorName, isFullContent, i);
			channel.addItem(item);
		}

		renderer.setContent(channel.toString());
	} catch (final Exception e) {
		logger.error("Get blog article rss error", e);

		try {
			response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
		} catch (final IOException ex) {
			throw new RuntimeException(ex);
		}
	}
	renderer.render(request, response);
}
 
开发者ID:daima,项目名称:solo-spring,代码行数:72,代码来源:FeedProcessor.java

示例8: ping

@RequestMapping(method = {RequestMethod.GET, RequestMethod.HEAD}, value = "/ping")
public ResponseEntity<String> ping() {
  return new ResponseEntity<String>("<html><body><h1>Mischief Managed!</h1></body></html>",
      HttpStatus.OK);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:5,代码来源:ShellCommandsController.java

示例9: getServerStatus

@RequestMapping(value = "/pingpong.html", method = RequestMethod.HEAD)
@ResponseBody
public String getServerStatus() {
	return SyncConstants.SUCCESS;
}
 
开发者ID:gagoyal01,项目名称:mongodb-rdbms-sync,代码行数:5,代码来源:HomeController.java

示例10: requestMappingHead

/**
 * Mapping to the HTTP request method `HEAD` is safe as long as no state-changing operations are performed within this method.
 */
@RequestMapping(value = "/request-mapping-head", method = RequestMethod.HEAD)
public void requestMappingHead() {
}
 
开发者ID:blackarbiter,项目名称:Android_Code_Arbiter,代码行数:6,代码来源:SafeSpringCsrfRequestMappingController.java

示例11: requestMappingSeveralUnprotectedMethods

/**
 * Mapping to several HTTP request methods is fine as long as all the HTTP request methods used are unprotected.
 */
@RequestMapping(value = "/request-mapping-several-unprotected-methods",
        method = {RequestMethod.GET, RequestMethod.HEAD, RequestMethod.TRACE, RequestMethod.OPTIONS})
public void requestMappingSeveralUnprotectedMethods() {
}
 
开发者ID:blackarbiter,项目名称:Android_Code_Arbiter,代码行数:7,代码来源:SafeSpringCsrfRequestMappingController.java


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