Git Product home page Git Product logo

jwp-was's Introduction

웹 애플리케이션 서버

1단계 - HTTP 웹 서버 구현

요구 사항

  • http://localhost:8080/index.html 로 접속했을 때 templatkes 디렉토리의 index.html 파일을 읽어 클라이언트에 응답한다
    • Request Header 읽는다.
    • Request Header에서 path 추출한다.
    • path에 해당하는 파일을 찾아 읽고 응답한다.
  • “회원가입” 메뉴를 클릭하면 http://localhost:8080/user/form.html 으로 이동하면서 회원가입할 수 있다. 회원가입을 하면 다음과 같은 형태로 사용자가 입력한 값이 서버에 전달된다.
/create?userId=javajigi&password=password&name=%EB%B0%95%EC%9E%AC%EC%84%B1&email=javajigi%40slipp.net
  • HTML과 URL을 비교해 보고 사용자가 입력한 값을 파싱한다.
  • 파싱한 값을 model.User 클래스에 저장한다.
  • 파싱한 User를 DataBase에 저장한다.
  • http://localhost:8080/user/form.html 파일의 form 태그 method를 get에서 post로 수정한 후 회원가입 기능이 정상적으로 동작하도록 구현한다.
    • form.html 파일의 form 태그 method를 get에서 post로 수정한다.
    • 요청 정보에서 Method를 추출한다.
    • Body에 담긴 파라미터를 추출해서 User 클래스에 저장한다.
  • “회원가입”을 완료하면 /index.html 페이지로 이동하고 싶다. 현재는 URL이 /user/create 로 유지되는 상태로 읽어서 전달할 파일이 없다. 따라서 redirect 방식처럼 회원가입을 완료한 후 “index.html”로 이동해야 한다. 즉, 브라우저의 URL이 /index.html로 변경해야 한다.
  • 지금까지 구현한 소스 코드는 stylesheet 파일을 지원하지 못하고 있다. Stylesheet 파일을 지원하도록 구현하도록 한다.
    • static 파일을 요청하는 경우인지 판단한다.
    • 응답 헤더에 Content-Type을 추가한다.

jwp-was's People

Contributors

chomily avatar pobiconan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.