Example usage for org.springframework.web.bind.annotation RequestMethod HEAD

List of usage examples for org.springframework.web.bind.annotation RequestMethod HEAD

Introduction

In this page you can find the example usage for org.springframework.web.bind.annotation RequestMethod HEAD.

Prototype

RequestMethod HEAD

To view the source code for org.springframework.web.bind.annotation RequestMethod HEAD.

Click Source Link

Usage

From source file:com.card.loop.xyz.pageControllers.IndexController.java

@RequestMapping(value = "/downloads", method = RequestMethod.HEAD)
public void accessDownloadFileH(HttpServletRequest req, HttpServletResponse res) {
    try {/* w  ww  .  j  a  va 2  s  .c  om*/
        ContentShipper sh = new ContentShipper(req, res, false); // true if ship physical file
        sh.ship("C:\\Users\\jm-maricel\\Desktop\\100415\\loop-java-elearning\\uploads\\LE\\TestLEUpload2.zip");
    } catch (IOException ex) {
        Logger.getLogger(IndexController.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:org.dd4t.test.web.controller.SpringPageController.java

/**
 * All page requests are handled by this method. The page meta XML is
 * queried based on the request URI, the page meta XML contains the actual
 * view name to be rendered.// w ww .j  a  v a 2 s .c  o m
 *
 * @param model the Spring Model
 * @param request the HttpServletRequest
 * @param response the HttpServletResponse
 */
@RequestMapping(value = { "/**/*.html", "/**/*.txt", "/**/*.xml" }, method = { RequestMethod.GET,
        RequestMethod.HEAD })
@Override
public String showPage(final Model model, final HttpServletRequest request, final HttpServletResponse response)
        throws IOException {
    return super.showPage(model, request, response);
}

From source file:org.dspace.webmvc.controller.ResourceController.java

@RequestMapping(method = RequestMethod.HEAD)
protected void processHeadRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
    lookup(request).respondHead(response);
}

From source file:net.eusashead.hateoas.conditional.interceptor.AsyncTestController.java

@RequestMapping(method = RequestMethod.HEAD)
public Callable<ResponseEntity<Void>> head() {
    return new Callable<ResponseEntity<Void>>() {

        @Override//from   w w  w .j  a v  a 2s.c  om
        public ResponseEntity<Void> call() throws Exception {
            HttpHeaders headers = new HttpHeaders();
            headers.setETag("\"123456\"");
            return new ResponseEntity<Void>(headers, HttpStatus.OK);
        }
    };

}

From source file:com.ecsteam.springutils.pattern.controller.PatternController.java

@RequestMapping(value = "/alive", method = RequestMethod.HEAD)
public void isAlive() {
    return;
}

From source file:org.dd4t.test.web.controller.SpringComponentPresentationController.java

/**
 * Renders the component/model, which must be put on the request using
 * {@link ComponentUtils#setComponentPresentation}.
 *
 * @param componentViewName the viewName to be used to render this component
 * @param componentId       the id as an int, not a tcm uri!
 * @param request           the request on which the component must be present
 * @return the view name to render/*  www .j  a  va2  s.c  o m*/
 */
@Override
@RequestMapping(value = { "/{componentViewName}/{componentId}.dcp" }, method = { RequestMethod.GET,
        RequestMethod.HEAD })
public String showComponentPresentation(@PathVariable final String componentViewName,
        @PathVariable final int componentId, final HttpServletRequest request) {
    return super.showComponentPresentation(componentViewName, componentId, request);
}

From source file:org.dawnsci.marketplace.controllers.FileController.java

@RequestMapping(value = "/{solution}/**", method = { RequestMethod.GET, RequestMethod.HEAD })
@ResponseBody//  w w w.  ja v a2  s  .c  o m
public ResponseEntity<FileSystemResource> getFile(@PathVariable("solution") String solution,
        HttpServletRequest request) {
    String path = (String) request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
    String bestMatchPattern = (String) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE);
    AntPathMatcher apm = new AntPathMatcher();
    path = apm.extractPathWithinPattern(bestMatchPattern, path);
    File file = fileService.getFile(solution, path);
    if (file.exists() && file.isFile()) {
        try {
            String detect = tika.detect(file);
            MediaType mediaType = MediaType.parseMediaType(detect);
            return ResponseEntity.ok().contentLength(file.length()).contentType(mediaType)
                    .lastModified(file.lastModified()).body(new FileSystemResource(file));
        } catch (IOException e) {
            e.printStackTrace();
        }
    } else {
        throw new ResourceNotFoundException();
    }
    return null;
}

From source file:com.ninjas.movietime.resource.MainResource.java

/**
 * for new relic ping/*from   ww w  . ja va  2 s .  com*/
 */
@RequestMapping(method = RequestMethod.HEAD)
public String ping() {
    MetricManager.markResourceMeter("ping");
    return "pong";
}

From source file:cn.hbu.cs.esearch.controller.EsearchController.java

@RequestMapping(value = { "index", "/" }, method = { RequestMethod.GET, RequestMethod.HEAD })
public String indexPage(ModelMap modelMap) {
    modelMap.addAttribute("isSearchRequest", false);
    return "index";
}

From source file:net.eusashead.hateoas.response.argumentresolver.AsyncEntityController.java

@RequestMapping(method = { RequestMethod.GET, RequestMethod.HEAD })
public Callable<ResponseEntity<Entity>> get(@PathVariable final String name,
        final EntityResponseBuilder<Entity> builder) {

    return new Callable<ResponseEntity<Entity>>() {

        @Override/*from   w  w  w  .  ja  va2  s . c  o m*/
        public ResponseEntity<Entity> call() throws Exception {
            Entity entity = service.getEntity(name);
            return builder.entity(entity).etag().build();
        }
    };

}