Search in sources :

Example 1 with GetMapping

use of org.springframework.web.bind.annotation.GetMapping in project scoold by Erudika.

the class RevisionsController method get.

@GetMapping("/{postid}")
public String get(@PathVariable String postid, HttpServletRequest req, Model model) {
    Post showPost = utils.getParaClient().read(postid);
    if (showPost == null) {
        return "redirect:" + questionslink;
    }
    Pager itemcount = utils.getPager("page", req);
    List<Revision> revisionslist = showPost.getRevisions(itemcount);
    // we need the first revision on the next page for diffing
    List<Revision> nextPage = showPost.getRevisions(new Pager(itemcount.getPage() + 1, itemcount.getLimit()));
    utils.fetchProfiles(revisionslist);
    model.addAttribute("path", "revisions.vm");
    model.addAttribute("title", utils.getLang(req).get("revisions.title"));
    model.addAttribute("showPost", showPost);
    model.addAttribute("itemcount", itemcount);
    model.addAttribute("revisionslist", revisionslist);
    model.addAttribute("lastOnPage", nextPage.isEmpty() ? null : nextPage.get(0));
    return "base";
}
Also used : Revision(com.erudika.scoold.core.Revision) Post(com.erudika.scoold.core.Post) Pager(com.erudika.para.utils.Pager) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 2 with GetMapping

use of org.springframework.web.bind.annotation.GetMapping in project spring-boot by spring-projects.

the class WelcomeController method welcome.

@GetMapping("/")
public String welcome(Map<String, Object> model) {
    model.put("time", new Date());
    model.put("message", this.message);
    return "welcome";
}
Also used : Date(java.util.Date) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 3 with GetMapping

use of org.springframework.web.bind.annotation.GetMapping in project spring-boot by spring-projects.

the class WelcomeController method welcome.

@GetMapping("/")
public String welcome(Map<String, Object> model) {
    model.put("time", new Date());
    model.put("message", this.message);
    return "welcome";
}
Also used : Date(java.util.Date) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 4 with GetMapping

use of org.springframework.web.bind.annotation.GetMapping in project spring-boot by spring-projects.

the class IndexController method index.

@GetMapping("/")
@Transactional(readOnly = true)
public ModelAndView index() {
    List<Note> notes = this.noteRepository.findAll();
    ModelAndView modelAndView = new ModelAndView("index");
    modelAndView.addObject("notes", notes);
    return modelAndView;
}
Also used : Note(sample.jpa.domain.Note) ModelAndView(org.springframework.web.servlet.ModelAndView) GetMapping(org.springframework.web.bind.annotation.GetMapping) Transactional(org.springframework.transaction.annotation.Transactional)

Example 5 with GetMapping

use of org.springframework.web.bind.annotation.GetMapping in project cas by apereo.

the class SamlMetadataController method generateMetadataForIdp.

/**
     * Displays the identity provider metadata.
     * Checks to make sure metadata exists, and if not, generates it first.
     *
     * @param response servlet response
     * @throws IOException the iO exception
     */
@GetMapping(path = SamlIdPConstants.ENDPOINT_IDP_METADATA)
public void generateMetadataForIdp(final HttpServletResponse response) throws IOException {
    final File metadataFile = this.metadataAndCertificatesGenerationService.performGenerationSteps();
    final String contents = FileUtils.readFileToString(metadataFile, StandardCharsets.UTF_8);
    response.setContentType(CONTENT_TYPE);
    response.setStatus(HttpServletResponse.SC_OK);
    try (PrintWriter writer = response.getWriter()) {
        LOGGER.debug("Producing metadata for the response");
        writer.write(contents);
        writer.flush();
    }
}
Also used : File(java.io.File) PrintWriter(java.io.PrintWriter) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Aggregations

GetMapping (org.springframework.web.bind.annotation.GetMapping)737 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)114 ResponseEntity (org.springframework.http.ResponseEntity)78 ArrayList (java.util.ArrayList)52 ModelAndView (org.springframework.web.servlet.ModelAndView)48 List (java.util.List)46 WebMessageException (org.hisp.dhis.dxf2.webmessage.WebMessageException)45 HttpHeaders (org.springframework.http.HttpHeaders)40 HashMap (java.util.HashMap)38 lombok.val (lombok.val)38 Map (java.util.Map)37 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)36 Grid (org.hisp.dhis.common.Grid)35 IOException (java.io.IOException)32 ApiOperation (io.swagger.annotations.ApiOperation)31 RootNode (org.hisp.dhis.node.types.RootNode)31 RequestParam (org.springframework.web.bind.annotation.RequestParam)31 PathVariable (org.springframework.web.bind.annotation.PathVariable)30 HttpServletRequest (javax.servlet.http.HttpServletRequest)29 FieldFilterParams (org.hisp.dhis.fieldfilter.FieldFilterParams)28