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";
}
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;
}
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";
}
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);
}
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";
}
Aggregations