-
Notifications
You must be signed in to change notification settings - Fork 0
Реализовал HTTP API #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
BaseHttpHandler новый клас с базовыми методами для обработки heldel`оф sendText sendNotFound sendHashInteraction Создал новый класс DurationAdapter Создал новый класс LocalDateTimeAdapter Создал классы TaskHandler, EpicHandler, SubtaskHandler в них основная логима по обработке запросов от клиента. GET POST DELETE новые классы PriorityHandler и HistoryHandler обрабатывают запросы и возвращают списки задач История и Историяприоритетов Добавил 2 новых исключения создал отдельтый csv файл для теста FileBackedTaskManagerTest Написал тесты всех новых классов, Добавляя удаляя и получая задачи из запросов клиента.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Привет, в целом всё отлично, только совсем небольшие ошибки на исправление
И будем закрывать проект с:
} | ||
|
||
@Override | ||
public void handle(HttpExchange exchange) throws IOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В таком варианте можно попробовать в BaseHttpHandler вынести, достаточно универсально получилось. Если где-то, допустим, POST не нужен - возвращать NOT_IMPLEMENTED
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Но вообще всё отлично, это на улучшение комментарий
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Я пока трогать не буду, ты имеешь ввиду что метод общий для всех хендлеров сделать? Разве не может быть дальше так что в каком то классе не понадобиться какой то эндпоинт? и куда его тогда девать? Может оставить? Как говорится Работает не трогай =)))
} | ||
|
||
@Override | ||
public void handle(HttpExchange exchange) throws IOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тут не надо handle вообще добавлять, сделай класс BaseHttpHandler абстрактным
Конкретная реализация в наследниках будет идти
Перенес инициализацию контекста при создании сервера в конструктор HttpTaskServer Сделал класс BaseHttpHandler абстрактным и удалил из него hendle
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Привет, всё поправлено, принято ( ̄^ ̄)ゞ
Теперь переходим к изучению фреймворка, больше такой низкоуровневой настройки сервера вручную (почти) не будет
BaseHttpHandler новый клас с базовыми методами для обработки heldel`оф sendText sendNotFound sendHashInteraction
Создал новый класс DurationAdapter
Создал новый класс LocalDateTimeAdapter
Создал классы TaskHandler, EpicHandler, SubtaskHandler в них основная логима по обработке запросов от клиента. GET POST DELETE новые классы PriorityHandler и HistoryHandler обрабатывают запросы и возвращают списки задач История и Историяприоритетов Добавил 2 новых исключения
создал отдельтый csv файл для теста FileBackedTaskManagerTest Написал тесты всех новых классов, Добавляя удаляя и получая задачи из запросов клиента.