'How to define a class or method after @Getmapping in a Spring Controller
when defining a class after @Getmapping annotation in Spring Controller, are there other ways besides Iterable see code sample below on how to define a class or method after @Getmapping in a Spring Controller,
@RestController
@RequestMapping("/rooms")
public class RoomController {
@Autowired
private RoomRepository roomRepository;
@GetMapping
public Iterable<Room> getRooms(){
return this.roomRepository.findAll();
}
}
Are there other ways to define a class or method after @Getmapping in a Spring Controller
Solution 1:[1]
Based on HTTP GET specification:
The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI. If the Request-URI refers to a data-producing process, it is the produced data which shall be returned as the entity in the response and not the source text of the process, unless that text happens to be the output of the process.
So, for GetMapping you can return any type which defines as an entity (i.e. any Class which suits your requirement).
Solution 2:[2]
You can set upload_max_filesize in script ini_set("upload_max_filesize", "600M")
Use chunk uploading
Solution 3:[3]
You can try it with .user.ini or .htaccess or ini_set(in your php script)
For me .user.ini works perfectly
Create a new file(0644 on Linux) .user.ini on your webspace/working dir with
max_execution_time = 10000 upload_max_filesize = 5000M post_max_size = 5000MThis is my config file .user.ini on my webspace and it works.
You can change the values to your needs.
Create a new file(0644 on Linux) .htaccess on your webspace/working dir with
php_value upload_max_filesize 1000M php_value post_max_size 1000MDon't forget the first dot/point at the beginning of the file.
Put this on the beginning of your php script
ini_set('upload_max_filesize', '1000M'); ini_set('max_execution_time', '1000'); ini_set('memory_limit', '128M'); ini_set('post_max_size', '1000M');
If this won't work(and you can't modify php.ini) than contact your webhoster and ask him, what you can do.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ashish Patil |
| Solution 2 | Sonu Gupta |
| Solution 3 | Ruli |
