controller

ControllerAdvice isn't picking IllegalArgumentException thrown by an incorrect UUID value passed as @RequestParam

こ雲淡風輕ζ 提交于 2021-01-29 07:33:22
问题 I have the following controller: @Slf4j @RestController @RequestMapping("/v1") @Validated public class HighlightController { // ... @GetMapping("/highlights") public ResponseEntity<List<Highlight>> getHighlights( @RequestParam(required = false) UUID impersonateUserId ) { // ... Then I have the following controller exception handler: @Slf4j @ControllerAdvice public class GlobalExceptionHandler { //... @ExceptionHandler(value = IllegalArgumentException.class) public ResponseEntity<Object>

Thymeleaf form not submitting to Spring boot controller

人盡茶涼 提交于 2021-01-29 07:12:55
问题 I am trying to submit a form to Spring boot controller This is the thymeleaf part: <form th:action="@{/change_password}" method="post"> <div class="row"> <div class="col-md-9 register-right"> <div class="tab-content" id="myTabContent"> <div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab"> <h3 class="register-heading">Change password</h3> <div class="row register-form"> <div class="col-md-6"> <div class="form-group"> <input type="email" th:name="email" id

Laravel upload multiple files

本小妞迷上赌 提交于 2021-01-29 05:40:19
问题 I'm building a gallery with multiple files functionality. So far I'm having two issues, but let's paste my code first. Controller: public function store(Request $request) { $gallery = new GalleryImage(); if($request->hasFile('image')) { $images = $request->file('image'); foreach($images as $image) { $path = $image->getClientOriginalName(); $name = time() . '-' . $path; $gallery->image = $image->move(public_path().'/uploads/temp/', $name); //$gallery->image = $request->file('image')->storeAs(

How to pass parameters to a controller's constructor when using `<fx:include>`?

て烟熏妆下的殇ゞ 提交于 2021-01-28 17:52:01
问题 I am learning JavaFX, and I have come across an issue involving the instantiation of controllers that I can not seem to solve. Essentially, I am wondering if it is possible to do one of the following: Pass a parameter to the constructor of the controller when including FXML with <fx:include> ; or Specify a custom controller instance to use when including an FXML file with <fx:include> . Note that these issues are related. In fact, the reason I am asking about option (2) is because it would

How can I get a reference to the controller of an FXML?

对着背影说爱祢 提交于 2021-01-28 09:08:05
问题 I'm trying to make a small "Login then Main Menu" form using JavaFX and Gluon's Scene Builder. I've made 2 scenes so far, the first one is a "Login" screen in which I've connected a SQLite Database, after putting the right Username and Password it loads perfectly fine and it changes to the second scene. For each scene I use a different class (FXML / FXML Controller). In the second scene I want 2 labels that I use to change according to the Database's data (More specifically First_Name and

Unable to return body of request method in nodejs

佐手、 提交于 2021-01-28 06:11:36
问题 I'm trying to get a JSON response via the request method and return the output so that i can store it in a variable when the function is called. when i log the response within the request method, it works fine. However when i return the output, it doesn't return. var getAPIresponse = function(url) { var request = require('request'); request(url, function(error, response, body) { if(!error && response.statusCode == 200) { console.log(body); // WORKS PERFECTLY return body; // I Believe the

Spring MVC ModelAttribute as Interface

爷,独闯天下 提交于 2021-01-28 03:29:41
问题 Using a Spring MVC @Controller, how do I have a @RequestMapping endpoint have a @ModelAttribute declared as an interface? I want to have three different forms being posted to the mapping that the underlying classes are all of an interface type. So for example, I can have three different form objects with the action to the following: @RequestMapping(path="/doSomething", method=RequestMethod.POST) public String doSomething(ObjectInterface formInfo) { ... } (Where ObjectInterface is an interface

Spring MVC ModelAttribute as Interface

两盒软妹~` 提交于 2021-01-28 02:12:18
问题 Using a Spring MVC @Controller, how do I have a @RequestMapping endpoint have a @ModelAttribute declared as an interface? I want to have three different forms being posted to the mapping that the underlying classes are all of an interface type. So for example, I can have three different form objects with the action to the following: @RequestMapping(path="/doSomething", method=RequestMethod.POST) public String doSomething(ObjectInterface formInfo) { ... } (Where ObjectInterface is an interface

How to extend Shopware 6 controller action

痴心易碎 提交于 2021-01-27 16:54:53
问题 I am building a plugin for Shopware 6 and cannot seem to find any documentation as to how to extend an existing controller action. I found this How to add an Action to Account Controller in Shopware but it seems to refer to Shopware 5 and I am not sure I can use it that way in Shopware 6. The controller action I want to extend is \Shopware\Storefront\Controller\AddressController::saveAddress - in my case I want to add custom address validation that would use a service in my plugin where a

Laravel passing the data to route

本秂侑毒 提交于 2021-01-27 14:51:52
问题 I'm new in Laravel 5 and I need some help since I can't solve my simple problem. I have a list of data on http://sample.com/partners and if I will click the link of the data I like it to redirect it to http://sample.com/partners/users/77 and it will display the information about the user with the id 77. I can't provide my route and controller but here is my partners.blade.php @foreach ($data as $partners) <tr bgcolor="#FF9999"> <td><a href="{{ $partners->partner_id }}"> {{ $partners->partner