Search in sources :

Example 56 with GetMapping

use of org.springframework.web.bind.annotation.GetMapping in project judge by zjnu-acm.

the class UserListController method userList.

@GetMapping({ "/userlist", "/users" })
@SuppressWarnings("AssignmentToMethodParameter")
public String userList(HttpServletRequest request, @PageableDefault(50) Pageable pageable) {
    Sort sort = pageable.getSort();
    int pageSize = Math.min(pageable.getPageSize(), 500);
    if (sort == null || !sort.iterator().hasNext()) {
        sort = DEFAULT_SORT;
    }
    pageable = new PageRequest(pageable.getPageNumber(), pageSize, sort);
    String query = URLBuilder.fromRequest(request).replaceQueryParam("page").toString();
    request.setAttribute("url", query);
    request.setAttribute("page", accountService.findAll(pageable));
    return "users/list";
}
Also used : PageRequest(org.springframework.data.domain.PageRequest) Sort(org.springframework.data.domain.Sort) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 57 with GetMapping

use of org.springframework.web.bind.annotation.GetMapping in project theskeleton by codenergic.

the class RegistrationController method registrationView.

@GetMapping
public String registrationView(RegistrationForm registrationForm, WebRequest request) {
    Connection<?> connection = providerSignInUtils.getConnectionFromSession(request);
    if (connection != null) {
        UserProfile profile = connection.fetchUserProfile();
        registrationForm.setUsername(profile.getUsername());
        registrationForm.setEmail(profile.getEmail());
    }
    return REGISTRATION;
}
Also used : UserProfile(org.springframework.social.connect.UserProfile) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 58 with GetMapping

use of org.springframework.web.bind.annotation.GetMapping in project Logos_Materials_October_2017 by VolodymyrZavada.

the class StudentController method showStudentForm.

@GetMapping("/add")
public String showStudentForm(Model model) {
    LinkedHashMap<String, String> countryOptions = new LinkedHashMap<>();
    countryOptions.put("BR", "Brazil");
    countryOptions.put("FR", "France");
    countryOptions.put("DE", "Germany");
    countryOptions.put("IN", "India");
    countryOptions.put("US", "United States of America");
    countryOptions.put("UA", "Ukraine");
    List<String> radioOptions = new ArrayList<>();
    radioOptions.add("Java");
    radioOptions.add("C#");
    radioOptions.add("PHP");
    radioOptions.add("Ruby");
    model.addAttribute("studentModel", new Student());
    model.addAttribute("countries", countryOptions);
    model.addAttribute("favoriteLanguages", radioOptions);
    model.addAttribute("studentDegrees", StudentDegree.values());
    return "student-add";
}
Also used : ArrayList(java.util.ArrayList) Student(ua.spring.web.entity.Student) LinkedHashMap(java.util.LinkedHashMap) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 59 with GetMapping

use of org.springframework.web.bind.annotation.GetMapping in project Logos_Materials_October_2017 by VolodymyrZavada.

the class RestController method buy.

@GetMapping("/buy")
public ResponseEntity<?> buy(@RequestParam("productid") String prodIdStr) {
    int productId = Integer.valueOf(prodIdStr);
    ProductEntity entity = productService.findProductById(productId);
    entity.setInStock(entity.getInStock() - 1);
    productService.saveOrUpdate(entity);
    return new ResponseEntity<>(HttpStatus.OK);
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) ProductEntity(com.zavada.entity.ProductEntity) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 60 with GetMapping

use of org.springframework.web.bind.annotation.GetMapping in project Logos_Materials_October_2017 by VolodymyrZavada.

the class CarController method showAddCarForm.

@GetMapping("/create")
public String showAddCarForm(Model model) {
    model.addAttribute("carModel", new Car());
    model.addAttribute("colorsList", colorService.findAllColors());
    return "car/create";
}
Also used : Car(ua.springboot.web.entity.Car) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Aggregations

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