Search in sources :

Example 41 with GetMapping

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

the class CarController method showCarsByMake.

@GetMapping("/cars/filter")
public String showCarsByMake(@PageableDefault Pageable pageable, @RequestParam("search") String search, Model model) {
    CarFilter filter = null;
    if (search != null) {
        filter = new CarFilter(search);
    }
    Page<Car> cars = carService.findAllCarsByMake(pageable, filter);
    model.addAttribute("carsList", cars.getContent());
    return "car/cars";
}
Also used : CarFilter(ua.springboot.web.domain.CarFilter) Car(ua.springboot.web.entity.Car) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 42 with GetMapping

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

the class CarController method generateRandomCars.

@GetMapping("sachascjksacnk/generate/random")
public String generateRandomCars() {
    for (int i = 0; i < 800; i++) {
        Car car = new Car();
        car.setMake("CarMake #" + i);
        car.setModel("CarModel #" + i);
        car.setColor(colorService.findColorById(1));
        carService.saveCar(car);
    }
    return "redirect:/car/cars";
}
Also used : Car(ua.springboot.web.entity.Car) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 43 with GetMapping

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

the class CourseController method generateRandomCourses.

@GetMapping("jhvbdsjvbdsjvbdsj/generate/random")
public String generateRandomCourses() {
    for (int i = 1; i < 1000; i++) {
        Course course = new Course();
        course.setTitle("Course #" + i * 100);
        course.setDescription("Course Description #" + i);
        course.setPrice(new BigDecimal(i * 10 + ".00"));
        courseService.saveCourse(course);
    }
    return "course/pageable-courses";
}
Also used : Course(ua.springboot.web.entity.Course) BigDecimal(java.math.BigDecimal) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 44 with GetMapping

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

the class UploadFileController method showImageFromProjectDirectory.

@GetMapping("/file-from-project")
public String showImageFromProjectDirectory(Model model) throws IOException {
    String rootPath = System.getProperty("user.dir");
    File uploadDir = new File(rootPath + File.separator + "src" + File.separator + "main" + File.separator + "webapp" + File.separator + "upload" + File.separator + "maxresdefault.jpg");
    byte[] fileToByteArray = Base64.encodeBase64(FileUtils.readFileToByteArray(uploadDir));
    String encodedByte = new String(fileToByteArray);
    model.addAttribute("imageFromProject", encodedByte);
    return "file/preview";
}
Also used : UploadFile(ua.springboot.web.entity.UploadFile) File(java.io.File) MultipartFile(org.springframework.web.multipart.MultipartFile) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 45 with GetMapping

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

the class BaseController method verifyUser.

@GetMapping("/verify")
public String verifyUser(@RequestParam("token") String token, @RequestParam("userid") String userIdStr) {
    int userId = Integer.valueOf(userIdStr);
    UserEntity user = userService.findUserById(userId);
    if (user.getToken().equals(token)) {
        user.setToken("");
        user.setActivated(true);
        userService.updateUser(user);
    }
    return "redirect:/login";
}
Also used : UserEntity(ua.springweb.security.entity.UserEntity) 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