Skip to content

Conversation

@sanhee
Copy link
Owner

@sanhee sanhee commented Aug 26, 2021

  • user/list 접근시 Cookie 헤더를 읽어서 logined=true가 있을 경우에 사용자 목록을 출력한다.

  • 만약, logined=true가 아니라면 로그인 페이지로 이동한다.

  • html 파일을 찾아주는 mapper method 정의

    • 현재는 viewResolver라고 정의돼있음.
    • 로그인이 필요한 경로인 경우 html 직접 접근시 cookie 여부에 따라 분기처리
  • RequestHandler 구조 리팩토링

            Request request = getRequest(in); // Request

            String responseMessage = requestController(request);

            Response response = Response.from(responseMessage); // Response

sanhee added 3 commits August 19, 2021 12:25
- user/list 접근시 Cookie 헤더를 읽어서 logined=true가 있을 경우에 사용자 목록을 출력한다.
- 만약, logined=true가 아니라면 로그인 페이지로 이동한다.
html을 찾는 로직이 중복되어, 메소드로 추출했습니다.
@sanhee sanhee requested a review from Dae-Hwa August 26, 2021 02:15
@sanhee sanhee self-assigned this Aug 26, 2021
Map<String, String> parameters = request.getRequestMessage().getHeader().getAttributes();
String Cookie = parameters.getOrDefault("Cookie", "empty");

if (loginRequired(path)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

접근은 괜찮은 것 같아요
그런데 너무 미래를 위한 코드가 아닐까 하는 생각도 한 편으로 드네요

}

File htmlFile = new File("./webapp" + path);
private String requestController(Request request) throws IOException {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이거도 좋네요
나중에 클래스로 분리도 가능할 것 같네요

@Dae-Hwa Dae-Hwa linked an issue Aug 26, 2021 that may be closed by this pull request
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HTTP 웹 서버 1단계 - 요구사항 6

3 participants