Похожие чаты

I have a SprinBoot Controller which accepts single piece of

data, and returns the output. Example


ResponseEntity singleController(Data data, HttpServletRequest hsr)


Now I have another endpoint which accepts multiple data. I just want to prevent writing all new logic, and wrap it with singleController.

ResponseEntity multiController(List<Data> dataList, HttpServletRequest hsr)


How can I do it? Would I need to pass the same instance of HttpServletRequest?
I also have ControllerAdvice configured which catches exceptions from singleController. How will that work with multiController?

2 ответов

10 просмотров

I Roy, Why you are creating 2 different endpoints. You can keep the multiController endpoint only with List<Data> and you can pass single object in list for single request.

Roy- Автор вопроса
Salman Shaikh
I Roy, Why you are creating 2 different endpoints...

Let's just say the single end point already exists and I don't want to change the logic of that

Похожие вопросы

Обсуждают сегодня

Hello Everyone 🙌🏻💜 Happy (?) Friday to everyone 😁😁 I have read through all the comments/feedback/complaints in the last 2 days following the CEO Update AMA. Clearly the ...
Patrick - Ultra.io
4
How did we have so many dormant scammers in here? Who are these people. It’s been years. We know each other. If you dm me “I’ve been an og” but haven’t said a single word her...
Justin | LGCY |
42
Кстати, а я вот тут подумал. Допустим, у нас имеется цикл который выполняет огромное количество итераций, но мы хотим, чтобы какие-то действия исполнилось только один раз. В Я...
The Bird of Hermes
23
Доброй ночи. Вопрос знатокам. Имеется некая таблица, результат которой выведен в DBGrid на форме. И есть форма, с помощью которой можно как добавить запись, так и отредактиров...
Евгений
28
🌟 Great News from Dypius! 🌟 We're happy to announce the Early Access launch of the Dypius Mobile App by the end of this month! Let's dive into the features you'll get to exp...
DYP | Tim
3
Guys I want to exec into a container running on Fargate like this: aws ecs execute-command --cluster my-cluster --task task_id --container app --command bash --interactive ...
Ehsan
14
а всё почему? потому что ассемблер в отличии от яву порождает множество пагубных привычек, среди которых например можно отметить использование глобальных переменных для всего ...
Mixail Frolov
35
Dan continues to show up to AMA's, supports and speaks about ergo, hired two ergo devs to be part of the team, developed open source software that anyone can use on ergo, offe...
qx()
24
Всем привет 👋 Подскажите пожалуйста, а чего тут не хватает permission или образ битый? Running with gitlab-runner 17.0.0 (44feccdf) on gitlab-runner-c58775949-d7znz YxYz2zp...
Max
2
анрей С какой целью зашёл?
КТ315
42
Карта сайта