Java Code Examples for org.springframework.web.bind.annotation.RequestMethod#HEAD
The following examples show how to use
org.springframework.web.bind.annotation.RequestMethod#HEAD .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WindowQuickInputRestController.java From metasfresh-webui-api-legacy with GNU General Public License v3.0 | 6 votes |
@RequestMapping(method = RequestMethod.HEAD) public ResponseEntity<Object> checkSupported( @PathVariable("windowId") final String windowIdStr, @PathVariable("documentId") final String documentIdStr_NOTUSED, @PathVariable("tabId") final String tabIdStr) { userSession.assertLoggedIn(); final WindowId windowId = WindowId.fromJson(windowIdStr); final DocumentEntityDescriptor includedDocumentDescriptor = documentsCollection.getDocumentEntityDescriptor(windowId) .getIncludedEntityByDetailId(DetailId.fromJson(tabIdStr)); if (quickInputDescriptors.hasQuickInputEntityDescriptor(includedDocumentDescriptor)) { return new ResponseEntity<>(HttpStatus.OK); } else { return new ResponseEntity<>(HttpStatus.NOT_FOUND); } }
Example 2
Source File: ErrorHandlingConfig.java From guardedbox with GNU Affero General Public License v3.0 | 6 votes |
/** * Error handler. * * @return Unauthorized (401), Forbidden (403) or Not Found (404) with no body. */ @RequestMapping(value = "/error", method = {RequestMethod.GET, RequestMethod.POST, RequestMethod.PUT, RequestMethod.DELETE, RequestMethod.HEAD, RequestMethod.OPTIONS, RequestMethod.PATCH, RequestMethod.TRACE}) public ResponseEntity<?> error() { Map<String, Object> requestErrorAttributes = errorAttributes.getErrorAttributes( new ServletWebRequest(request), ErrorAttributeOptions.defaults()); HttpStatus errorStatus = HttpStatus.valueOf((Integer) requestErrorAttributes.get("status")); if (HttpStatus.UNAUTHORIZED.equals(errorStatus) || HttpStatus.FORBIDDEN.equals(errorStatus)) { session.invalidate(); return new ResponseEntity<>(errorStatus); } else { return new ResponseEntity<>(HttpStatus.NOT_FOUND); } }
Example 3
Source File: OssRestController.java From lemon with Apache License 2.0 | 5 votes |
/** * 判断文件是否存在. */ @RequestMapping(method = RequestMethod.HEAD) public void doesObjectExist(HttpServletRequest request, HttpServletResponse response) throws Exception { logger.info("head"); OssAccess ossAccess = this.checkAuthorization(request, response); if (ossAccess == null) { return; } try { OssConfigDTO ossConfigDto = this.processConfig(request); OssDTO ossDto = ossService.doesObjectExist( ossConfigDto.getBucketName(), ossConfigDto.getObjectName()); BaseDTO baseDto = new BaseDTO(); baseDto.setCode(200); baseDto.setData(ossDto != null); response.setContentType("application/json"); response.getWriter().write(jsonMapper.toJson(baseDto)); } catch (Exception ex) { this.sendError(response, ex); } }
Example 4
Source File: AdResourceController.java From spring-rest-black-market with MIT License | 5 votes |
@RequestMapping(value = "/ads/{id}/publishing", method = RequestMethod.HEAD) @ResponseBody public void publishHead(@PathVariable("id") Long id) { Ad ad = adService.findOne(id); if (ad == null || ad.getStatus() != Ad.Status.NEW) { throw new ResourceNotFoundException(); } }
Example 5
Source File: ConsoleIndex.java From eagle with Apache License 2.0 | 5 votes |
@ResponseBody @RequestMapping(value = "/user", method = RequestMethod.HEAD) public void getLoginUser(HttpServletResponse response) { UserDetails userDetails = (UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); String userName = userDetails.getUsername(); if (Strings.isNullOrEmpty(userName)) { AuthenticatUtil.needAuthenticate(response); return; } AuthenticatUtil.authenticateSuccess(response, userName); }
Example 6
Source File: RestServerController.java From zstack with Apache License 2.0 | 5 votes |
@RequestMapping( value = RestConstants.ALL_PATH, method = { RequestMethod.POST, RequestMethod.PUT, RequestMethod.DELETE, RequestMethod.GET, RequestMethod.HEAD, } ) public void api(HttpServletRequest request, HttpServletResponse response) throws IOException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { server.handle(request, response); }
Example 7
Source File: SafeSpringCsrfRequestMappingController.java From Android_Code_Arbiter with GNU Lesser General Public License v3.0 | 4 votes |
/** * 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() { }
Example 8
Source File: HelloController.java From spring-cloud-square with Apache License 2.0 | 4 votes |
@RequestMapping(method = RequestMethod.HEAD, path = "/head") ResponseEntity<Void> head() { return ResponseEntity.ok().build(); }
Example 9
Source File: RequestMappingInfoHandlerMappingTests.java From spring-analysis-note with MIT License | 4 votes |
@RequestMapping(value = "/ba*", method = { RequestMethod.GET, RequestMethod.HEAD }) public void bar() { }
Example 10
Source File: ServletAnnotationControllerTests.java From spring4-understanding with Apache License 2.0 | 4 votes |
@RequestMapping(value = "/myPath.do", method = RequestMethod.HEAD) public void head() { }
Example 11
Source File: RootController.java From tds with BSD 3-Clause "New" or "Revised" License | 4 votes |
@RequestMapping(value = {"/", "/catalog.html"}, method = {RequestMethod.GET, RequestMethod.HEAD}) public String redirectRootCatalog() { return "redirect:/catalog/catalog.html"; }
Example 12
Source File: ValidFeignClientTests.java From spring-cloud-openfeign with Apache License 2.0 | 4 votes |
@RequestMapping(method = RequestMethod.HEAD, path = "/head") ResponseEntity<Void> head() { return ResponseEntity.ok().build(); }
Example 13
Source File: ServletAnnotationControllerHandlerMethodTests.java From spring-analysis-note with MIT License | 4 votes |
@RequestMapping(path = "/stores", method = RequestMethod.HEAD) public ResponseEntity<Void> headResource() { return ResponseEntity.ok().header("h1", "v1").build(); }
Example 14
Source File: FooController.java From tutorials with MIT License | 4 votes |
@RequestMapping(method = RequestMethod.HEAD, value = "/foos") @ResponseStatus(HttpStatus.OK) @ResponseBody public Foo headFoo() { return new Foo(1, randomAlphabetic(4)); }
Example 15
Source File: UnsafeSpringCsrfRequestMappingController.java From Android_Code_Arbiter with GNU Lesser General Public License v3.0 | 4 votes |
/** * 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() { }
Example 16
Source File: AgentRegistrationController.java From gocd with Apache License 2.0 | 4 votes |
@RequestMapping(value = "/admin/agent", method = RequestMethod.HEAD) public void checkAgentVersion(HttpServletResponse response) { response.setHeader("Content-MD5", agentChecksum); setOtherHeaders(response); }
Example 17
Source File: ServletAnnotationControllerHandlerMethodTests.java From java-technology-stack with MIT License | 4 votes |
@RequestMapping(path = "/stores", method = RequestMethod.HEAD) public ResponseEntity<Void> headResource() { return ResponseEntity.ok().header("h1", "v1").build(); }
Example 18
Source File: AgentRegistrationController.java From gocd with Apache License 2.0 | 4 votes |
@RequestMapping(value = "/admin/tfs-impl.jar", method = RequestMethod.HEAD) public void checkTfsImplVersion(HttpServletResponse response) { response.setHeader("Content-MD5", tfsSdkChecksum); setOtherHeaders(response); }
Example 19
Source File: DummyController.java From spring-openapi with MIT License | 4 votes |
@RequestMapping(path = "/{id}", method = RequestMethod.HEAD) public ResponseEntity<Void> isPresent(@PathVariable("id") Integer id) { return null; }
Example 20
Source File: MossInstancesProxyController.java From Moss with Apache License 2.0 | 3 votes |
/** * 所以端点的请求代理入口:/admin/instances/{instanceId}/actuator/** * @author xujin * @param instanceId * @param servletRequest * @param servletResponse * @return * @throws IOException */ @ResponseBody @RequestMapping(path = HALO_REQUEST_MAPPING_PATH, method = {RequestMethod.GET, RequestMethod.HEAD, RequestMethod.POST, RequestMethod.PUT, RequestMethod.PATCH, RequestMethod.DELETE, RequestMethod.OPTIONS}) public Mono<Void> endpointProxy(@PathVariable("instanceId") String instanceId, HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws IOException { return super.endpointProxy(instanceId, servletRequest, servletResponse); }