diff --git a/.github/workflows/auto_merge.yml b/.github/workflows/auto_merge.yml new file mode 100644 index 000000000..0a18242ac --- /dev/null +++ b/.github/workflows/auto_merge.yml @@ -0,0 +1,138 @@ +name: "PR merge on time v3.3 by crong" + +on: + schedule: + - cron: "0 15 * * 1-3" # 월>화, 화>수, 수>목 자정(00:00) + - cron: "30 15 * * 1-3" # 월>화, 화>수, 수>목 00:30 + workflow_dispatch: + +permissions: + contents: write + pull-requests: write + issues: write + +jobs: + merge: + name: "Auto Merge on time" + runs-on: "ubuntu-latest" + + steps: + - name: "Merge pull request" + uses: "actions/github-script@v6" + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + const query = `query($owner:String!, $name:String!) { + repository(owner: $owner, name: $name) { + pullRequests(last: 100, states: OPEN) { + edges { + node { + number + headRefName + baseRefName + author { + login + } + repository { + name + } + mergeable + labels(first: 10) { + nodes { + name + } + } + reviews(last: 1) { + nodes { + state + } + } + } + } + } + } + }` + const variables = { + owner: context.repo.owner, + name: context.repo.repo, + } + const {repository:{pullRequests:{edges: list}}} = await github.graphql(query, variables) + for (let {node} of list) { + console.log("\n----------------------------------------"); + console.log(`PR #${node.number} 처리 시작`); + console.log(`PR node 정보: ${JSON.stringify(node, null, 2)}`); + if (node.baseRefName === "main" || !node.labels.nodes.length) { + console.log(`PR #${node.number}: main 브랜치이거나 라벨이 없음`); + try { + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: node.number, + body: "main 브랜치로 병합 시도 || 적절한 라벨이 있는지 확인해 주세요." + }); + console.log(`PR #${node.number}에 main브랜치 || 라벨없음 코멘트 추가 완료`); + } catch (e) { + console.log(`PR #${node.number}에 main브랜치 || 라벨없음 코멘트 추가 실패:`, e); + } + continue; + } + const hasSkipLabel = node.labels.nodes.some(label => label.name.toLowerCase() === 'review'); + if (hasSkipLabel) { + console.log(`PR #${node.number}: 'review' 라벨이 있어 병합 생략`); + continue; + } + if (node.reviews?.nodes?.[0]?.state === "CHANGES_REQUESTED") { + console.log(`PR #${node.number}: 변경 요청 상태, 병합 연기`); + try { + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: node.number, + body: "변경 요청 중인 브랜치의 머지를 연기합니다." + }); + console.log(`PR #${node.number}에 변경 요청 상태 코멘트 추가 완료`); + } catch (e) { + console.log(`PR #${node.number}에 변경 요청 상태 코멘트 추가 실패:`, e); + } + continue; + } + if (node.mergeable === "CONFLICTING") { + try { + console.log(`PR #${node.number}: 충돌상황 closed 처리 시작`); + + // PR 닫기 로직 + await github.rest.pulls.update({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: node.number, + state: "closed" + }); + console.log(`PR #${node.number} 충돌상황 closed 처리 완료`); + + // 충돌 코멘트 추가 + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: node.number, + body: "충돌로 인해 자동 병합이 불가능합니다." + }); + console.log(`PR #${node.number}에 충돌 코멘트 추가 완료`); + + } catch (e) { + console.log(`PR #${node.number}에 충돌 closed 처리 중 에러 발생:`, e); + } + } else { + console.log(`PR #${node.number} 병합 시작`); + try { + await github.rest.pulls.merge({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: node.number, + merge_method: "merge" + }); + console.log(`PR #${node.number} 병합 완료`); + } catch (e) { + console.log(`PR #${node.number} 병합 실패:`, e); + } + } + } diff --git a/.github/workflows/llm-code-review.yml b/.github/workflows/llm-code-review.yml new file mode 100644 index 000000000..ea0e34d74 --- /dev/null +++ b/.github/workflows/llm-code-review.yml @@ -0,0 +1,24 @@ +name: Claude Auto PR Review +on: + pull_request: + types: [opened, edited, synchronize] + +permissions: + contents: read + pull-requests: write + checks: write + id-token: write + +jobs: + review: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Simple LLM Code Review + uses: codingbaraGo/simple-llm-code-review@latest + with: + anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }} + language: korean \ No newline at end of file diff --git a/.gitignore b/.gitignore index 6fbb1a503..0f6653a77 100644 --- a/.gitignore +++ b/.gitignore @@ -123,6 +123,11 @@ fabric.properties # Mobile Tools for Java (J2ME) .mtj.tmp/ +### Custom Upload Files ### +# 프로젝트 내 업로드된 이미지 파일 제외 +**/static/uploads/* +/uploads/ + # Package Files # *.jar *.war diff --git a/README.md b/README.md index 8b6d6a688..b3effbb33 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ # be-was-2025 코드스쿼드 백엔드 교육용 WAS 2025 개정판 +## 학습 기록 +- [학습 Wiki 바로가기](https://github.com/shinminkyoung1/be-was/wiki) \ No newline at end of file diff --git a/build.gradle b/build.gradle index 25dd8fcb7..3fe8c247b 100644 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,8 @@ dependencies { implementation 'ch.qos.logback:logback-classic:1.2.3' testImplementation 'org.assertj:assertj-core:3.16.1' - + // h2 database + implementation 'com.h2database:h2:2.2.224' } test { diff --git a/db/jwp-was.lock.db b/db/jwp-was.lock.db new file mode 100644 index 000000000..070df3b32 --- /dev/null +++ b/db/jwp-was.lock.db @@ -0,0 +1,6 @@ +#FileLock +#Fri Jan 16 13:48:25 KST 2026 +server=localhost\:49707 +hostName=localhost +method=file +id=19bc5126dc59a1e993ea0de86029c70ff00912b1a1b diff --git a/db/jwp-was.mv.db b/db/jwp-was.mv.db new file mode 100644 index 000000000..7043ab5e9 Binary files /dev/null and b/db/jwp-was.mv.db differ diff --git a/db/jwp-was.trace.db b/db/jwp-was.trace.db new file mode 100644 index 000000000..36549d363 --- /dev/null +++ b/db/jwp-was.trace.db @@ -0,0 +1,80 @@ +2026-01-16 11:02:22.798440+09:00 jdbc[3]: exception +org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "ARTICLE" not found (this database is empty); SQL statement: +SELECT * FROM ARTICLE WHERE id = ? [42104-224] +2026-01-16 11:02:38.098359+09:00 jdbc[3]: exception +org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "USERS" not found (this database is empty); SQL statement: +SELECT * FROM USERS WHERE userId = ? [42104-224] +2026-01-16 11:04:58.715530+09:00 jdbc[3]: exception +org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "USERS" not found (this database is empty); SQL statement: +SELECT * FROM USERS WHERE userId = ? [42104-224] +2026-01-16 11:04:58.851620+09:00 jdbc[3]: exception +org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "USERS" not found (this database is empty); SQL statement: +SELECT * FROM USERS WHERE userId = ? [42104-224] +2026-01-16 11:04:58.962955+09:00 jdbc[3]: exception +org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "USERS" not found (this database is empty); SQL statement: +SELECT * FROM USERS WHERE userId = ? [42104-224] +2026-01-16 11:05:03.739660+09:00 jdbc[3]: exception +org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "USERS" not found (this database is empty); SQL statement: +SELECT * FROM USERS WHERE userId = ? [42104-224] +2026-01-16 11:05:03.887840+09:00 jdbc[3]: exception +org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "USERS" not found (this database is empty); SQL statement: +SELECT * FROM USERS WHERE userId = ? [42104-224] +2026-01-16 11:05:04.010547+09:00 jdbc[3]: exception +org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "USERS" not found (this database is empty); SQL statement: +SELECT * FROM USERS WHERE userId = ? [42104-224] +2026-01-16 11:11:53.554822+09:00 jdbc[3]: exception +org.h2.jdbc.JdbcSQLSyntaxErrorException: Column "TITLE" not found; SQL statement: +INSERT INTO ARTICLE (writer, title, contents, imagePath) VALUES (?, ?, ?, ?) [42122-224] + at org.h2.message.DbException.getJdbcSQLException(DbException.java:514) + at org.h2.message.DbException.getJdbcSQLException(DbException.java:489) + at org.h2.message.DbException.get(DbException.java:223) + at org.h2.message.DbException.get(DbException.java:199) + at org.h2.table.Table.getColumn(Table.java:759) + at org.h2.command.Parser.parseColumn(Parser.java:1190) + at org.h2.command.Parser.parseColumnList(Parser.java:1175) + at org.h2.command.Parser.parseInsert(Parser.java:1549) + at org.h2.command.Parser.parsePrepared(Parser.java:719) + at org.h2.command.Parser.parse(Parser.java:592) + at org.h2.command.Parser.parse(Parser.java:564) + at org.h2.command.Parser.prepareCommand(Parser.java:483) + at org.h2.engine.SessionLocal.prepareLocal(SessionLocal.java:639) + at org.h2.engine.SessionLocal.prepareCommand(SessionLocal.java:559) + at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1166) + at org.h2.jdbc.JdbcPreparedStatement.(JdbcPreparedStatement.java:93) + at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:316) + at db.ArticleDao.insert(ArticleDao.java:19) + at webserver.handler.ArticleWriteHandler.process(ArticleWriteHandler.java:71) + at webserver.RequestHandler.run(RequestHandler.java:56) + at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) + at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) + at java.base/java.lang.Thread.run(Thread.java:840) +2026-01-16 13:31:13.101146+09:00 database: wrong user or password; user: "APPLE" +org.h2.message.DbException: Wrong user name or password [28000-240] + at org.h2.message.DbException.get(DbException.java:223) + at org.h2.message.DbException.get(DbException.java:199) + at org.h2.message.DbException.get(DbException.java:188) + at org.h2.engine.Engine.openSession(Engine.java:154) + at org.h2.engine.Engine.openSession(Engine.java:222) + at org.h2.engine.Engine.createSession(Engine.java:201) + at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:350) + at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:124) + at org.h2.util.JdbcUtils.getConnection(JdbcUtils.java:291) + at org.h2.server.web.WebServer.getConnection(WebServer.java:811) + at org.h2.server.web.WebApp.login(WebApp.java:1038) + at org.h2.server.web.WebApp.process(WebApp.java:226) + at org.h2.server.web.WebApp.processRequest(WebApp.java:176) + at org.h2.server.web.WebThread.process(WebThread.java:154) + at org.h2.server.web.WebThread.run(WebThread.java:103) + at java.base/java.lang.Thread.run(Thread.java:840) +Caused by: org.h2.jdbc.JdbcSQLInvalidAuthorizationSpecException: Wrong user name or password [28000-240] + at org.h2.message.DbException.getJdbcSQLException(DbException.java:522) + at org.h2.message.DbException.getJdbcSQLException(DbException.java:489) + ... 16 more +2026-01-16 13:31:36.992704+09:00 jdbc[3]: exception +org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement "delete from ARTICLE\000d\000awhere id [*]4 and 6"; SQL statement: +delete from ARTICLE +where id 4 and 6 [42000-240] +2026-01-16 13:31:41.041881+09:00 jdbc[3]: exception +org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement "delete from ARTICLE\000d\000awhere id in [*]4 and 6"; expected "("; SQL statement: +delete from ARTICLE +where id in 4 and 6 [42001-240] diff --git a/docs/allclasses-index.html b/docs/allclasses-index.html new file mode 100644 index 000000000..3634c7bfb --- /dev/null +++ b/docs/allclasses-index.html @@ -0,0 +1,147 @@ + + + + +All Classes and Interfaces + + + + + + + + + + + + + + + +
+ +
+
+
+

All Classes and Interfaces

+
+
+
+
+
+
Class
+
Description
+ +
 
+ +
 
+ +
 
+ +
 
+ +
+
게시글 작성 요청을 처리하는 핸들러 클래스 + 사용자가 입력한 게시글 데이터와 업로드된 이미지를 저장
+
+ +
 
+ +
 
+ +
 
+ +
 
+ +
 
+ +
 
+ +
 
+ +
 
+ +
 
+ +
 
+ +
 
+ +
 
+ +
 
+ +
 
+ +
 
+ +
 
+ +
 
+ +
 
+ +
 
+ +
 
+ +
 
+ +
 
+ +
 
+ +
 
+ +
 
+ +
 
+ +
 
+ +
 
+ +
 
+ +
 
+ +
 
+ +
 
+
+
+
+
+
+
+ + diff --git a/docs/allpackages-index.html b/docs/allpackages-index.html new file mode 100644 index 000000000..d05f83536 --- /dev/null +++ b/docs/allpackages-index.html @@ -0,0 +1,78 @@ + + + + +All Packages + + + + + + + + + + + + + + + +
+ +
+
+
+

All Packages

+
+
Package Summary
+
+
Package
+
Description
+ +
 
+ +
 
+ +
 
+ +
 
+ +
 
+ +
 
+ +
 
+ +
 
+
+
+
+
+ + diff --git a/docs/constant-values.html b/docs/constant-values.html new file mode 100644 index 000000000..6c9246793 --- /dev/null +++ b/docs/constant-values.html @@ -0,0 +1,115 @@ + + + + +Constant Field Values + + + + + + + + + + + + + + + +
+ +
+
+
+

Constant Field Values

+
+

Contents

+ +
+
+
+

webserver.config.*

+ +
+
+
+
+ + diff --git a/docs/db/ArticleDao.html b/docs/db/ArticleDao.html new file mode 100644 index 000000000..e9014065a --- /dev/null +++ b/docs/db/ArticleDao.html @@ -0,0 +1,185 @@ + + + + +ArticleDao + + + + + + + + + + + + + + + +
+ +
+
+ +
+
Package db
+

Class ArticleDao

+
+
java.lang.Object +
db.ArticleDao
+
+
+
+
public class ArticleDao +extends Object
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      ArticleDao

      +
      public ArticleDao()
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      insert

      +
      public void insert(Article article)
      +
      +
    • +
    • +
      +

      selectAll

      +
      public List<Article> selectAll()
      +
      +
    • +
    • +
      +

      selectLatest

      +
      public Article selectLatest()
      +
      +
    • +
    • +
      +

      updateLikeCount

      +
      public void updateLikeCount(Long id)
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+
+ + diff --git a/docs/db/ConnectionManager.html b/docs/db/ConnectionManager.html new file mode 100644 index 000000000..44ea8db98 --- /dev/null +++ b/docs/db/ConnectionManager.html @@ -0,0 +1,158 @@ + + + + +ConnectionManager + + + + + + + + + + + + + + + +
+ +
+
+ +
+
Package db
+

Class ConnectionManager

+
+
java.lang.Object +
db.ConnectionManager
+
+
+
+
public class ConnectionManager +extends Object
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      ConnectionManager

      +
      public ConnectionManager()
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      getConnection

      +
      public static Connection getConnection()
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+
+ + diff --git a/docs/db/Database.html b/docs/db/Database.html new file mode 100644 index 000000000..db8520022 --- /dev/null +++ b/docs/db/Database.html @@ -0,0 +1,176 @@ + + + + +Database + + + + + + + + + + + + + + + +
+ +
+
+ +
+
Package db
+

Class Database

+
+
java.lang.Object +
db.Database
+
+
+
+
public class Database +extends Object
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      Database

      +
      public Database()
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      addUser

      +
      public void addUser(User user)
      +
      +
    • +
    • +
      +

      findUserById

      +
      public User findUserById(String userId)
      +
      +
    • +
    • +
      +

      findAll

      +
      public Collection<User> findAll()
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+
+ + diff --git a/docs/db/SessionDatabase.html b/docs/db/SessionDatabase.html new file mode 100644 index 000000000..f1bdfefd4 --- /dev/null +++ b/docs/db/SessionDatabase.html @@ -0,0 +1,187 @@ + + + + +SessionDatabase + + + + + + + + + + + + + + + +
+ +
+
+ +
+
Package db
+

Class SessionDatabase

+
+
java.lang.Object +
db.SessionDatabase
+
+
+
+
public class SessionDatabase +extends Object
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      SessionDatabase

      +
      public SessionDatabase()
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    + +
    +
  • +
+
+ +
+
+
+ + diff --git a/docs/db/SessionEntry.html b/docs/db/SessionEntry.html new file mode 100644 index 000000000..c43fbc320 --- /dev/null +++ b/docs/db/SessionEntry.html @@ -0,0 +1,186 @@ + + + + +SessionEntry + + + + + + + + + + + + + + + +
+ +
+
+ +
+
Package db
+

Class SessionEntry

+
+
java.lang.Object +
db.SessionEntry
+
+
+
+
public class SessionEntry +extends Object
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      SessionEntry

      +
      public SessionEntry(String userId)
      +
      +
    • +
    • +
      +

      SessionEntry

      +
      public SessionEntry(String userId, + LocalDateTime lastAccessTime)
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      getUserId

      +
      public String getUserId()
      +
      +
    • +
    • +
      +

      getLastAccessTime

      +
      public LocalDateTime getLastAccessTime()
      +
      +
    • +
    • +
      +

      updateLastAccessedTime

      +
      public void updateLastAccessedTime()
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+
+ + diff --git a/docs/db/UserDao.html b/docs/db/UserDao.html new file mode 100644 index 000000000..a611baeff --- /dev/null +++ b/docs/db/UserDao.html @@ -0,0 +1,176 @@ + + + + +UserDao + + + + + + + + + + + + + + + +
+ +
+
+ +
+
Package db
+

Class UserDao

+
+
java.lang.Object +
db.UserDao
+
+
+
+
public class UserDao +extends Object
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      UserDao

      +
      public UserDao()
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      insert

      +
      public void insert(User user)
      +
      +
    • +
    • +
      +

      findUserById

      +
      public User findUserById(String userId)
      +
      +
    • +
    • +
      +

      update

      +
      public void update(User user)
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+
+ + diff --git a/docs/db/package-summary.html b/docs/db/package-summary.html new file mode 100644 index 000000000..6b8505502 --- /dev/null +++ b/docs/db/package-summary.html @@ -0,0 +1,92 @@ + + + + +db + + + + + + + + + + + + + + + +
+ +
+
+
+

Package db

+
+
+
package db
+
+ +
+
+
+
+ + diff --git a/docs/db/package-tree.html b/docs/db/package-tree.html new file mode 100644 index 000000000..3da9223e5 --- /dev/null +++ b/docs/db/package-tree.html @@ -0,0 +1,76 @@ + + + + +db Class Hierarchy + + + + + + + + + + + + + + + +
+ +
+
+
+

Hierarchy For Package db

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+
+
+
+ + diff --git a/docs/element-list b/docs/element-list new file mode 100644 index 000000000..e942377b8 --- /dev/null +++ b/docs/element-list @@ -0,0 +1,8 @@ +db +exception +model +utils +webserver +webserver.config +webserver.handler +webserver.http diff --git a/docs/exception/WebsServerException.html b/docs/exception/WebsServerException.html new file mode 100644 index 000000000..4a132f241 --- /dev/null +++ b/docs/exception/WebsServerException.html @@ -0,0 +1,181 @@ + + + + +WebsServerException + + + + + + + + + + + + + + + +
+ +
+
+ +
+
Package exception
+

Class WebsServerException

+
+ +
+
+
All Implemented Interfaces:
+
Serializable
+
+
+
public class WebsServerException +extends RuntimeException
+
+
See Also:
+
+ +
+
+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      WebsServerException

      +
      public WebsServerException(HttpStatus status, + String message)
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      getStatus

      +
      public HttpStatus getStatus()
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+
+ + diff --git a/docs/exception/package-summary.html b/docs/exception/package-summary.html new file mode 100644 index 000000000..091ba621a --- /dev/null +++ b/docs/exception/package-summary.html @@ -0,0 +1,82 @@ + + + + +exception + + + + + + + + + + + + + + + +
+ +
+
+
+

Package exception

+
+
+
package exception
+
+ +
+
+
+
+ + diff --git a/docs/exception/package-tree.html b/docs/exception/package-tree.html new file mode 100644 index 000000000..8ae8834f6 --- /dev/null +++ b/docs/exception/package-tree.html @@ -0,0 +1,83 @@ + + + + +exception Class Hierarchy + + + + + + + + + + + + + + + +
+ +
+
+
+

Hierarchy For Package exception

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+
+
+
+ + diff --git a/docs/help-doc.html b/docs/help-doc.html new file mode 100644 index 000000000..4213ca7be --- /dev/null +++ b/docs/help-doc.html @@ -0,0 +1,186 @@ + + + + +API Help + + + + + + + + + + + + + + + +
+ +
+
+

JavaDoc Help

+ +
+
+

Navigation

+Starting from the Overview page, you can browse the documentation using the links in each page, and in the navigation bar at the top of each page. The Index and Search box allow you to navigate to specific declarations and summary pages, including: All Packages, All Classes and Interfaces + +
+
+
+

Kinds of Pages

+The following sections describe the different kinds of pages in this collection. +
+

Overview

+

The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

+
+
+

Package

+

Each package has a page that contains a list of its classes and interfaces, with a summary for each. These pages may contain the following categories:

+
    +
  • Interfaces
  • +
  • Classes
  • +
  • Enum Classes
  • +
  • Exceptions
  • +
  • Errors
  • +
  • Annotation Interfaces
  • +
+
+
+

Class or Interface

+

Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a declaration and description, member summary tables, and detailed member descriptions. Entries in each of these sections are omitted if they are empty or not applicable.

+
    +
  • Class Inheritance Diagram
  • +
  • Direct Subclasses
  • +
  • All Known Subinterfaces
  • +
  • All Known Implementing Classes
  • +
  • Class or Interface Declaration
  • +
  • Class or Interface Description
  • +
+
+
    +
  • Nested Class Summary
  • +
  • Enum Constant Summary
  • +
  • Field Summary
  • +
  • Property Summary
  • +
  • Constructor Summary
  • +
  • Method Summary
  • +
  • Required Element Summary
  • +
  • Optional Element Summary
  • +
+
+
    +
  • Enum Constant Details
  • +
  • Field Details
  • +
  • Property Details
  • +
  • Constructor Details
  • +
  • Method Details
  • +
  • Element Details
  • +
+

Note: Annotation interfaces have required and optional elements, but not methods. Only enum classes have enum constants. The components of a record class are displayed as part of the declaration of the record class. Properties are a feature of JavaFX.

+

The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

+
+
+

Other Files

+

Packages and modules may contain pages with additional information related to the declarations nearby.

+
+
+

Tree (Class Hierarchy)

+

There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. Classes are organized by inheritance structure starting with java.lang.Object. Interfaces do not inherit from java.lang.Object.

+
    +
  • When viewing the Overview page, clicking on TREE displays the hierarchy for all packages.
  • +
  • When viewing a particular package, class or interface page, clicking on TREE displays the hierarchy for only that package.
  • +
+
+
+

Constant Field Values

+

The Constant Field Values page lists the static final fields and their values.

+
+
+

Serialized Form

+

Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to those who implement rather than use the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See Also" section of the class description.

+
+
+

All Packages

+

The All Packages page contains an alphabetic index of all packages contained in the documentation.

+
+
+

All Classes and Interfaces

+

The All Classes and Interfaces page contains an alphabetic index of all classes and interfaces contained in the documentation, including annotation interfaces, enum classes, and record classes.

+
+
+

Index

+

The Index contains an alphabetic index of all classes, interfaces, constructors, methods, and fields in the documentation, as well as summary pages such as All Packages, All Classes and Interfaces.

+
+
+
+This help file applies to API documentation generated by the standard doclet.
+
+
+ + diff --git a/docs/index-files/index-1.html b/docs/index-files/index-1.html new file mode 100644 index 000000000..376c57599 --- /dev/null +++ b/docs/index-files/index-1.html @@ -0,0 +1,94 @@ + + + + +A-Index + + + + + + + + + + + + + + + +
+ +
+
+
+

Index

+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form +

A

+
+
addHeader(String, String) - Method in class webserver.HttpResponse
+
 
+
addUser(User) - Method in class db.Database
+
 
+
AppConfig - Class in webserver.config
+
 
+
AppConfig() - Constructor for class webserver.config.AppConfig
+
 
+
Article - Record Class in model
+
 
+
Article(Long, String, String, String, LocalDateTime, String, Integer) - Constructor for record class model.Article
+
+
Creates an instance of a Article record class.
+
+
Article(String, String, String, String) - Constructor for record class model.Article
+
 
+
ARTICLE_PAGE - Static variable in class webserver.config.Config
+
 
+
ArticleDao - Class in db
+
 
+
ArticleDao() - Constructor for class db.ArticleDao
+
 
+
ArticleIndexHandler - Class in webserver.handler
+
 
+
ArticleIndexHandler(ArticleDao, UserDao) - Constructor for class webserver.handler.ArticleIndexHandler
+
 
+
ArticleWriteHandler - Class in webserver.handler
+
+
게시글 작성 요청을 처리하는 핸들러 클래스 + 사용자가 입력한 게시글 데이터와 업로드된 이미지를 저장
+
+
ArticleWriteHandler(ArticleDao, UserDao) - Constructor for class webserver.handler.ArticleWriteHandler
+
 
+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form
+
+
+ + diff --git a/docs/index-files/index-10.html b/docs/index-files/index-10.html new file mode 100644 index 000000000..6b1269d3a --- /dev/null +++ b/docs/index-files/index-10.html @@ -0,0 +1,65 @@ + + + + +J-Index + + + + + + + + + + + + + + + +
+ +
+
+
+

Index

+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form +

J

+
+
JPG - Enum constant in enum class webserver.config.MimeType
+
 
+
JS - Enum constant in enum class webserver.config.MimeType
+
 
+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form
+
+
+ + diff --git a/docs/index-files/index-11.html b/docs/index-files/index-11.html new file mode 100644 index 000000000..6cd8f857b --- /dev/null +++ b/docs/index-files/index-11.html @@ -0,0 +1,63 @@ + + + + +K-Index + + + + + + + + + + + + + + + +
+ +
+
+
+

Index

+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form +

K

+
+
key - Variable in class webserver.config.Pair
+
 
+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form
+
+
+ + diff --git a/docs/index-files/index-12.html b/docs/index-files/index-12.html new file mode 100644 index 000000000..2bd735efd --- /dev/null +++ b/docs/index-files/index-12.html @@ -0,0 +1,83 @@ + + + + +L-Index + + + + + + + + + + + + + + + +
+ +
+
+
+

Index

+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form +

L

+
+
likeCount() - Method in record class model.Article
+
+
Returns the value of the likeCount record component.
+
+
LikeHandler - Class in webserver.handler
+
 
+
LikeHandler(ArticleDao) - Constructor for class webserver.handler.LikeHandler
+
 
+
logger - Static variable in class webserver.handler.UserRequestHandler
+
 
+
logger - Static variable in class webserver.HttpResponse
+
 
+
LOGIN_PAGE - Static variable in class webserver.config.Config
+
 
+
LoginRequestHandler - Class in webserver.handler
+
 
+
LoginRequestHandler(UserDao) - Constructor for class webserver.handler.LoginRequestHandler
+
 
+
LogoutRequestHandler - Class in webserver.handler
+
 
+
LogoutRequestHandler(UserDao) - Constructor for class webserver.handler.LogoutRequestHandler
+
 
+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form
+
+
+ + diff --git a/docs/index-files/index-13.html b/docs/index-files/index-13.html new file mode 100644 index 000000000..7df961ebb --- /dev/null +++ b/docs/index-files/index-13.html @@ -0,0 +1,87 @@ + + + + +M-Index + + + + + + + + + + + + + + + +
+ +
+
+
+

Index

+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form +

M

+
+
main(String[]) - Static method in class webserver.WebServer
+
 
+
MAIN_PAGE - Static variable in class webserver.config.Config
+
 
+
METHOD_NOT_ALLOWED - Enum constant in enum class webserver.config.HttpStatus
+
 
+
MimeType - Enum Class in webserver.config
+
 
+
MimeTypeTest - Class in webserver
+
 
+
MimeTypeTest() - Constructor for class webserver.MimeTypeTest
+
 
+
model - package model
+
 
+
MultipartPart - Record Class in model
+
 
+
MultipartPart(String, String, String, byte[]) - Constructor for record class model.MultipartPart
+
+
Creates an instance of a MultipartPart record class.
+
+
MY_PAGE - Static variable in class webserver.config.Config
+
 
+
MyPageHandler - Class in webserver.handler
+
 
+
MyPageHandler(UserDao) - Constructor for class webserver.handler.MyPageHandler
+
 
+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form
+
+
+ + diff --git a/docs/index-files/index-14.html b/docs/index-files/index-14.html new file mode 100644 index 000000000..dba523696 --- /dev/null +++ b/docs/index-files/index-14.html @@ -0,0 +1,71 @@ + + + + +N-Index + + + + + + + + + + + + + + + +
+ +
+
+
+

Index

+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form +

N

+
+
name() - Method in record class model.MultipartPart
+
+
Returns the value of the name record component.
+
+
name() - Method in record class model.User
+
+
Returns the value of the name record component.
+
+
NOT_FOUND - Enum constant in enum class webserver.config.HttpStatus
+
 
+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form
+
+
+ + diff --git a/docs/index-files/index-15.html b/docs/index-files/index-15.html new file mode 100644 index 000000000..5bf4b3610 --- /dev/null +++ b/docs/index-files/index-15.html @@ -0,0 +1,63 @@ + + + + +O-Index + + + + + + + + + + + + + + + +
+ +
+
+
+

Index

+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form +

O

+
+
OK - Enum constant in enum class webserver.config.HttpStatus
+
 
+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form
+
+
+ + diff --git a/docs/index-files/index-16.html b/docs/index-files/index-16.html new file mode 100644 index 000000000..35228e8e5 --- /dev/null +++ b/docs/index-files/index-16.html @@ -0,0 +1,120 @@ + + + + +P-Index + + + + + + + + + + + + + + + +
+ +
+
+
+

Index

+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form +

P

+
+
PageRender - Class in webserver
+
 
+
PageRender() - Constructor for class webserver.PageRender
+
 
+
Pair - Class in webserver.config
+
 
+
Pair(String, String) - Constructor for class webserver.config.Pair
+
 
+
parseCookies(String) - Static method in class utils.HttpRequestUtils
+
 
+
parseHeader(String) - Static method in class utils.HttpRequestUtils
+
 
+
parseMultipartBody(byte[], String) - Static method in class utils.HttpRequestUtils
+
 
+
parseParameters(String) - Static method in class utils.HttpRequestUtils
+
 
+
parsePath(String) - Static method in class utils.HttpRequestUtils
+
 
+
parseQueryString(String) - Static method in class utils.HttpRequestUtils
+
 
+
parseUrl(String) - Static method in class utils.HttpRequestUtils
+
 
+
password() - Method in record class model.User
+
+
Returns the value of the password record component.
+
+
PNG - Enum constant in enum class webserver.config.MimeType
+
 
+
preHandler(String, User) - Static method in class webserver.SecurityInterceptor
+
 
+
process(HttpRequest, HttpResponse) - Method in class webserver.handler.ArticleIndexHandler
+
 
+
process(HttpRequest, HttpResponse) - Method in class webserver.handler.ArticleWriteHandler
+
+
게시글 작성 요청을 처리하여 DB에 저장하고 메인 페이지로 리다이렉트 + * @param request 클라이언트의 HTTP 요청 정보 객체
+
+
process(HttpRequest, HttpResponse) - Method in interface webserver.handler.Handler
+
 
+
process(HttpRequest, HttpResponse) - Method in class webserver.handler.LikeHandler
+
 
+
process(HttpRequest, HttpResponse) - Method in class webserver.handler.LoginRequestHandler
+
 
+
process(HttpRequest, HttpResponse) - Method in class webserver.handler.LogoutRequestHandler
+
 
+
process(HttpRequest, HttpResponse) - Method in class webserver.handler.MyPageHandler
+
 
+
process(HttpRequest, HttpResponse) - Method in class webserver.handler.ProfileUpdateHandler
+
 
+
process(HttpRequest, HttpResponse) - Method in class webserver.handler.UserRequestHandler
+
 
+
profileImage() - Method in record class model.User
+
+
Returns the value of the profileImage record component.
+
+
ProfileUpdateHandler - Class in webserver.handler
+
 
+
ProfileUpdateHandler(UserDao) - Constructor for class webserver.handler.ProfileUpdateHandler
+
 
+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form
+
+
+ + diff --git a/docs/index-files/index-17.html b/docs/index-files/index-17.html new file mode 100644 index 000000000..a5fe2383c --- /dev/null +++ b/docs/index-files/index-17.html @@ -0,0 +1,87 @@ + + + + +R-Index + + + + + + + + + + + + + + + +
+ +
+
+
+

Index

+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form +

R

+
+
readData(BufferedReader, int) - Static method in class utils.IOUtils
+
 
+
REGISTRATION_PAGE - Static variable in class webserver.config.Config
+
 
+
remove(String) - Static method in class db.SessionDatabase
+
 
+
render(String, Map<String, String>) - Static method in class webserver.TemplateEngine
+
 
+
renderArticleList(List<Article>, UserDao) - Static method in class webserver.PageRender
+
 
+
renderHeader(User) - Static method in class webserver.PageRender
+
 
+
renderLatestArticle(Article, User, int) - Static method in class webserver.PageRender
+
 
+
renderProfile(User) - Static method in class webserver.PageRender
+
 
+
RequestHandler - Class in webserver
+
 
+
RequestHandler(Socket, RouteGuide, UserDao) - Constructor for class webserver.RequestHandler
+
 
+
RouteGuide - Class in webserver.handler
+
 
+
RouteGuide(Map<String, Handler>) - Constructor for class webserver.handler.RouteGuide
+
 
+
run() - Method in class webserver.RequestHandler
+
 
+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form
+
+
+ + diff --git a/docs/index-files/index-18.html b/docs/index-files/index-18.html new file mode 100644 index 000000000..fdb4a1468 --- /dev/null +++ b/docs/index-files/index-18.html @@ -0,0 +1,99 @@ + + + + +S-Index + + + + + + + + + + + + + + + +
+ +
+
+
+

Index

+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form +

S

+
+
save(String, SessionEntry) - Static method in class db.SessionDatabase
+
 
+
SecurityInterceptor - Class in webserver
+
 
+
SecurityInterceptor() - Constructor for class webserver.SecurityInterceptor
+
 
+
selectAll() - Method in class db.ArticleDao
+
 
+
selectLatest() - Method in class db.ArticleDao
+
 
+
sendError(HttpStatus) - Method in class webserver.HttpResponse
+
 
+
sendHtmlContent(String) - Method in class webserver.HttpResponse
+
 
+
sendRedirect(String) - Method in class webserver.HttpResponse
+
 
+
SessionDatabase - Class in db
+
 
+
SessionDatabase() - Constructor for class db.SessionDatabase
+
 
+
SessionEntry - Class in db
+
 
+
SessionEntry(String) - Constructor for class db.SessionEntry
+
 
+
SessionEntry(String, LocalDateTime) - Constructor for class db.SessionEntry
+
 
+
SessionManager - Class in webserver
+
 
+
SessionManager() - Constructor for class webserver.SessionManager
+
 
+
SessionManagerTest - Class in webserver.http
+
 
+
SessionManagerTest() - Constructor for class webserver.http.SessionManagerTest
+
 
+
STATIC_RESOURCE_PATH - Static variable in class webserver.config.Config
+
 
+
SVG - Enum constant in enum class webserver.config.MimeType
+
 
+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form
+
+
+ + diff --git a/docs/index-files/index-19.html b/docs/index-files/index-19.html new file mode 100644 index 000000000..60bde64f4 --- /dev/null +++ b/docs/index-files/index-19.html @@ -0,0 +1,83 @@ + + + + +T-Index + + + + + + + + + + + + + + + +
+ +
+
+
+

Index

+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form +

T

+
+
TemplateEngine - Class in webserver
+
 
+
TemplateEngine() - Constructor for class webserver.TemplateEngine
+
 
+
title() - Method in record class model.Article
+
+
Returns the value of the title record component.
+
+
toString() - Method in record class model.Article
+
+
Returns a string representation of this record class.
+
+
toString() - Method in record class model.MultipartPart
+
+
Returns a string representation of this record class.
+
+
toString() - Method in record class model.User
+
+
Returns a string representation of this record class.
+
+
toString() - Method in enum class webserver.config.HttpStatus
+
 
+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form
+
+
+ + diff --git a/docs/index-files/index-2.html b/docs/index-files/index-2.html new file mode 100644 index 000000000..42ec79524 --- /dev/null +++ b/docs/index-files/index-2.html @@ -0,0 +1,63 @@ + + + + +B-Index + + + + + + + + + + + + + + + +
+ +
+
+
+

Index

+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form +

B

+
+
BAD_REQUEST - Enum constant in enum class webserver.config.HttpStatus
+
 
+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form
+
+
+ + diff --git a/docs/index-files/index-20.html b/docs/index-files/index-20.html new file mode 100644 index 000000000..af4f1671e --- /dev/null +++ b/docs/index-files/index-20.html @@ -0,0 +1,89 @@ + + + + +U-Index + + + + + + + + + + + + + + + +
+ +
+
+
+

Index

+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form +

U

+
+
update(User) - Method in class db.UserDao
+
 
+
updateLastAccessedTime() - Method in class db.SessionEntry
+
 
+
updateLikeCount(Long) - Method in class db.ArticleDao
+
 
+
User - Record Class in model
+
 
+
User(String, String, String, String, String) - Constructor for record class model.User
+
+
Creates an instance of a User record class.
+
+
UserDao - Class in db
+
 
+
UserDao() - Constructor for class db.UserDao
+
 
+
userId() - Method in record class model.User
+
+
Returns the value of the userId record component.
+
+
UserRequestHandler - Class in webserver.handler
+
 
+
UserRequestHandler(UserDao) - Constructor for class webserver.handler.UserRequestHandler
+
 
+
UTF_8 - Static variable in class webserver.config.Config
+
 
+
utils - package utils
+
 
+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form
+
+
+ + diff --git a/docs/index-files/index-21.html b/docs/index-files/index-21.html new file mode 100644 index 000000000..285bcb3a9 --- /dev/null +++ b/docs/index-files/index-21.html @@ -0,0 +1,81 @@ + + + + +V-Index + + + + + + + + + + + + + + + +
+ +
+
+
+

Index

+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form +

V

+
+
value - Variable in class webserver.config.Pair
+
 
+
valueOf(String) - Static method in enum class webserver.config.HttpStatus
+
+
Returns the enum constant of this class with the specified name.
+
+
valueOf(String) - Static method in enum class webserver.config.MimeType
+
+
Returns the enum constant of this class with the specified name.
+
+
values() - Static method in enum class webserver.config.HttpStatus
+
+
Returns an array containing the constants of this enum class, in +the order they are declared.
+
+
values() - Static method in enum class webserver.config.MimeType
+
+
Returns an array containing the constants of this enum class, in +the order they are declared.
+
+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form
+
+
+ + diff --git a/docs/index-files/index-22.html b/docs/index-files/index-22.html new file mode 100644 index 000000000..067a873ca --- /dev/null +++ b/docs/index-files/index-22.html @@ -0,0 +1,81 @@ + + + + +W-Index + + + + + + + + + + + + + + + +
+ +
+
+
+

Index

+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form +

W

+
+
webserver - package webserver
+
 
+
WebServer - Class in webserver
+
 
+
WebServer() - Constructor for class webserver.WebServer
+
 
+
webserver.config - package webserver.config
+
 
+
webserver.handler - package webserver.handler
+
 
+
webserver.http - package webserver.http
+
 
+
WebsServerException - Exception in exception
+
 
+
WebsServerException(HttpStatus, String) - Constructor for exception exception.WebsServerException
+
 
+
writer() - Method in record class model.Article
+
+
Returns the value of the writer record component.
+
+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form
+
+
+ + diff --git a/docs/index-files/index-3.html b/docs/index-files/index-3.html new file mode 100644 index 000000000..67ab6e3e4 --- /dev/null +++ b/docs/index-files/index-3.html @@ -0,0 +1,87 @@ + + + + +C-Index + + + + + + + + + + + + + + + +
+ +
+
+
+

Index

+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form +

C

+
+
Config - Class in webserver.config
+
 
+
Config() - Constructor for class webserver.config.Config
+
 
+
ConnectionManager - Class in db
+
 
+
ConnectionManager() - Constructor for class db.ConnectionManager
+
 
+
contents() - Method in record class model.Article
+
+
Returns the value of the contents record component.
+
+
contentType() - Method in record class model.MultipartPart
+
+
Returns the value of the contentType record component.
+
+
createdAt() - Method in record class model.Article
+
+
Returns the value of the createdAt record component.
+
+
createSession(User) - Static method in class webserver.SessionManager
+
 
+
CRLF - Static variable in class webserver.config.Config
+
 
+
CSS - Enum constant in enum class webserver.config.MimeType
+
 
+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form
+
+
+ + diff --git a/docs/index-files/index-4.html b/docs/index-files/index-4.html new file mode 100644 index 000000000..a261e02b0 --- /dev/null +++ b/docs/index-files/index-4.html @@ -0,0 +1,81 @@ + + + + +D-Index + + + + + + + + + + + + + + + +
+ +
+
+
+

Index

+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form +

D

+
+
data() - Method in record class model.MultipartPart
+
+
Returns the value of the data record component.
+
+
Database - Class in db
+
 
+
Database() - Constructor for class db.Database
+
 
+
db - package db
+
 
+
DB_PW - Static variable in class webserver.config.Config
+
 
+
DB_URL - Static variable in class webserver.config.Config
+
 
+
DB_USER - Static variable in class webserver.config.Config
+
 
+
DEFAULT - Enum constant in enum class webserver.config.MimeType
+
 
+
DEFAULT_PAGE - Static variable in class webserver.config.Config
+
 
+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form
+
+
+ + diff --git a/docs/index-files/index-5.html b/docs/index-files/index-5.html new file mode 100644 index 000000000..e8f0a3fe5 --- /dev/null +++ b/docs/index-files/index-5.html @@ -0,0 +1,79 @@ + + + + +E-Index + + + + + + + + + + + + + + + +
+ +
+
+
+

Index

+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form +

E

+
+
email() - Method in record class model.User
+
+
Returns the value of the email record component.
+
+
equals(Object) - Method in record class model.Article
+
+
Indicates whether some other object is "equal to" this one.
+
+
equals(Object) - Method in record class model.MultipartPart
+
+
Indicates whether some other object is "equal to" this one.
+
+
equals(Object) - Method in record class model.User
+
+
Indicates whether some other object is "equal to" this one.
+
+
exception - package exception
+
 
+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form
+
+
+ + diff --git a/docs/index-files/index-6.html b/docs/index-files/index-6.html new file mode 100644 index 000000000..f09f27398 --- /dev/null +++ b/docs/index-files/index-6.html @@ -0,0 +1,81 @@ + + + + +F-Index + + + + + + + + + + + + + + + +
+ +
+
+
+

Index

+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form +

F

+
+
fileName() - Method in record class model.MultipartPart
+
+
Returns the value of the fileName record component.
+
+
fileResponse(String, User, Map<String, String>) - Method in class webserver.HttpResponse
+
 
+
find(String) - Static method in class db.SessionDatabase
+
 
+
findAll() - Method in class db.Database
+
 
+
findHandler(String) - Method in class webserver.handler.RouteGuide
+
 
+
findUserById(String) - Method in class db.Database
+
 
+
findUserById(String) - Method in class db.UserDao
+
 
+
FORBIDDEN - Enum constant in enum class webserver.config.HttpStatus
+
 
+
FOUND - Enum constant in enum class webserver.config.HttpStatus
+
 
+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form
+
+
+ + diff --git a/docs/index-files/index-7.html b/docs/index-files/index-7.html new file mode 100644 index 000000000..acb7acad1 --- /dev/null +++ b/docs/index-files/index-7.html @@ -0,0 +1,109 @@ + + + + +G-Index + + + + + + + + + + + + + + + +
+ +
+
+
+

Index

+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form +

G

+
+
getAll() - Static method in class db.SessionDatabase
+
 
+
getCode() - Method in enum class webserver.config.HttpStatus
+
 
+
getConnection() - Static method in class db.ConnectionManager
+
 
+
getContentLength() - Method in class webserver.HttpRequest
+
 
+
getContentType(String) - Static method in enum class webserver.config.MimeType
+
 
+
getCookie(String) - Method in class webserver.HttpRequest
+
 
+
getErrorMessageBytes() - Method in enum class webserver.config.HttpStatus
+
 
+
getFileExtension(String) - Static method in class utils.HttpRequestUtils
+
 
+
getLastAccessTime() - Method in class db.SessionEntry
+
 
+
getLoginUser(String, UserDao) - Static method in class webserver.SessionManager
+
 
+
getMessage() - Method in enum class webserver.config.HttpStatus
+
 
+
getMethod() - Method in class webserver.HttpRequest
+
 
+
getMultipartParts() - Method in class webserver.HttpRequest
+
 
+
getParameter(String) - Method in class webserver.HttpRequest
+
 
+
getPath() - Method in class webserver.HttpRequest
+
 
+
getQueryString() - Method in class webserver.HttpRequest
+
 
+
getRouteMappings() - Static method in class webserver.config.AppConfig
+
 
+
getSessionCookieValue(String) - Static method in class webserver.SessionManager
+
 
+
getSessionUser(String, UserDao) - Static method in class webserver.SessionManager
+
 
+
getStatus() - Method in exception exception.WebsServerException
+
 
+
getUrl() - Method in class webserver.HttpRequest
+
 
+
getUserBySessionId(String, Database) - Static method in class webserver.SessionManager
+
 
+
getUserDao() - Static method in class webserver.config.AppConfig
+
 
+
getUserId() - Method in class db.SessionEntry
+
 
+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form
+
+
+ + diff --git a/docs/index-files/index-8.html b/docs/index-files/index-8.html new file mode 100644 index 000000000..e6f3d71e5 --- /dev/null +++ b/docs/index-files/index-8.html @@ -0,0 +1,93 @@ + + + + +H-Index + + + + + + + + + + + + + + + +
+ +
+
+
+

Index

+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form +

H

+
+
Handler - Interface in webserver.handler
+
 
+
hashCode() - Method in record class model.Article
+
+
Returns a hash code value for this object.
+
+
hashCode() - Method in record class model.MultipartPart
+
+
Returns a hash code value for this object.
+
+
hashCode() - Method in record class model.User
+
+
Returns a hash code value for this object.
+
+
HEADER_DELIMITER - Static variable in class webserver.config.Config
+
 
+
HTML - Enum constant in enum class webserver.config.MimeType
+
 
+
HttpRequest - Class in webserver
+
 
+
HttpRequest(InputStream) - Constructor for class webserver.HttpRequest
+
 
+
HttpRequestUtils - Class in utils
+
 
+
HttpRequestUtils() - Constructor for class utils.HttpRequestUtils
+
 
+
HttpResponse - Class in webserver
+
 
+
HttpResponse(OutputStream) - Constructor for class webserver.HttpResponse
+
 
+
HttpStatus - Enum Class in webserver.config
+
 
+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form
+
+
+ + diff --git a/docs/index-files/index-9.html b/docs/index-files/index-9.html new file mode 100644 index 000000000..d5134a300 --- /dev/null +++ b/docs/index-files/index-9.html @@ -0,0 +1,85 @@ + + + + +I-Index + + + + + + + + + + + + + + + +
+ +
+
+
+

Index

+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form +

I

+
+
ICO - Enum constant in enum class webserver.config.MimeType
+
 
+
id() - Method in record class model.Article
+
+
Returns the value of the id record component.
+
+
imagePath() - Method in record class model.Article
+
+
Returns the value of the imagePath record component.
+
+
insert(Article) - Method in class db.ArticleDao
+
 
+
insert(User) - Method in class db.UserDao
+
 
+
INTERNAL_SERVER_ERROR - Enum constant in enum class webserver.config.HttpStatus
+
 
+
IOUtils - Class in utils
+
 
+
IOUtils() - Constructor for class utils.IOUtils
+
 
+
isExpired(SessionEntry) - Static method in class webserver.SessionManager
+
 
+
isFile() - Method in record class model.MultipartPart
+
 
+
+A B C D E F G H I J K L M N O P R S T U V W 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form
+
+
+ + diff --git a/docs/jquery-ui.overrides.css b/docs/jquery-ui.overrides.css new file mode 100644 index 000000000..facf852c2 --- /dev/null +++ b/docs/jquery-ui.overrides.css @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +.ui-state-active, +.ui-widget-content .ui-state-active, +.ui-widget-header .ui-state-active, +a.ui-button:active, +.ui-button:active, +.ui-button.ui-state-active:hover { + /* Overrides the color of selection used in jQuery UI */ + background: #F8981D; + border: 1px solid #F8981D; +} diff --git a/docs/legal/ADDITIONAL_LICENSE_INFO b/docs/legal/ADDITIONAL_LICENSE_INFO new file mode 100644 index 000000000..ff700cd09 --- /dev/null +++ b/docs/legal/ADDITIONAL_LICENSE_INFO @@ -0,0 +1,37 @@ + ADDITIONAL INFORMATION ABOUT LICENSING + +Certain files distributed by Oracle America, Inc. and/or its affiliates are +subject to the following clarification and special exception to the GPLv2, +based on the GNU Project exception for its Classpath libraries, known as the +GNU Classpath Exception. + +Note that Oracle includes multiple, independent programs in this software +package. Some of those programs are provided under licenses deemed +incompatible with the GPLv2 by the Free Software Foundation and others. +For example, the package includes programs licensed under the Apache +License, Version 2.0 and may include FreeType. Such programs are licensed +to you under their original licenses. + +Oracle facilitates your further distribution of this package by adding the +Classpath Exception to the necessary parts of its GPLv2 code, which permits +you to use that code in combination with other independent modules not +licensed under the GPLv2. However, note that this would not permit you to +commingle code under an incompatible license with Oracle's GPLv2 licensed +code by, for example, cutting and pasting such code into a file also +containing Oracle's GPLv2 licensed code and then distributing the result. + +Additionally, if you were to remove the Classpath Exception from any of the +files to which it applies and distribute the result, you would likely be +required to license some or all of the other code in that distribution under +the GPLv2 as well, and since the GPLv2 is incompatible with the license terms +of some items included in the distribution by Oracle, removing the Classpath +Exception could therefore effectively compromise your ability to further +distribute the package. + +Failing to distribute notices associated with some files may also create +unexpected legal consequences. + +Proceed with caution and we recommend that you obtain the advice of a lawyer +skilled in open source matters before removing the Classpath Exception or +making modifications to this package which may subsequently be redistributed +and/or involve the use of third party software. diff --git a/docs/legal/ASSEMBLY_EXCEPTION b/docs/legal/ASSEMBLY_EXCEPTION new file mode 100644 index 000000000..065b8d902 --- /dev/null +++ b/docs/legal/ASSEMBLY_EXCEPTION @@ -0,0 +1,27 @@ + +OPENJDK ASSEMBLY EXCEPTION + +The OpenJDK source code made available by Oracle America, Inc. (Oracle) at +openjdk.java.net ("OpenJDK Code") is distributed under the terms of the GNU +General Public License version 2 +only ("GPL2"), with the following clarification and special exception. + + Linking this OpenJDK Code statically or dynamically with other code + is making a combined work based on this library. Thus, the terms + and conditions of GPL2 cover the whole combination. + + As a special exception, Oracle gives you permission to link this + OpenJDK Code with certain code licensed by Oracle as indicated at + http://openjdk.java.net/legal/exception-modules-2007-05-08.html + ("Designated Exception Modules") to produce an executable, + regardless of the license terms of the Designated Exception Modules, + and to copy and distribute the resulting executable under GPL2, + provided that the Designated Exception Modules continue to be + governed by the licenses under which they were offered by Oracle. + +As such, it allows licensees and sublicensees of Oracle's GPL2 OpenJDK Code +to build an executable that includes those portions of necessary code that +Oracle could not provide under GPL2 (or that Oracle has provided under GPL2 +with the Classpath exception). If you modify or add to the OpenJDK code, +that new GPL2 code may still be combined with Designated Exception Modules +if the new code is made subject to this exception by its copyright holder. diff --git a/docs/legal/LICENSE b/docs/legal/LICENSE new file mode 100644 index 000000000..8b400c7ab --- /dev/null +++ b/docs/legal/LICENSE @@ -0,0 +1,347 @@ +The GNU General Public License (GPL) + +Version 2, June 1991 + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Everyone is permitted to copy and distribute verbatim copies of this license +document, but changing it is not allowed. + +Preamble + +The licenses for most software are designed to take away your freedom to share +and change it. By contrast, the GNU General Public License is intended to +guarantee your freedom to share and change free software--to make sure the +software is free for all its users. This General Public License applies to +most of the Free Software Foundation's software and to any other program whose +authors commit to using it. (Some other Free Software Foundation software is +covered by the GNU Library General Public License instead.) You can apply it to +your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our +General Public Licenses are designed to make sure that you have the freedom to +distribute copies of free software (and charge for this service if you wish), +that you receive source code or can get it if you want it, that you can change +the software or use pieces of it in new free programs; and that you know you +can do these things. + +To protect your rights, we need to make restrictions that forbid anyone to deny +you these rights or to ask you to surrender the rights. These restrictions +translate to certain responsibilities for you if you distribute copies of the +software, or if you modify it. + +For example, if you distribute copies of such a program, whether gratis or for +a fee, you must give the recipients all the rights that you have. You must +make sure that they, too, receive or can get the source code. And you must +show them these terms so they know their rights. + +We protect your rights with two steps: (1) copyright the software, and (2) +offer you this license which gives you legal permission to copy, distribute +and/or modify the software. + +Also, for each author's protection and ours, we want to make certain that +everyone understands that there is no warranty for this free software. If the +software is modified by someone else and passed on, we want its recipients to +know that what they have is not the original, so that any problems introduced +by others will not reflect on the original authors' reputations. + +Finally, any free program is threatened constantly by software patents. We +wish to avoid the danger that redistributors of a free program will +individually obtain patent licenses, in effect making the program proprietary. +To prevent this, we have made it clear that any patent must be licensed for +everyone's free use or not licensed at all. + +The precise terms and conditions for copying, distribution and modification +follow. + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License applies to any program or other work which contains a notice +placed by the copyright holder saying it may be distributed under the terms of +this General Public License. The "Program", below, refers to any such program +or work, and a "work based on the Program" means either the Program or any +derivative work under copyright law: that is to say, a work containing the +Program or a portion of it, either verbatim or with modifications and/or +translated into another language. (Hereinafter, translation is included +without limitation in the term "modification".) Each licensee is addressed as +"you". + +Activities other than copying, distribution and modification are not covered by +this License; they are outside its scope. The act of running the Program is +not restricted, and the output from the Program is covered only if its contents +constitute a work based on the Program (independent of having been made by +running the Program). Whether that is true depends on what the Program does. + +1. You may copy and distribute verbatim copies of the Program's source code as +you receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice and +disclaimer of warranty; keep intact all the notices that refer to this License +and to the absence of any warranty; and give any other recipients of the +Program a copy of this License along with the Program. + +You may charge a fee for the physical act of transferring a copy, and you may +at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Program or any portion of it, thus +forming a work based on the Program, and copy and distribute such modifications +or work under the terms of Section 1 above, provided that you also meet all of +these conditions: + + a) You must cause the modified files to carry prominent notices stating + that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in whole or + in part contains or is derived from the Program or any part thereof, to be + licensed as a whole at no charge to all third parties under the terms of + this License. + + c) If the modified program normally reads commands interactively when run, + you must cause it, when started running for such interactive use in the + most ordinary way, to print or display an announcement including an + appropriate copyright notice and a notice that there is no warranty (or + else, saying that you provide a warranty) and that users may redistribute + the program under these conditions, and telling the user how to view a copy + of this License. (Exception: if the Program itself is interactive but does + not normally print such an announcement, your work based on the Program is + not required to print an announcement.) + +These requirements apply to the modified work as a whole. If identifiable +sections of that work are not derived from the Program, and can be reasonably +considered independent and separate works in themselves, then this License, and +its terms, do not apply to those sections when you distribute them as separate +works. But when you distribute the same sections as part of a whole which is a +work based on the Program, the distribution of the whole must be on the terms +of this License, whose permissions for other licensees extend to the entire +whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest your +rights to work written entirely by you; rather, the intent is to exercise the +right to control the distribution of derivative or collective works based on +the Program. + +In addition, mere aggregation of another work not based on the Program with the +Program (or with a work based on the Program) on a volume of a storage or +distribution medium does not bring the other work under the scope of this +License. + +3. You may copy and distribute the Program (or a work based on it, under +Section 2) in object code or executable form under the terms of Sections 1 and +2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable source + code, which must be distributed under the terms of Sections 1 and 2 above + on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three years, to + give any third party, for a charge no more than your cost of physically + performing source distribution, a complete machine-readable copy of the + corresponding source code, to be distributed under the terms of Sections 1 + and 2 above on a medium customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer to + distribute corresponding source code. (This alternative is allowed only + for noncommercial distribution and only if you received the program in + object code or executable form with such an offer, in accord with + Subsection b above.) + +The source code for a work means the preferred form of the work for making +modifications to it. For an executable work, complete source code means all +the source code for all modules it contains, plus any associated interface +definition files, plus the scripts used to control compilation and installation +of the executable. However, as a special exception, the source code +distributed need not include anything that is normally distributed (in either +source or binary form) with the major components (compiler, kernel, and so on) +of the operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the source +code from the same place counts as distribution of the source code, even though +third parties are not compelled to copy the source along with the object code. + +4. You may not copy, modify, sublicense, or distribute the Program except as +expressly provided under this License. Any attempt otherwise to copy, modify, +sublicense or distribute the Program is void, and will automatically terminate +your rights under this License. However, parties who have received copies, or +rights, from you under this License will not have their licenses terminated so +long as such parties remain in full compliance. + +5. You are not required to accept this License, since you have not signed it. +However, nothing else grants you permission to modify or distribute the Program +or its derivative works. These actions are prohibited by law if you do not +accept this License. Therefore, by modifying or distributing the Program (or +any work based on the Program), you indicate your acceptance of this License to +do so, and all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + +6. Each time you redistribute the Program (or any work based on the Program), +the recipient automatically receives a license from the original licensor to +copy, distribute or modify the Program subject to these terms and conditions. +You may not impose any further restrictions on the recipients' exercise of the +rights granted herein. You are not responsible for enforcing compliance by +third parties to this License. + +7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), conditions +are imposed on you (whether by court order, agreement or otherwise) that +contradict the conditions of this License, they do not excuse you from the +conditions of this License. If you cannot distribute so as to satisfy +simultaneously your obligations under this License and any other pertinent +obligations, then as a consequence you may not distribute the Program at all. +For example, if a patent license would not permit royalty-free redistribution +of the Program by all those who receive copies directly or indirectly through +you, then the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply and +the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents or +other property right claims or to contest validity of any such claims; this +section has the sole purpose of protecting the integrity of the free software +distribution system, which is implemented by public license practices. Many +people have made generous contributions to the wide range of software +distributed through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing to +distribute software through any other system and a licensee cannot impose that +choice. + +This section is intended to make thoroughly clear what is believed to be a +consequence of the rest of this License. + +8. If the distribution and/or use of the Program is restricted in certain +countries either by patents or by copyrighted interfaces, the original +copyright holder who places the Program under this License may add an explicit +geographical distribution limitation excluding those countries, so that +distribution is permitted only in or among countries not thus excluded. In +such case, this License incorporates the limitation as if written in the body +of this License. + +9. The Free Software Foundation may publish revised and/or new versions of the +General Public License from time to time. Such new versions will be similar in +spirit to the present version, but may differ in detail to address new problems +or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any later +version", you have the option of following the terms and conditions either of +that version or of any later version published by the Free Software Foundation. +If the Program does not specify a version number of this License, you may +choose any version ever published by the Free Software Foundation. + +10. If you wish to incorporate parts of the Program into other free programs +whose distribution conditions are different, write to the author to ask for +permission. For software which is copyrighted by the Free Software Foundation, +write to the Free Software Foundation; we sometimes make exceptions for this. +Our decision will be guided by the two goals of preserving the free status of +all derivatives of our free software and of promoting the sharing and reuse of +software generally. + +NO WARRANTY + +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR +THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE +STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE +PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND +PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, +YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL +ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE +PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR +INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA +BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER +OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible +use to the public, the best way to achieve this is to make it free software +which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach +them to the start of each source file to most effectively convey the exclusion +of warranty; and each file should have at least the "copyright" line and a +pointer to where the full notice is found. + + One line to give the program's name and a brief idea of what it does. + + Copyright (C) + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this when it +starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author Gnomovision comes + with ABSOLUTELY NO WARRANTY; for details type 'show w'. This is free + software, and you are welcome to redistribute it under certain conditions; + type 'show c' for details. + +The hypothetical commands 'show w' and 'show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may be +called something other than 'show w' and 'show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your school, +if any, to sign a "copyright disclaimer" for the program, if necessary. Here +is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + 'Gnomovision' (which makes passes at compilers) written by James Hacker. + + signature of Ty Coon, 1 April 1989 + + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General Public +License instead of this License. + + +"CLASSPATH" EXCEPTION TO THE GPL + +Certain source files distributed by Oracle America and/or its affiliates are +subject to the following clarification and special exception to the GPL, but +only where Oracle has expressly included in the particular source file's header +the words "Oracle designates this particular file as subject to the "Classpath" +exception as provided by Oracle in the LICENSE file that accompanied this code." + + Linking this library statically or dynamically with other modules is making + a combined work based on this library. Thus, the terms and conditions of + the GNU General Public License cover the whole combination. + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent modules, + and to copy and distribute the resulting executable under terms of your + choice, provided that you also meet, for each linked independent module, + the terms and conditions of the license of that module. An independent + module is a module which is not derived from or based on this library. If + you modify this library, you may extend this exception to your version of + the library, but you are not obligated to do so. If you do not wish to do + so, delete this exception statement from your version. diff --git a/docs/legal/jquery.md b/docs/legal/jquery.md new file mode 100644 index 000000000..a763ec6f1 --- /dev/null +++ b/docs/legal/jquery.md @@ -0,0 +1,26 @@ +## jQuery v3.7.1 + +### jQuery License +``` +jQuery v 3.7.1 +Copyright OpenJS Foundation and other contributors, https://openjsf.org/ + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +``` diff --git a/docs/legal/jqueryUI.md b/docs/legal/jqueryUI.md new file mode 100644 index 000000000..46bfbaa5c --- /dev/null +++ b/docs/legal/jqueryUI.md @@ -0,0 +1,49 @@ +## jQuery UI v1.14.1 + +### jQuery UI License +``` +Copyright OpenJS Foundation and other contributors, https://openjsf.org/ + +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/jquery/jquery-ui + +The following license applies to all parts of this software except as +documented below: + +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code contained within the demos directory. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +All files located in the node_modules and external directories are +externally maintained libraries used by this software which have their +own licenses; we recommend you read them, as their terms may differ from +the terms above. + +``` diff --git a/docs/member-search-index.js b/docs/member-search-index.js new file mode 100644 index 000000000..4e64d1655 --- /dev/null +++ b/docs/member-search-index.js @@ -0,0 +1 @@ +memberSearchIndex = [{"p":"webserver","c":"HttpResponse","l":"addHeader(String, String)","u":"addHeader(java.lang.String,java.lang.String)"},{"p":"db","c":"Database","l":"addUser(User)","u":"addUser(model.User)"},{"p":"webserver.config","c":"AppConfig","l":"AppConfig()","u":"%3Cinit%3E()"},{"p":"webserver.config","c":"Config","l":"ARTICLE_PAGE"},{"p":"model","c":"Article","l":"Article(Long, String, String, String, LocalDateTime, String, Integer)","u":"%3Cinit%3E(java.lang.Long,java.lang.String,java.lang.String,java.lang.String,java.time.LocalDateTime,java.lang.String,java.lang.Integer)"},{"p":"model","c":"Article","l":"Article(String, String, String, String)","u":"%3Cinit%3E(java.lang.String,java.lang.String,java.lang.String,java.lang.String)"},{"p":"db","c":"ArticleDao","l":"ArticleDao()","u":"%3Cinit%3E()"},{"p":"webserver.handler","c":"ArticleIndexHandler","l":"ArticleIndexHandler(ArticleDao, UserDao)","u":"%3Cinit%3E(db.ArticleDao,db.UserDao)"},{"p":"webserver.handler","c":"ArticleWriteHandler","l":"ArticleWriteHandler(ArticleDao, UserDao)","u":"%3Cinit%3E(db.ArticleDao,db.UserDao)"},{"p":"webserver.config","c":"HttpStatus","l":"BAD_REQUEST"},{"p":"webserver.config","c":"Config","l":"Config()","u":"%3Cinit%3E()"},{"p":"db","c":"ConnectionManager","l":"ConnectionManager()","u":"%3Cinit%3E()"},{"p":"model","c":"Article","l":"contents()"},{"p":"model","c":"MultipartPart","l":"contentType()"},{"p":"model","c":"Article","l":"createdAt()"},{"p":"webserver","c":"SessionManager","l":"createSession(User)","u":"createSession(model.User)"},{"p":"webserver.config","c":"Config","l":"CRLF"},{"p":"webserver.config","c":"MimeType","l":"CSS"},{"p":"model","c":"MultipartPart","l":"data()"},{"p":"db","c":"Database","l":"Database()","u":"%3Cinit%3E()"},{"p":"webserver.config","c":"Config","l":"DB_PW"},{"p":"webserver.config","c":"Config","l":"DB_URL"},{"p":"webserver.config","c":"Config","l":"DB_USER"},{"p":"webserver.config","c":"MimeType","l":"DEFAULT"},{"p":"webserver.config","c":"Config","l":"DEFAULT_PAGE"},{"p":"model","c":"User","l":"email()"},{"p":"model","c":"Article","l":"equals(Object)","u":"equals(java.lang.Object)"},{"p":"model","c":"MultipartPart","l":"equals(Object)","u":"equals(java.lang.Object)"},{"p":"model","c":"User","l":"equals(Object)","u":"equals(java.lang.Object)"},{"p":"model","c":"MultipartPart","l":"fileName()"},{"p":"webserver","c":"HttpResponse","l":"fileResponse(String, User, Map)","u":"fileResponse(java.lang.String,model.User,java.util.Map)"},{"p":"db","c":"SessionDatabase","l":"find(String)","u":"find(java.lang.String)"},{"p":"db","c":"Database","l":"findAll()"},{"p":"webserver.handler","c":"RouteGuide","l":"findHandler(String)","u":"findHandler(java.lang.String)"},{"p":"db","c":"Database","l":"findUserById(String)","u":"findUserById(java.lang.String)"},{"p":"db","c":"UserDao","l":"findUserById(String)","u":"findUserById(java.lang.String)"},{"p":"webserver.config","c":"HttpStatus","l":"FORBIDDEN"},{"p":"webserver.config","c":"HttpStatus","l":"FOUND"},{"p":"db","c":"SessionDatabase","l":"getAll()"},{"p":"webserver.config","c":"HttpStatus","l":"getCode()"},{"p":"db","c":"ConnectionManager","l":"getConnection()"},{"p":"webserver","c":"HttpRequest","l":"getContentLength()"},{"p":"webserver.config","c":"MimeType","l":"getContentType(String)","u":"getContentType(java.lang.String)"},{"p":"webserver","c":"HttpRequest","l":"getCookie(String)","u":"getCookie(java.lang.String)"},{"p":"webserver.config","c":"HttpStatus","l":"getErrorMessageBytes()"},{"p":"utils","c":"HttpRequestUtils","l":"getFileExtension(String)","u":"getFileExtension(java.lang.String)"},{"p":"db","c":"SessionEntry","l":"getLastAccessTime()"},{"p":"webserver","c":"SessionManager","l":"getLoginUser(String, UserDao)","u":"getLoginUser(java.lang.String,db.UserDao)"},{"p":"webserver.config","c":"HttpStatus","l":"getMessage()"},{"p":"webserver","c":"HttpRequest","l":"getMethod()"},{"p":"webserver","c":"HttpRequest","l":"getMultipartParts()"},{"p":"webserver","c":"HttpRequest","l":"getParameter(String)","u":"getParameter(java.lang.String)"},{"p":"webserver","c":"HttpRequest","l":"getPath()"},{"p":"webserver","c":"HttpRequest","l":"getQueryString()"},{"p":"webserver.config","c":"AppConfig","l":"getRouteMappings()"},{"p":"webserver","c":"SessionManager","l":"getSessionCookieValue(String)","u":"getSessionCookieValue(java.lang.String)"},{"p":"webserver","c":"SessionManager","l":"getSessionUser(String, UserDao)","u":"getSessionUser(java.lang.String,db.UserDao)"},{"p":"exception","c":"WebsServerException","l":"getStatus()"},{"p":"webserver","c":"HttpRequest","l":"getUrl()"},{"p":"webserver","c":"SessionManager","l":"getUserBySessionId(String, Database)","u":"getUserBySessionId(java.lang.String,db.Database)"},{"p":"webserver.config","c":"AppConfig","l":"getUserDao()"},{"p":"db","c":"SessionEntry","l":"getUserId()"},{"p":"model","c":"Article","l":"hashCode()"},{"p":"model","c":"MultipartPart","l":"hashCode()"},{"p":"model","c":"User","l":"hashCode()"},{"p":"webserver.config","c":"Config","l":"HEADER_DELIMITER"},{"p":"webserver.config","c":"MimeType","l":"HTML"},{"p":"webserver","c":"HttpRequest","l":"HttpRequest(InputStream)","u":"%3Cinit%3E(java.io.InputStream)"},{"p":"utils","c":"HttpRequestUtils","l":"HttpRequestUtils()","u":"%3Cinit%3E()"},{"p":"webserver","c":"HttpResponse","l":"HttpResponse(OutputStream)","u":"%3Cinit%3E(java.io.OutputStream)"},{"p":"webserver.config","c":"MimeType","l":"ICO"},{"p":"model","c":"Article","l":"id()"},{"p":"model","c":"Article","l":"imagePath()"},{"p":"db","c":"ArticleDao","l":"insert(Article)","u":"insert(model.Article)"},{"p":"db","c":"UserDao","l":"insert(User)","u":"insert(model.User)"},{"p":"webserver.config","c":"HttpStatus","l":"INTERNAL_SERVER_ERROR"},{"p":"utils","c":"IOUtils","l":"IOUtils()","u":"%3Cinit%3E()"},{"p":"webserver","c":"SessionManager","l":"isExpired(SessionEntry)","u":"isExpired(db.SessionEntry)"},{"p":"model","c":"MultipartPart","l":"isFile()"},{"p":"webserver.config","c":"MimeType","l":"JPG"},{"p":"webserver.config","c":"MimeType","l":"JS"},{"p":"webserver.config","c":"Pair","l":"key"},{"p":"model","c":"Article","l":"likeCount()"},{"p":"webserver.handler","c":"LikeHandler","l":"LikeHandler(ArticleDao)","u":"%3Cinit%3E(db.ArticleDao)"},{"p":"webserver.handler","c":"UserRequestHandler","l":"logger"},{"p":"webserver","c":"HttpResponse","l":"logger"},{"p":"webserver.config","c":"Config","l":"LOGIN_PAGE"},{"p":"webserver.handler","c":"LoginRequestHandler","l":"LoginRequestHandler(UserDao)","u":"%3Cinit%3E(db.UserDao)"},{"p":"webserver.handler","c":"LogoutRequestHandler","l":"LogoutRequestHandler(UserDao)","u":"%3Cinit%3E(db.UserDao)"},{"p":"webserver.config","c":"Config","l":"MAIN_PAGE"},{"p":"webserver","c":"WebServer","l":"main(String[])","u":"main(java.lang.String[])"},{"p":"webserver.config","c":"HttpStatus","l":"METHOD_NOT_ALLOWED"},{"p":"webserver","c":"MimeTypeTest","l":"MimeTypeTest()","u":"%3Cinit%3E()"},{"p":"model","c":"MultipartPart","l":"MultipartPart(String, String, String, byte[])","u":"%3Cinit%3E(java.lang.String,java.lang.String,java.lang.String,byte[])"},{"p":"webserver.config","c":"Config","l":"MY_PAGE"},{"p":"webserver.handler","c":"MyPageHandler","l":"MyPageHandler(UserDao)","u":"%3Cinit%3E(db.UserDao)"},{"p":"model","c":"MultipartPart","l":"name()"},{"p":"model","c":"User","l":"name()"},{"p":"webserver.config","c":"HttpStatus","l":"NOT_FOUND"},{"p":"webserver.config","c":"HttpStatus","l":"OK"},{"p":"webserver","c":"PageRender","l":"PageRender()","u":"%3Cinit%3E()"},{"p":"webserver.config","c":"Pair","l":"Pair(String, String)","u":"%3Cinit%3E(java.lang.String,java.lang.String)"},{"p":"utils","c":"HttpRequestUtils","l":"parseCookies(String)","u":"parseCookies(java.lang.String)"},{"p":"utils","c":"HttpRequestUtils","l":"parseHeader(String)","u":"parseHeader(java.lang.String)"},{"p":"utils","c":"HttpRequestUtils","l":"parseMultipartBody(byte[], String)","u":"parseMultipartBody(byte[],java.lang.String)"},{"p":"utils","c":"HttpRequestUtils","l":"parseParameters(String)","u":"parseParameters(java.lang.String)"},{"p":"utils","c":"HttpRequestUtils","l":"parsePath(String)","u":"parsePath(java.lang.String)"},{"p":"utils","c":"HttpRequestUtils","l":"parseQueryString(String)","u":"parseQueryString(java.lang.String)"},{"p":"utils","c":"HttpRequestUtils","l":"parseUrl(String)","u":"parseUrl(java.lang.String)"},{"p":"model","c":"User","l":"password()"},{"p":"webserver.config","c":"MimeType","l":"PNG"},{"p":"webserver","c":"SecurityInterceptor","l":"preHandler(String, User)","u":"preHandler(java.lang.String,model.User)"},{"p":"webserver.handler","c":"ArticleIndexHandler","l":"process(HttpRequest, HttpResponse)","u":"process(webserver.HttpRequest,webserver.HttpResponse)"},{"p":"webserver.handler","c":"ArticleWriteHandler","l":"process(HttpRequest, HttpResponse)","u":"process(webserver.HttpRequest,webserver.HttpResponse)"},{"p":"webserver.handler","c":"Handler","l":"process(HttpRequest, HttpResponse)","u":"process(webserver.HttpRequest,webserver.HttpResponse)"},{"p":"webserver.handler","c":"LikeHandler","l":"process(HttpRequest, HttpResponse)","u":"process(webserver.HttpRequest,webserver.HttpResponse)"},{"p":"webserver.handler","c":"LoginRequestHandler","l":"process(HttpRequest, HttpResponse)","u":"process(webserver.HttpRequest,webserver.HttpResponse)"},{"p":"webserver.handler","c":"LogoutRequestHandler","l":"process(HttpRequest, HttpResponse)","u":"process(webserver.HttpRequest,webserver.HttpResponse)"},{"p":"webserver.handler","c":"MyPageHandler","l":"process(HttpRequest, HttpResponse)","u":"process(webserver.HttpRequest,webserver.HttpResponse)"},{"p":"webserver.handler","c":"ProfileUpdateHandler","l":"process(HttpRequest, HttpResponse)","u":"process(webserver.HttpRequest,webserver.HttpResponse)"},{"p":"webserver.handler","c":"UserRequestHandler","l":"process(HttpRequest, HttpResponse)","u":"process(webserver.HttpRequest,webserver.HttpResponse)"},{"p":"model","c":"User","l":"profileImage()"},{"p":"webserver.handler","c":"ProfileUpdateHandler","l":"ProfileUpdateHandler(UserDao)","u":"%3Cinit%3E(db.UserDao)"},{"p":"utils","c":"IOUtils","l":"readData(BufferedReader, int)","u":"readData(java.io.BufferedReader,int)"},{"p":"webserver.config","c":"Config","l":"REGISTRATION_PAGE"},{"p":"db","c":"SessionDatabase","l":"remove(String)","u":"remove(java.lang.String)"},{"p":"webserver","c":"TemplateEngine","l":"render(String, Map)","u":"render(java.lang.String,java.util.Map)"},{"p":"webserver","c":"PageRender","l":"renderArticleList(List
, UserDao)","u":"renderArticleList(java.util.List,db.UserDao)"},{"p":"webserver","c":"PageRender","l":"renderHeader(User)","u":"renderHeader(model.User)"},{"p":"webserver","c":"PageRender","l":"renderLatestArticle(Article, User, int)","u":"renderLatestArticle(model.Article,model.User,int)"},{"p":"webserver","c":"PageRender","l":"renderProfile(User)","u":"renderProfile(model.User)"},{"p":"webserver","c":"RequestHandler","l":"RequestHandler(Socket, RouteGuide, UserDao)","u":"%3Cinit%3E(java.net.Socket,webserver.handler.RouteGuide,db.UserDao)"},{"p":"webserver.handler","c":"RouteGuide","l":"RouteGuide(Map)","u":"%3Cinit%3E(java.util.Map)"},{"p":"webserver","c":"RequestHandler","l":"run()"},{"p":"db","c":"SessionDatabase","l":"save(String, SessionEntry)","u":"save(java.lang.String,db.SessionEntry)"},{"p":"webserver","c":"SecurityInterceptor","l":"SecurityInterceptor()","u":"%3Cinit%3E()"},{"p":"db","c":"ArticleDao","l":"selectAll()"},{"p":"db","c":"ArticleDao","l":"selectLatest()"},{"p":"webserver","c":"HttpResponse","l":"sendError(HttpStatus)","u":"sendError(webserver.config.HttpStatus)"},{"p":"webserver","c":"HttpResponse","l":"sendHtmlContent(String)","u":"sendHtmlContent(java.lang.String)"},{"p":"webserver","c":"HttpResponse","l":"sendRedirect(String)","u":"sendRedirect(java.lang.String)"},{"p":"db","c":"SessionDatabase","l":"SessionDatabase()","u":"%3Cinit%3E()"},{"p":"db","c":"SessionEntry","l":"SessionEntry(String)","u":"%3Cinit%3E(java.lang.String)"},{"p":"db","c":"SessionEntry","l":"SessionEntry(String, LocalDateTime)","u":"%3Cinit%3E(java.lang.String,java.time.LocalDateTime)"},{"p":"webserver","c":"SessionManager","l":"SessionManager()","u":"%3Cinit%3E()"},{"p":"webserver.http","c":"SessionManagerTest","l":"SessionManagerTest()","u":"%3Cinit%3E()"},{"p":"webserver.config","c":"Config","l":"STATIC_RESOURCE_PATH"},{"p":"webserver.config","c":"MimeType","l":"SVG"},{"p":"webserver","c":"TemplateEngine","l":"TemplateEngine()","u":"%3Cinit%3E()"},{"p":"model","c":"Article","l":"title()"},{"p":"model","c":"Article","l":"toString()"},{"p":"model","c":"MultipartPart","l":"toString()"},{"p":"model","c":"User","l":"toString()"},{"p":"webserver.config","c":"HttpStatus","l":"toString()"},{"p":"db","c":"UserDao","l":"update(User)","u":"update(model.User)"},{"p":"db","c":"SessionEntry","l":"updateLastAccessedTime()"},{"p":"db","c":"ArticleDao","l":"updateLikeCount(Long)","u":"updateLikeCount(java.lang.Long)"},{"p":"model","c":"User","l":"User(String, String, String, String, String)","u":"%3Cinit%3E(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String)"},{"p":"db","c":"UserDao","l":"UserDao()","u":"%3Cinit%3E()"},{"p":"model","c":"User","l":"userId()"},{"p":"webserver.handler","c":"UserRequestHandler","l":"UserRequestHandler(UserDao)","u":"%3Cinit%3E(db.UserDao)"},{"p":"webserver.config","c":"Config","l":"UTF_8"},{"p":"webserver.config","c":"Pair","l":"value"},{"p":"webserver.config","c":"HttpStatus","l":"valueOf(String)","u":"valueOf(java.lang.String)"},{"p":"webserver.config","c":"MimeType","l":"valueOf(String)","u":"valueOf(java.lang.String)"},{"p":"webserver.config","c":"HttpStatus","l":"values()"},{"p":"webserver.config","c":"MimeType","l":"values()"},{"p":"webserver","c":"WebServer","l":"WebServer()","u":"%3Cinit%3E()"},{"p":"exception","c":"WebsServerException","l":"WebsServerException(HttpStatus, String)","u":"%3Cinit%3E(webserver.config.HttpStatus,java.lang.String)"},{"p":"model","c":"Article","l":"writer()"}];updateSearchResults(); \ No newline at end of file diff --git a/docs/model/Article.html b/docs/model/Article.html new file mode 100644 index 000000000..b3a982501 --- /dev/null +++ b/docs/model/Article.html @@ -0,0 +1,358 @@ + + + + +Article + + + + + + + + + + + + + + + +
+ +
+
+ +
+
Package model
+

Record Class Article

+
+ +
+
+
public record Article(Long id, String writer, String title, String contents, LocalDateTime createdAt, String imagePath, Integer likeCount) +extends Record
+
+
+
    + +
  • +
    +

    Constructor Summary

    +
    Constructors
    +
    +
    Constructor
    +
    Description
    +
    Article(Long id, + String writer, + String title, + String contents, + LocalDateTime createdAt, + String imagePath, + Integer likeCount)
    +
    +
    Creates an instance of a Article record class.
    +
    +
    Article(String writer, + String title, + String contents, + String imagePath)
    +
     
    +
    +
    +
  • + +
  • +
    +

    Method Summary

    +
    +
    +
    +
    +
    Modifier and Type
    +
    Method
    +
    Description
    + + +
    +
    Returns the value of the contents record component.
    +
    + + +
    +
    Returns the value of the createdAt record component.
    +
    +
    final boolean
    + +
    +
    Indicates whether some other object is "equal to" this one.
    +
    +
    final int
    + +
    +
    Returns a hash code value for this object.
    +
    + +
    id()
    +
    +
    Returns the value of the id record component.
    +
    + + +
    +
    Returns the value of the imagePath record component.
    +
    + + +
    +
    Returns the value of the likeCount record component.
    +
    + + +
    +
    Returns the value of the title record component.
    +
    +
    final String
    + +
    +
    Returns a string representation of this record class.
    +
    + + +
    +
    Returns the value of the writer record component.
    +
    +
    +
    +
    +
    +

    Methods inherited from class java.lang.Object

    +clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    +
    +
  • +
+
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      Article

      +
      public Article(Long id, + String writer, + String title, + String contents, + LocalDateTime createdAt, + String imagePath, + Integer likeCount)
      +
      Creates an instance of a Article record class.
      +
      +
      Parameters:
      +
      id - the value for the id record component
      +
      writer - the value for the writer record component
      +
      title - the value for the title record component
      +
      contents - the value for the contents record component
      +
      createdAt - the value for the createdAt record component
      +
      imagePath - the value for the imagePath record component
      +
      likeCount - the value for the likeCount record component
      +
      +
      +
    • +
    • +
      +

      Article

      +
      public Article(String writer, + String title, + String contents, + String imagePath)
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      toString

      +
      public final String toString()
      +
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      +
      +
      Specified by:
      +
      toString in class Record
      +
      Returns:
      +
      a string representation of this object
      +
      +
      +
    • +
    • +
      +

      hashCode

      +
      public final int hashCode()
      +
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      +
      +
      Specified by:
      +
      hashCode in class Record
      +
      Returns:
      +
      a hash code value for this object
      +
      +
      +
    • +
    • +
      +

      equals

      +
      public final boolean equals(Object o)
      +
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      +
      +
      Specified by:
      +
      equals in class Record
      +
      Parameters:
      +
      o - the object with which to compare
      +
      Returns:
      +
      true if this object is the same as the o argument; false otherwise.
      +
      +
      +
    • +
    • +
      +

      id

      +
      public Long id()
      +
      Returns the value of the id record component.
      +
      +
      Returns:
      +
      the value of the id record component
      +
      +
      +
    • +
    • +
      +

      writer

      +
      public String writer()
      +
      Returns the value of the writer record component.
      +
      +
      Returns:
      +
      the value of the writer record component
      +
      +
      +
    • +
    • +
      +

      title

      +
      public String title()
      +
      Returns the value of the title record component.
      +
      +
      Returns:
      +
      the value of the title record component
      +
      +
      +
    • +
    • +
      +

      contents

      +
      public String contents()
      +
      Returns the value of the contents record component.
      +
      +
      Returns:
      +
      the value of the contents record component
      +
      +
      +
    • +
    • +
      +

      createdAt

      +
      public LocalDateTime createdAt()
      +
      Returns the value of the createdAt record component.
      +
      +
      Returns:
      +
      the value of the createdAt record component
      +
      +
      +
    • +
    • +
      +

      imagePath

      +
      public String imagePath()
      +
      Returns the value of the imagePath record component.
      +
      +
      Returns:
      +
      the value of the imagePath record component
      +
      +
      +
    • +
    • +
      +

      likeCount

      +
      public Integer likeCount()
      +
      Returns the value of the likeCount record component.
      +
      +
      Returns:
      +
      the value of the likeCount record component
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+
+ + diff --git a/docs/model/MultipartPart.html b/docs/model/MultipartPart.html new file mode 100644 index 000000000..eb195f50b --- /dev/null +++ b/docs/model/MultipartPart.html @@ -0,0 +1,296 @@ + + + + +MultipartPart + + + + + + + + + + + + + + + +
+ +
+
+ +
+
Package model
+

Record Class MultipartPart

+
+
java.lang.Object +
java.lang.Record +
model.MultipartPart
+
+
+
+
+
public record MultipartPart(String name, String fileName, String contentType, byte[] data) +extends Record
+
+
+
    + +
  • +
    +

    Constructor Summary

    +
    Constructors
    +
    +
    Constructor
    +
    Description
    +
    MultipartPart(String name, + String fileName, + String contentType, + byte[] data)
    +
    +
    Creates an instance of a MultipartPart record class.
    +
    +
    +
    +
  • + +
  • +
    +

    Method Summary

    +
    +
    +
    +
    +
    Modifier and Type
    +
    Method
    +
    Description
    + + +
    +
    Returns the value of the contentType record component.
    +
    +
    byte[]
    + +
    +
    Returns the value of the data record component.
    +
    +
    final boolean
    + +
    +
    Indicates whether some other object is "equal to" this one.
    +
    + + +
    +
    Returns the value of the fileName record component.
    +
    +
    final int
    + +
    +
    Returns a hash code value for this object.
    +
    +
    boolean
    + +
     
    + + +
    +
    Returns the value of the name record component.
    +
    +
    final String
    + +
    +
    Returns a string representation of this record class.
    +
    +
    +
    +
    +
    +

    Methods inherited from class java.lang.Object

    +clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    +
    +
  • +
+
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      MultipartPart

      +
      public MultipartPart(String name, + String fileName, + String contentType, + byte[] data)
      +
      Creates an instance of a MultipartPart record class.
      +
      +
      Parameters:
      +
      name - the value for the name record component
      +
      fileName - the value for the fileName record component
      +
      contentType - the value for the contentType record component
      +
      data - the value for the data record component
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      isFile

      +
      public boolean isFile()
      +
      +
    • +
    • +
      +

      toString

      +
      public final String toString()
      +
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      +
      +
      Specified by:
      +
      toString in class Record
      +
      Returns:
      +
      a string representation of this object
      +
      +
      +
    • +
    • +
      +

      hashCode

      +
      public final int hashCode()
      +
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      +
      +
      Specified by:
      +
      hashCode in class Record
      +
      Returns:
      +
      a hash code value for this object
      +
      +
      +
    • +
    • +
      +

      equals

      +
      public final boolean equals(Object o)
      +
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      +
      +
      Specified by:
      +
      equals in class Record
      +
      Parameters:
      +
      o - the object with which to compare
      +
      Returns:
      +
      true if this object is the same as the o argument; false otherwise.
      +
      +
      +
    • +
    • +
      +

      name

      +
      public String name()
      +
      Returns the value of the name record component.
      +
      +
      Returns:
      +
      the value of the name record component
      +
      +
      +
    • +
    • +
      +

      fileName

      +
      public String fileName()
      +
      Returns the value of the fileName record component.
      +
      +
      Returns:
      +
      the value of the fileName record component
      +
      +
      +
    • +
    • +
      +

      contentType

      +
      public String contentType()
      +
      Returns the value of the contentType record component.
      +
      +
      Returns:
      +
      the value of the contentType record component
      +
      +
      +
    • +
    • +
      +

      data

      +
      public byte[] data()
      +
      Returns the value of the data record component.
      +
      +
      Returns:
      +
      the value of the data record component
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+
+ + diff --git a/docs/model/User.html b/docs/model/User.html new file mode 100644 index 000000000..150b187ac --- /dev/null +++ b/docs/model/User.html @@ -0,0 +1,306 @@ + + + + +User + + + + + + + + + + + + + + + +
+ +
+
+ +
+
Package model
+

Record Class User

+
+ +
+
+
public record User(String userId, String password, String name, String email, String profileImage) +extends Record
+
+
+
    + +
  • +
    +

    Constructor Summary

    +
    Constructors
    +
    +
    Constructor
    +
    Description
    +
    User(String userId, + String password, + String name, + String email, + String profileImage)
    +
    +
    Creates an instance of a User record class.
    +
    +
    +
    +
  • + +
  • +
    +

    Method Summary

    +
    +
    +
    +
    +
    Modifier and Type
    +
    Method
    +
    Description
    + + +
    +
    Returns the value of the email record component.
    +
    +
    final boolean
    + +
    +
    Indicates whether some other object is "equal to" this one.
    +
    +
    final int
    + +
    +
    Returns a hash code value for this object.
    +
    + + +
    +
    Returns the value of the name record component.
    +
    + + +
    +
    Returns the value of the password record component.
    +
    + + +
    +
    Returns the value of the profileImage record component.
    +
    +
    final String
    + +
    +
    Returns a string representation of this record class.
    +
    + + +
    +
    Returns the value of the userId record component.
    +
    +
    +
    +
    +
    +

    Methods inherited from class java.lang.Object

    +clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    +
    +
  • +
+
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      User

      +
      public User(String userId, + String password, + String name, + String email, + String profileImage)
      +
      Creates an instance of a User record class.
      +
      +
      Parameters:
      +
      userId - the value for the userId record component
      +
      password - the value for the password record component
      +
      name - the value for the name record component
      +
      email - the value for the email record component
      +
      profileImage - the value for the profileImage record component
      +
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      toString

      +
      public final String toString()
      +
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      +
      +
      Specified by:
      +
      toString in class Record
      +
      Returns:
      +
      a string representation of this object
      +
      +
      +
    • +
    • +
      +

      hashCode

      +
      public final int hashCode()
      +
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      +
      +
      Specified by:
      +
      hashCode in class Record
      +
      Returns:
      +
      a hash code value for this object
      +
      +
      +
    • +
    • +
      +

      equals

      +
      public final boolean equals(Object o)
      +
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      +
      +
      Specified by:
      +
      equals in class Record
      +
      Parameters:
      +
      o - the object with which to compare
      +
      Returns:
      +
      true if this object is the same as the o argument; false otherwise.
      +
      +
      +
    • +
    • +
      +

      userId

      +
      public String userId()
      +
      Returns the value of the userId record component.
      +
      +
      Returns:
      +
      the value of the userId record component
      +
      +
      +
    • +
    • +
      +

      password

      +
      public String password()
      +
      Returns the value of the password record component.
      +
      +
      Returns:
      +
      the value of the password record component
      +
      +
      +
    • +
    • +
      +

      name

      +
      public String name()
      +
      Returns the value of the name record component.
      +
      +
      Returns:
      +
      the value of the name record component
      +
      +
      +
    • +
    • +
      +

      email

      +
      public String email()
      +
      Returns the value of the email record component.
      +
      +
      Returns:
      +
      the value of the email record component
      +
      +
      +
    • +
    • +
      +

      profileImage

      +
      public String profileImage()
      +
      Returns the value of the profileImage record component.
      +
      +
      Returns:
      +
      the value of the profileImage record component
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+
+
+ + diff --git a/docs/model/package-summary.html b/docs/model/package-summary.html new file mode 100644 index 000000000..39534bd42 --- /dev/null +++ b/docs/model/package-summary.html @@ -0,0 +1,86 @@ + + + + +model + + + + + + + + + + + + + + + +
+ +
+
+
+

Package model

+
+
+
package model
+
+ +
+
+
+
+ + diff --git a/docs/model/package-tree.html b/docs/model/package-tree.html new file mode 100644 index 000000000..ca996dfdc --- /dev/null +++ b/docs/model/package-tree.html @@ -0,0 +1,77 @@ + + + + +model Class Hierarchy + + + + + + + + + + + + + + + +
+ +
+
+
+

Hierarchy For Package model

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+
+
+
+ + diff --git a/docs/module-search-index.js b/docs/module-search-index.js new file mode 100644 index 000000000..0d59754fc --- /dev/null +++ b/docs/module-search-index.js @@ -0,0 +1 @@ +moduleSearchIndex = [];updateSearchResults(); \ No newline at end of file diff --git a/docs/overview-summary.html b/docs/overview-summary.html new file mode 100644 index 000000000..6ce6d26aa --- /dev/null +++ b/docs/overview-summary.html @@ -0,0 +1,26 @@ + + + + +Generated Documentation (Untitled) + + + + + + + + + + + +
+ +

index.html

+
+ + diff --git a/docs/overview-tree.html b/docs/overview-tree.html new file mode 100644 index 000000000..76e08409e --- /dev/null +++ b/docs/overview-tree.html @@ -0,0 +1,148 @@ + + + + +Class Hierarchy + + + + + + + + + + + + + + + +
+ +
+
+
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+
+

Interface Hierarchy

+ +
+
+

Enum Class Hierarchy

+ +
+
+
+
+ + diff --git a/docs/package-search-index.js b/docs/package-search-index.js new file mode 100644 index 000000000..ca599a759 --- /dev/null +++ b/docs/package-search-index.js @@ -0,0 +1 @@ +packageSearchIndex = [{"l":"All Packages","u":"allpackages-index.html"},{"l":"db"},{"l":"exception"},{"l":"model"},{"l":"utils"},{"l":"webserver"},{"l":"webserver.config"},{"l":"webserver.handler"},{"l":"webserver.http"}];updateSearchResults(); \ No newline at end of file diff --git a/docs/resources/glass.png b/docs/resources/glass.png new file mode 100644 index 000000000..a7f591f46 Binary files /dev/null and b/docs/resources/glass.png differ diff --git a/docs/resources/x.png b/docs/resources/x.png new file mode 100644 index 000000000..30548a756 Binary files /dev/null and b/docs/resources/x.png differ diff --git a/docs/script-dir/jquery-3.7.1.min.js b/docs/script-dir/jquery-3.7.1.min.js new file mode 100644 index 000000000..7f37b5d99 --- /dev/null +++ b/docs/script-dir/jquery-3.7.1.min.js @@ -0,0 +1,2 @@ +/*! jQuery v3.7.1 | (c) OpenJS Foundation and other contributors | jquery.org/license */ +!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(ie,e){"use strict";var oe=[],r=Object.getPrototypeOf,ae=oe.slice,g=oe.flat?function(e){return oe.flat.call(e)}:function(e){return oe.concat.apply([],e)},s=oe.push,se=oe.indexOf,n={},i=n.toString,ue=n.hasOwnProperty,o=ue.toString,a=o.call(Object),le={},v=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},y=function(e){return null!=e&&e===e.window},C=ie.document,u={type:!0,src:!0,nonce:!0,noModule:!0};function m(e,t,n){var r,i,o=(n=n||C).createElement("script");if(o.text=e,t)for(r in u)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[i.call(e)]||"object":typeof e}var t="3.7.1",l=/HTML$/i,ce=function(e,t){return new ce.fn.init(e,t)};function c(e){var t=!!e&&"length"in e&&e.length,n=x(e);return!v(e)&&!y(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+ge+")"+ge+"*"),x=new RegExp(ge+"|>"),j=new RegExp(g),A=new RegExp("^"+t+"$"),D={ID:new RegExp("^#("+t+")"),CLASS:new RegExp("^\\.("+t+")"),TAG:new RegExp("^("+t+"|[*])"),ATTR:new RegExp("^"+p),PSEUDO:new RegExp("^"+g),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ge+"*(even|odd|(([+-]|)(\\d*)n|)"+ge+"*(?:([+-]|)"+ge+"*(\\d+)|))"+ge+"*\\)|)","i"),bool:new RegExp("^(?:"+f+")$","i"),needsContext:new RegExp("^"+ge+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ge+"*((?:-\\d)?\\d*)"+ge+"*\\)|)(?=[^-]|$)","i")},N=/^(?:input|select|textarea|button)$/i,q=/^h\d$/i,L=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,H=/[+~]/,O=new RegExp("\\\\[\\da-fA-F]{1,6}"+ge+"?|\\\\([^\\r\\n\\f])","g"),P=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},M=function(){V()},R=J(function(e){return!0===e.disabled&&fe(e,"fieldset")},{dir:"parentNode",next:"legend"});try{k.apply(oe=ae.call(ye.childNodes),ye.childNodes),oe[ye.childNodes.length].nodeType}catch(e){k={apply:function(e,t){me.apply(e,ae.call(t))},call:function(e){me.apply(e,ae.call(arguments,1))}}}function I(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(V(e),e=e||T,C)){if(11!==p&&(u=L.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return k.call(n,a),n}else if(f&&(a=f.getElementById(i))&&I.contains(e,a)&&a.id===i)return k.call(n,a),n}else{if(u[2])return k.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&e.getElementsByClassName)return k.apply(n,e.getElementsByClassName(i)),n}if(!(h[t+" "]||d&&d.test(t))){if(c=t,f=e,1===p&&(x.test(t)||m.test(t))){(f=H.test(t)&&U(e.parentNode)||e)==e&&le.scope||((s=e.getAttribute("id"))?s=ce.escapeSelector(s):e.setAttribute("id",s=S)),o=(l=Y(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+Q(l[o]);c=l.join(",")}try{return k.apply(n,f.querySelectorAll(c)),n}catch(e){h(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return re(t.replace(ve,"$1"),e,n,r)}function W(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function F(e){return e[S]=!0,e}function $(e){var t=T.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function B(t){return function(e){return fe(e,"input")&&e.type===t}}function _(t){return function(e){return(fe(e,"input")||fe(e,"button"))&&e.type===t}}function z(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&R(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function X(a){return F(function(o){return o=+o,F(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function U(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function V(e){var t,n=e?e.ownerDocument||e:ye;return n!=T&&9===n.nodeType&&n.documentElement&&(r=(T=n).documentElement,C=!ce.isXMLDoc(T),i=r.matches||r.webkitMatchesSelector||r.msMatchesSelector,r.msMatchesSelector&&ye!=T&&(t=T.defaultView)&&t.top!==t&&t.addEventListener("unload",M),le.getById=$(function(e){return r.appendChild(e).id=ce.expando,!T.getElementsByName||!T.getElementsByName(ce.expando).length}),le.disconnectedMatch=$(function(e){return i.call(e,"*")}),le.scope=$(function(){return T.querySelectorAll(":scope")}),le.cssHas=$(function(){try{return T.querySelector(":has(*,:jqfake)"),!1}catch(e){return!0}}),le.getById?(b.filter.ID=function(e){var t=e.replace(O,P);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&C){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(O,P);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&C){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):t.querySelectorAll(e)},b.find.CLASS=function(e,t){if("undefined"!=typeof t.getElementsByClassName&&C)return t.getElementsByClassName(e)},d=[],$(function(e){var t;r.appendChild(e).innerHTML="",e.querySelectorAll("[selected]").length||d.push("\\["+ge+"*(?:value|"+f+")"),e.querySelectorAll("[id~="+S+"-]").length||d.push("~="),e.querySelectorAll("a#"+S+"+*").length||d.push(".#.+[+~]"),e.querySelectorAll(":checked").length||d.push(":checked"),(t=T.createElement("input")).setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),r.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&d.push(":enabled",":disabled"),(t=T.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||d.push("\\["+ge+"*name"+ge+"*="+ge+"*(?:''|\"\")")}),le.cssHas||d.push(":has"),d=d.length&&new RegExp(d.join("|")),l=function(e,t){if(e===t)return a=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!le.sortDetached&&t.compareDocumentPosition(e)===n?e===T||e.ownerDocument==ye&&I.contains(ye,e)?-1:t===T||t.ownerDocument==ye&&I.contains(ye,t)?1:o?se.call(o,e)-se.call(o,t):0:4&n?-1:1)}),T}for(e in I.matches=function(e,t){return I(e,null,null,t)},I.matchesSelector=function(e,t){if(V(e),C&&!h[t+" "]&&(!d||!d.test(t)))try{var n=i.call(e,t);if(n||le.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){h(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(O,P),e[3]=(e[3]||e[4]||e[5]||"").replace(O,P),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||I.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&I.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return D.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&j.test(n)&&(t=Y(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(O,P).toLowerCase();return"*"===e?function(){return!0}:function(e){return fe(e,t)}},CLASS:function(e){var t=s[e+" "];return t||(t=new RegExp("(^|"+ge+")"+e+"("+ge+"|$)"))&&s(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=I.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function T(e,n,r){return v(n)?ce.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?ce.grep(e,function(e){return e===n!==r}):"string"!=typeof n?ce.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(ce.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||k,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:S.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof ce?t[0]:t,ce.merge(this,ce.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:C,!0)),w.test(r[1])&&ce.isPlainObject(t))for(r in t)v(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=C.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):v(e)?void 0!==n.ready?n.ready(e):e(ce):ce.makeArray(e,this)}).prototype=ce.fn,k=ce(C);var E=/^(?:parents|prev(?:Until|All))/,j={children:!0,contents:!0,next:!0,prev:!0};function A(e,t){while((e=e[t])&&1!==e.nodeType);return e}ce.fn.extend({has:function(e){var t=ce(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,Ce=/^$|^module$|\/(?:java|ecma)script/i;xe=C.createDocumentFragment().appendChild(C.createElement("div")),(be=C.createElement("input")).setAttribute("type","radio"),be.setAttribute("checked","checked"),be.setAttribute("name","t"),xe.appendChild(be),le.checkClone=xe.cloneNode(!0).cloneNode(!0).lastChild.checked,xe.innerHTML="",le.noCloneChecked=!!xe.cloneNode(!0).lastChild.defaultValue,xe.innerHTML="",le.option=!!xe.lastChild;var ke={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function Se(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&fe(e,t)?ce.merge([e],n):n}function Ee(e,t){for(var n=0,r=e.length;n",""]);var je=/<|&#?\w+;/;function Ae(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function Re(e,t){return fe(e,"table")&&fe(11!==t.nodeType?t:t.firstChild,"tr")&&ce(e).children("tbody")[0]||e}function Ie(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function We(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Fe(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(_.hasData(e)&&(s=_.get(e).events))for(i in _.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),C.head.appendChild(r[0])},abort:function(){i&&i()}}});var Jt,Kt=[],Zt=/(=)\?(?=&|$)|\?\?/;ce.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Kt.pop()||ce.expando+"_"+jt.guid++;return this[e]=!0,e}}),ce.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Zt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Zt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=v(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Zt,"$1"+r):!1!==e.jsonp&&(e.url+=(At.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||ce.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=ie[r],ie[r]=function(){o=arguments},n.always(function(){void 0===i?ce(ie).removeProp(r):ie[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Kt.push(r)),o&&v(i)&&i(o[0]),o=i=void 0}),"script"}),le.createHTMLDocument=((Jt=C.implementation.createHTMLDocument("").body).innerHTML="
",2===Jt.childNodes.length),ce.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(le.createHTMLDocument?((r=(t=C.implementation.createHTMLDocument("")).createElement("base")).href=C.location.href,t.head.appendChild(r)):t=C),o=!n&&[],(i=w.exec(e))?[t.createElement(i[1])]:(i=Ae([e],t,o),o&&o.length&&ce(o).remove(),ce.merge([],i.childNodes)));var r,i,o},ce.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(ce.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},ce.expr.pseudos.animated=function(t){return ce.grep(ce.timers,function(e){return t===e.elem}).length},ce.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=ce.css(e,"position"),c=ce(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=ce.css(e,"top"),u=ce.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),v(t)&&(t=t.call(e,n,ce.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},ce.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){ce.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===ce.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===ce.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=ce(e).offset()).top+=ce.css(e,"borderTopWidth",!0),i.left+=ce.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-ce.css(r,"marginTop",!0),left:t.left-i.left-ce.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===ce.css(e,"position"))e=e.offsetParent;return e||J})}}),ce.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;ce.fn[t]=function(e){return M(this,function(e,t,n){var r;if(y(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),ce.each(["top","left"],function(e,n){ce.cssHooks[n]=Ye(le.pixelPosition,function(e,t){if(t)return t=Ge(e,n),_e.test(t)?ce(e).position()[n]+"px":t})}),ce.each({Height:"height",Width:"width"},function(a,s){ce.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){ce.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return M(this,function(e,t,n){var r;return y(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?ce.css(e,t,i):ce.style(e,t,n,i)},s,n?e:void 0,n)}})}),ce.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){ce.fn[t]=function(e){return this.on(t,e)}}),ce.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.on("mouseenter",e).on("mouseleave",t||e)}}),ce.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){ce.fn[n]=function(e,t){return 0{"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)})(function(x){x.ui=x.ui||{};x.ui.version="1.14.1";var n,s,C,k,o,l,a,r,u,i,h=0,c=Array.prototype.hasOwnProperty,d=Array.prototype.slice;x.cleanData=(n=x.cleanData,function(t){for(var e,i,s=0;null!=(i=t[s]);s++)(e=x._data(i,"events"))&&e.remove&&x(i).triggerHandler("remove");n(t)}),x.widget=function(t,i,e){var s,n,o,l,a={},r=t.split(".")[0];return"__proto__"===(t=t.split(".")[1])||"constructor"===t?x.error("Invalid widget name: "+t):(l=r+"-"+t,e||(e=i,i=x.Widget),Array.isArray(e)&&(e=x.extend.apply(null,[{}].concat(e))),x.expr.pseudos[l.toLowerCase()]=function(t){return!!x.data(t,l)},x[r]=x[r]||{},s=x[r][t],n=x[r][t]=function(t,e){if(!this||!this._createWidget)return new n(t,e);arguments.length&&this._createWidget(t,e)},x.extend(n,s,{version:e.version,_proto:x.extend({},e),_childConstructors:[]}),(o=new i).options=x.widget.extend({},o.options),x.each(e,function(e,s){function n(){return i.prototype[e].apply(this,arguments)}function o(t){return i.prototype[e].apply(this,t)}a[e]="function"!=typeof s?s:function(){var t,e=this._super,i=this._superApply;return this._super=n,this._superApply=o,t=s.apply(this,arguments),this._super=e,this._superApply=i,t}}),n.prototype=x.widget.extend(o,{widgetEventPrefix:s&&o.widgetEventPrefix||t},a,{constructor:n,namespace:r,widgetName:t,widgetFullName:l}),s?(x.each(s._childConstructors,function(t,e){var i=e.prototype;x.widget(i.namespace+"."+i.widgetName,n,e._proto)}),delete s._childConstructors):i._childConstructors.push(n),x.widget.bridge(t,n),n)},x.widget.extend=function(t){for(var e,i,s=d.call(arguments,1),n=0,o=s.length;n",options:{classes:{},disabled:!1,create:null},_createWidget:function(t,e){e=x(e||this.defaultElement||this)[0],this.element=x(e),this.uuid=h++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=x(),this.hoverable=x(),this.focusable=x(),this.classesElementLookup={},e!==this&&(x.data(e,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===e&&this.destroy()}}),this.document=x(e.style?e.ownerDocument:e.document||e),this.window=x(this.document[0].defaultView||this.document[0].parentWindow)),this.options=x.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:x.noop,_create:x.noop,_init:x.noop,destroy:function(){var i=this;this._destroy(),x.each(this.classesElementLookup,function(t,e){i._removeClass(e,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:x.noop,widget:function(){return this.element},option:function(t,e){var i,s,n,o=t;if(0===arguments.length)return x.widget.extend({},this.options);if("string"==typeof t)if(o={},t=(i=t.split(".")).shift(),i.length){for(s=o[t]=x.widget.extend({},this.options[t]),n=0;n{var i=[];n.element.each(function(t,e){x.map(l.classesElementLookup,function(t){return t}).some(function(t){return t.is(e)})||i.push(e)}),l._on(x(i),{remove:"_untrackClassesElement"})})(),x(x.uniqueSort(i.get().concat(n.element.get())))):x(i.not(n.element).get()),l.classesElementLookup[t[s]]=i,o.push(t[s]),e&&n.classes[t[s]]&&o.push(n.classes[t[s]])}return(n=x.extend({element:this.element,classes:this.options.classes||{}},n)).keys&&t(n.keys.match(/\S+/g)||[],!0),n.extra&&t(n.extra.match(/\S+/g)||[]),o.join(" ")},_untrackClassesElement:function(i){var s=this;x.each(s.classesElementLookup,function(t,e){-1!==x.inArray(i.target,e)&&(s.classesElementLookup[t]=x(e.not(i.target).get()))}),this._off(x(i.target))},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){var n="string"==typeof t||null===t,e={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s="boolean"==typeof s?s:i};return e.element.toggleClass(this._classes(e),s),this},_on:function(n,o,t){var l,a=this;"boolean"!=typeof n&&(t=o,o=n,n=!1),t?(o=l=x(o),this.bindings=this.bindings.add(o)):(t=o,o=this.element,l=this.widget()),x.each(t,function(t,e){function i(){if(n||!0!==a.options.disabled&&!x(this).hasClass("ui-state-disabled"))return("string"==typeof e?a[e]:e).apply(a,arguments)}"string"!=typeof e&&(i.guid=e.guid=e.guid||i.guid||x.guid++);var t=t.match(/^([\w:-]*)\s*(.*)$/),s=t[1]+a.eventNamespace,t=t[2];t?l.on(s,t,i):o.on(s,i)})},_off:function(t,e){e=(e||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.off(e),this.bindings=x(this.bindings.not(t).get()),this.focusable=x(this.focusable.not(t).get()),this.hoverable=x(this.hoverable.not(t).get())},_delay:function(t,e){var i=this;return setTimeout(function(){return("string"==typeof t?i[t]:t).apply(i,arguments)},e||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){this._addClass(x(t.currentTarget),null,"ui-state-hover")},mouseleave:function(t){this._removeClass(x(t.currentTarget),null,"ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){this._addClass(x(t.currentTarget),null,"ui-state-focus")},focusout:function(t){this._removeClass(x(t.currentTarget),null,"ui-state-focus")}})},_trigger:function(t,e,i){var s,n,o=this.options[t];if(i=i||{},(e=x.Event(e)).type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),e.target=this.element[0],n=e.originalEvent)for(s in n)s in e||(e[s]=n[s]);return this.element.trigger(e,i),!("function"==typeof o&&!1===o.apply(this.element[0],[e].concat(i))||e.isDefaultPrevented())}},x.each({show:"fadeIn",hide:"fadeOut"},function(o,l){x.Widget.prototype["_"+o]=function(e,t,i){var s,n=(t="string"==typeof t?{effect:t}:t)?!0!==t&&"number"!=typeof t&&t.effect||l:o;"number"==typeof(t=t||{})?t={duration:t}:!0===t&&(t={}),s=!x.isEmptyObject(t),t.complete=i,t.delay&&e.delay(t.delay),s&&x.effects&&x.effects.effect[n]?e[o](t):n!==o&&e[n]?e[n](t.duration,t.easing,i):e.queue(function(t){x(this)[o](),i&&i.call(e[0]),t()})}}),x.widget;function E(t,e,i){return[parseFloat(t[0])*(u.test(t[0])?e/100:1),parseFloat(t[1])*(u.test(t[1])?i/100:1)]}function T(t,e){return parseInt(x.css(t,e),10)||0}function W(t){return null!=t&&t===t.window}C=Math.max,k=Math.abs,o=/left|center|right/,l=/top|center|bottom/,a=/[\+\-]\d+(\.[\d]+)?%?/,r=/^\w+/,u=/%$/,i=x.fn.position,x.position={scrollbarWidth:function(){var t,e,i;return void 0!==s?s:(i=(e=x("
")).children()[0],x("body").append(e),t=i.offsetWidth,e.css("overflow","scroll"),t===(i=i.offsetWidth)&&(i=e[0].clientWidth),e.remove(),s=t-i)},getScrollInfo:function(t){var e=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),i=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),e="scroll"===e||"auto"===e&&t.widthC(k(s),k(n))?o.important="horizontal":o.important="vertical",c.using.call(this,t,o)}),l.offset(x.extend(u,{using:t}))})):i.apply(this,arguments)},x.ui.position={fit:{left:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,s=s.width,o=t.left-e.collisionPosition.marginLeft,l=n-o,a=o+e.collisionWidth-s-n;s",delay:300,options:{icons:{submenu:"ui-icon-caret-1-e"},items:"> *",menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.lastMousePosition={x:null,y:null},this.element.uniqueId().attr({role:this.options.role,tabIndex:0}),this._addClass("ui-menu","ui-widget ui-widget-content"),this._on({"mousedown .ui-menu-item":function(t){t.preventDefault(),this._activateItem(t)},"click .ui-menu-item":function(t){var e=x(t.target),i=x(this.document[0].activeElement);!this.mouseHandled&&e.not(".ui-state-disabled").length&&(this.select(t),t.isPropagationStopped()||(this.mouseHandled=!0),e.has(".ui-menu").length?this.expand(t):!this.element.is(":focus")&&i.closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active)&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer))},"mouseenter .ui-menu-item":"_activateItem","mousemove .ui-menu-item":"_activateItem",mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var i=this.active||this._menuItems().first();e||this.focus(t,i)},blur:function(t){this._delay(function(){x.contains(this.element[0],this.document[0].activeElement)||this.collapseAll(t)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){this._closeOnDocumentClick(t)&&this.collapseAll(t,!0),this.mouseHandled=!1}})},_activateItem:function(t){var e,i;this.previousFilter||t.clientX===this.lastMousePosition.x&&t.clientY===this.lastMousePosition.y||(this.lastMousePosition={x:t.clientX,y:t.clientY},e=x(t.target).closest(".ui-menu-item"),i=x(t.currentTarget),e[0]!==i[0])||i.is(".ui-state-active")||(this._removeClass(i.siblings().children(".ui-state-active"),null,"ui-state-active"),this.focus(t,i))},_destroy:function(){var t=this.element.find(".ui-menu-item").removeAttr("role aria-disabled").children(".ui-menu-item-wrapper").removeUniqueId().removeAttr("tabIndex role aria-haspopup");this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled tabIndex").removeUniqueId().show(),t.children().each(function(){var t=x(this);t.data("ui-menu-submenu-caret")&&t.remove()})},_keydown:function(t){var e,i,s,n=!0;switch(t.keyCode){case x.ui.keyCode.PAGE_UP:this.previousPage(t);break;case x.ui.keyCode.PAGE_DOWN:this.nextPage(t);break;case x.ui.keyCode.HOME:this._move("first","first",t);break;case x.ui.keyCode.END:this._move("last","last",t);break;case x.ui.keyCode.UP:this.previous(t);break;case x.ui.keyCode.DOWN:this.next(t);break;case x.ui.keyCode.LEFT:this.collapse(t);break;case x.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case x.ui.keyCode.ENTER:case x.ui.keyCode.SPACE:this._activate(t);break;case x.ui.keyCode.ESCAPE:this.collapse(t);break;default:e=this.previousFilter||"",s=n=!1,i=96<=t.keyCode&&t.keyCode<=105?(t.keyCode-96).toString():String.fromCharCode(t.keyCode),clearTimeout(this.filterTimer),i===e?s=!0:i=e+i,e=this._filterMenuItems(i),(e=s&&-1!==e.index(this.active.next())?this.active.nextAll(".ui-menu-item"):e).length||(i=String.fromCharCode(t.keyCode),e=this._filterMenuItems(i)),e.length?(this.focus(t,e),this.previousFilter=i,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}n&&t.preventDefault()},_activate:function(t){this.active&&!this.active.is(".ui-state-disabled")&&(this.active.children("[aria-haspopup='true']").length?this.expand(t):this.select(t))},refresh:function(){var t,e,s=this,n=this.options.icons.submenu,i=this.element.find(this.options.menus);this._toggleClass("ui-menu-icons",null,!!this.element.find(".ui-icon").length),t=i.filter(":not(.ui-menu)").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var t=x(this),e=t.prev(),i=x("").data("ui-menu-submenu-caret",!0);s._addClass(i,"ui-menu-icon","ui-icon "+n),e.attr("aria-haspopup","true").prepend(i),t.attr("aria-labelledby",e.attr("id"))}),this._addClass(t,"ui-menu","ui-widget ui-widget-content ui-front"),(t=i.add(this.element).find(this.options.items)).not(".ui-menu-item").each(function(){var t=x(this);s._isDivider(t)&&s._addClass(t,"ui-menu-divider","ui-widget-content")}),e=(i=t.not(".ui-menu-item, .ui-menu-divider")).children().not(".ui-menu").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),this._addClass(i,"ui-menu-item")._addClass(e,"ui-menu-item-wrapper"),t.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!x.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(t,e){var i;"icons"===t&&(i=this.element.find(".ui-menu-icon"),this._removeClass(i,null,this.options.icons.submenu)._addClass(i,null,e.submenu)),this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",String(t)),this._toggleClass(null,"ui-state-disabled",!!t)},focus:function(t,e){var i;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),i=this.active.children(".ui-menu-item-wrapper"),this._addClass(i,null,"ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",i.attr("id")),i=this.active.parent().closest(".ui-menu-item").children(".ui-menu-item-wrapper"),this._addClass(i,null,"ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),(i=e.children(".ui-menu")).length&&t&&/^mouse/.test(t.type)&&this._startOpening(i),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(t){var e,i,s;this._hasScroll()&&(e=parseFloat(x.css(this.activeMenu[0],"borderTopWidth"))||0,i=parseFloat(x.css(this.activeMenu[0],"paddingTop"))||0,e=t.offset().top-this.activeMenu.offset().top-e-i,i=this.activeMenu.scrollTop(),s=this.activeMenu.height(),t=t.outerHeight(),e<0?this.activeMenu.scrollTop(i+e):s",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,liveRegionTimer:null,_create:function(){var i,s,n,t=this.element[0].nodeName.toLowerCase(),e="textarea"===t,t="input"===t;this.isMultiLine=e||!t&&"true"===this.element.prop("contentEditable"),this.valueMethod=this.element[e||t?"val":"text"],this.isNewMenu=!0,this._addClass("ui-autocomplete-input"),this.element.attr("autocomplete","off"),this._on(this.element,{keydown:function(t){if(this.element.prop("readOnly"))s=n=i=!0;else{s=n=i=!1;var e=x.ui.keyCode;switch(t.keyCode){case e.PAGE_UP:i=!0,this._move("previousPage",t);break;case e.PAGE_DOWN:i=!0,this._move("nextPage",t);break;case e.UP:i=!0,this._keyEvent("previous",t);break;case e.DOWN:i=!0,this._keyEvent("next",t);break;case e.ENTER:this.menu.active&&(i=!0,t.preventDefault(),this.menu.select(t));break;case e.TAB:this.menu.active&&this.menu.select(t);break;case e.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(t),t.preventDefault());break;default:s=!0,this._searchTimeout(t)}}},keypress:function(t){if(i)i=!1,this.isMultiLine&&!this.menu.element.is(":visible")||t.preventDefault();else if(!s){var e=x.ui.keyCode;switch(t.keyCode){case e.PAGE_UP:this._move("previousPage",t);break;case e.PAGE_DOWN:this._move("nextPage",t);break;case e.UP:this._keyEvent("previous",t);break;case e.DOWN:this._keyEvent("next",t)}}},input:function(t){n?(n=!1,t.preventDefault()):this._searchTimeout(t)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(t){clearTimeout(this.searching),this.close(t),this._change(t)}}),this._initSource(),this.menu=x("
    ").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._addClass(this.menu.element,"ui-autocomplete","ui-front"),this._on(this.menu.element,{mousedown:function(t){t.preventDefault()},menufocus:function(t,e){var i,s;this.isNewMenu&&(this.isNewMenu=!1,t.originalEvent)&&/^mouse/.test(t.originalEvent.type)?(this.menu.blur(),this.document.one("mousemove",function(){x(t.target).trigger(t.originalEvent)})):(s=e.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",t,{item:s})&&t.originalEvent&&/^key/.test(t.originalEvent.type)&&this._value(s.value),(i=e.item.attr("aria-label")||s.value)&&String.prototype.trim.call(i).length&&(clearTimeout(this.liveRegionTimer),this.liveRegionTimer=this._delay(function(){this.liveRegion.html(x("
    ").text(i))},100)))},menuselect:function(t,e){var e=e.item.data("ui-autocomplete-item"),i=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.trigger("focus"),this.previous=i),!1!==this._trigger("select",t,{item:e})&&this._value(e.value),this.term=this._value(),this.close(t),this.selectedItem=e}}),this.liveRegion=x("
    ",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(t,e){this._super(t,e),"source"===t&&this._initSource(),"appendTo"===t&&this.menu.element.appendTo(this._appendTo()),"disabled"===t&&e&&this.xhr&&this.xhr.abort()},_isEventTargetInWidget:function(t){var e=this.menu.element[0];return t.target===this.element[0]||t.target===e||x.contains(e,t.target)},_closeOnClickOutside:function(t){this._isEventTargetInWidget(t)||this.close()},_appendTo:function(){var t=this.options.appendTo;return t=(t=(t=t&&(t.jquery||t.nodeType?x(t):this.document.find(t).eq(0)))&&t[0]?t:this.element.closest(".ui-front, dialog")).length?t:this.document[0].body},_initSource:function(){var i,s,n=this;Array.isArray(this.options.source)?(i=this.options.source,this.source=function(t,e){e(x.ui.autocomplete.filter(i,t.term))}):"string"==typeof this.options.source?(s=this.options.source,this.source=function(t,e){n.xhr&&n.xhr.abort(),n.xhr=x.ajax({url:s,data:t,dataType:"json",success:function(t){e(t)},error:function(){e([])}})}):this.source=this.options.source},_searchTimeout:function(s){clearTimeout(this.searching),this.searching=this._delay(function(){var t=this.term===this._value(),e=this.menu.element.is(":visible"),i=s.altKey||s.ctrlKey||s.metaKey||s.shiftKey;t&&(e||i)||(this.selectedItem=null,this.search(null,s))},this.options.delay)},search:function(t,e){return t=null!=t?t:this._value(),this.term=this._value(),t.length").append(x("
    ").text(e.label)).appendTo(t)},_move:function(t,e){this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(t)||this.menu.isLastItem()&&/^next/.test(t)?(this.isMultiLine||this._value(this.term),this.menu.blur()):this.menu[t](e):this.search(null,e)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(t,e){this.isMultiLine&&!this.menu.element.is(":visible")||(this._move(t,e),e.preventDefault())}}),x.extend(x.ui.autocomplete,{escapeRegex:function(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(t,e){var i=new RegExp(x.ui.autocomplete.escapeRegex(e),"i");return x.grep(t,function(t){return i.test(t.label||t.value||t)})}}),x.widget("ui.autocomplete",x.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(t){return t+(1").text(e))},100))}}),x.ui.autocomplete}); \ No newline at end of file diff --git a/docs/script.js b/docs/script.js new file mode 100644 index 000000000..73cd8faac --- /dev/null +++ b/docs/script.js @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +var moduleSearchIndex; +var packageSearchIndex; +var typeSearchIndex; +var memberSearchIndex; +var tagSearchIndex; +function loadScripts(doc, tag) { + createElem(doc, tag, 'search.js'); + + createElem(doc, tag, 'module-search-index.js'); + createElem(doc, tag, 'package-search-index.js'); + createElem(doc, tag, 'type-search-index.js'); + createElem(doc, tag, 'member-search-index.js'); + createElem(doc, tag, 'tag-search-index.js'); +} + +function createElem(doc, tag, path) { + var script = doc.createElement(tag); + var scriptElement = doc.getElementsByTagName(tag)[0]; + script.src = pathtoroot + path; + scriptElement.parentNode.insertBefore(script, scriptElement); +} + +function show(tableId, selected, columns) { + if (tableId !== selected) { + document.querySelectorAll('div.' + tableId + ':not(.' + selected + ')') + .forEach(function(elem) { + elem.style.display = 'none'; + }); + } + document.querySelectorAll('div.' + selected) + .forEach(function(elem, index) { + elem.style.display = ''; + var isEvenRow = index % (columns * 2) < columns; + elem.classList.remove(isEvenRow ? oddRowColor : evenRowColor); + elem.classList.add(isEvenRow ? evenRowColor : oddRowColor); + }); + updateTabs(tableId, selected); +} + +function updateTabs(tableId, selected) { + document.getElementById(tableId + '.tabpanel') + .setAttribute('aria-labelledby', selected); + document.querySelectorAll('button[id^="' + tableId + '"]') + .forEach(function(tab, index) { + if (selected === tab.id || (tableId === selected && index === 0)) { + tab.className = activeTableTab; + tab.setAttribute('aria-selected', true); + tab.setAttribute('tabindex',0); + } else { + tab.className = tableTab; + tab.setAttribute('aria-selected', false); + tab.setAttribute('tabindex',-1); + } + }); +} + +function switchTab(e) { + var selected = document.querySelector('[aria-selected=true]'); + if (selected) { + if ((e.keyCode === 37 || e.keyCode === 38) && selected.previousSibling) { + // left or up arrow key pressed: move focus to previous tab + selected.previousSibling.click(); + selected.previousSibling.focus(); + e.preventDefault(); + } else if ((e.keyCode === 39 || e.keyCode === 40) && selected.nextSibling) { + // right or down arrow key pressed: move focus to next tab + selected.nextSibling.click(); + selected.nextSibling.focus(); + e.preventDefault(); + } + } +} + +var updateSearchResults = function() {}; + +function indexFilesLoaded() { + return moduleSearchIndex + && packageSearchIndex + && typeSearchIndex + && memberSearchIndex + && tagSearchIndex; +} + +// Workaround for scroll position not being included in browser history (8249133) +document.addEventListener("DOMContentLoaded", function(e) { + var contentDiv = document.querySelector("div.flex-content"); + window.addEventListener("popstate", function(e) { + if (e.state !== null) { + contentDiv.scrollTop = e.state; + } + }); + window.addEventListener("hashchange", function(e) { + history.replaceState(contentDiv.scrollTop, document.title); + }); + contentDiv.addEventListener("scroll", function(e) { + var timeoutID; + if (!timeoutID) { + timeoutID = setTimeout(function() { + history.replaceState(contentDiv.scrollTop, document.title); + timeoutID = null; + }, 100); + } + }); + if (!location.hash) { + history.replaceState(contentDiv.scrollTop, document.title); + } +}); diff --git a/docs/search.js b/docs/search.js new file mode 100644 index 000000000..db3b2f4a6 --- /dev/null +++ b/docs/search.js @@ -0,0 +1,354 @@ +/* + * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +var noResult = {l: "No results found"}; +var loading = {l: "Loading search index..."}; +var catModules = "Modules"; +var catPackages = "Packages"; +var catTypes = "Classes and Interfaces"; +var catMembers = "Members"; +var catSearchTags = "Search Tags"; +var highlight = "$&"; +var searchPattern = ""; +var fallbackPattern = ""; +var RANKING_THRESHOLD = 2; +var NO_MATCH = 0xffff; +var MIN_RESULTS = 3; +var MAX_RESULTS = 500; +var UNNAMED = ""; +function escapeHtml(str) { + return str.replace(//g, ">"); +} +function getHighlightedText(item, matcher, fallbackMatcher) { + var escapedItem = escapeHtml(item); + var highlighted = escapedItem.replace(matcher, highlight); + if (highlighted === escapedItem) { + highlighted = escapedItem.replace(fallbackMatcher, highlight) + } + return highlighted; +} +function getURLPrefix(ui) { + var urlPrefix=""; + var slash = "/"; + if (ui.item.category === catModules) { + return ui.item.l + slash; + } else if (ui.item.category === catPackages && ui.item.m) { + return ui.item.m + slash; + } else if (ui.item.category === catTypes || ui.item.category === catMembers) { + if (ui.item.m) { + urlPrefix = ui.item.m + slash; + } else { + $.each(packageSearchIndex, function(index, item) { + if (item.m && ui.item.p === item.l) { + urlPrefix = item.m + slash; + } + }); + } + } + return urlPrefix; +} +function createSearchPattern(term) { + var pattern = ""; + var isWordToken = false; + term.replace(/,\s*/g, ", ").trim().split(/\s+/).forEach(function(w, index) { + if (index > 0) { + // whitespace between identifiers is significant + pattern += (isWordToken && /^\w/.test(w)) ? "\\s+" : "\\s*"; + } + var tokens = w.split(/(?=[A-Z,.()<>[\/])/); + for (var i = 0; i < tokens.length; i++) { + var s = tokens[i]; + if (s === "") { + continue; + } + pattern += $.ui.autocomplete.escapeRegex(s); + isWordToken = /\w$/.test(s); + if (isWordToken) { + pattern += "([a-z0-9_$<>\\[\\]]*?)"; + } + } + }); + return pattern; +} +function createMatcher(pattern, flags) { + var isCamelCase = /[A-Z]/.test(pattern); + return new RegExp(pattern, flags + (isCamelCase ? "" : "i")); +} +var watermark = 'Search'; +$(function() { + var search = $("#search-input"); + var reset = $("#reset-button"); + search.val(''); + search.prop("disabled", false); + reset.prop("disabled", false); + search.val(watermark).addClass('watermark'); + search.blur(function() { + if ($(this).val().length === 0) { + $(this).val(watermark).addClass('watermark'); + } + }); + search.on('click keydown paste', function() { + if ($(this).val() === watermark) { + $(this).val('').removeClass('watermark'); + } + }); + reset.click(function() { + search.val('').focus(); + }); + search.focus()[0].setSelectionRange(0, 0); +}); +$.widget("custom.catcomplete", $.ui.autocomplete, { + _create: function() { + this._super(); + this.widget().menu("option", "items", "> :not(.ui-autocomplete-category)"); + }, + _renderMenu: function(ul, items) { + var rMenu = this; + var currentCategory = ""; + rMenu.menu.bindings = $(); + $.each(items, function(index, item) { + var li; + if (item.category && item.category !== currentCategory) { + ul.append("
  • " + item.category + "
  • "); + currentCategory = item.category; + } + li = rMenu._renderItemData(ul, item); + if (item.category) { + li.attr("aria-label", item.category + " : " + item.l); + li.attr("class", "result-item"); + } else { + li.attr("aria-label", item.l); + li.attr("class", "result-item"); + } + }); + }, + _renderItem: function(ul, item) { + var label = ""; + var matcher = createMatcher(escapeHtml(searchPattern), "g"); + var fallbackMatcher = new RegExp(fallbackPattern, "gi") + if (item.category === catModules) { + label = getHighlightedText(item.l, matcher, fallbackMatcher); + } else if (item.category === catPackages) { + label = getHighlightedText(item.l, matcher, fallbackMatcher); + } else if (item.category === catTypes) { + label = (item.p && item.p !== UNNAMED) + ? getHighlightedText(item.p + "." + item.l, matcher, fallbackMatcher) + : getHighlightedText(item.l, matcher, fallbackMatcher); + } else if (item.category === catMembers) { + label = (item.p && item.p !== UNNAMED) + ? getHighlightedText(item.p + "." + item.c + "." + item.l, matcher, fallbackMatcher) + : getHighlightedText(item.c + "." + item.l, matcher, fallbackMatcher); + } else if (item.category === catSearchTags) { + label = getHighlightedText(item.l, matcher, fallbackMatcher); + } else { + label = item.l; + } + var li = $("
  • ").appendTo(ul); + var div = $("
    ").appendTo(li); + if (item.category === catSearchTags && item.h) { + if (item.d) { + div.html(label + " (" + item.h + ")
    " + + item.d + "
    "); + } else { + div.html(label + " (" + item.h + ")"); + } + } else { + if (item.m) { + div.html(item.m + "/" + label); + } else { + div.html(label); + } + } + return li; + } +}); +function rankMatch(match, category) { + if (!match) { + return NO_MATCH; + } + var index = match.index; + var input = match.input; + var leftBoundaryMatch = 2; + var periferalMatch = 0; + // make sure match is anchored on a left word boundary + if (index === 0 || /\W/.test(input[index - 1]) || "_" === input[index]) { + leftBoundaryMatch = 0; + } else if ("_" === input[index - 1] || (input[index] === input[index].toUpperCase() && !/^[A-Z0-9_$]+$/.test(input))) { + leftBoundaryMatch = 1; + } + var matchEnd = index + match[0].length; + var leftParen = input.indexOf("("); + var endOfName = leftParen > -1 ? leftParen : input.length; + // exclude peripheral matches + if (category !== catModules && category !== catSearchTags) { + var delim = category === catPackages ? "/" : "."; + if (leftParen > -1 && leftParen < index) { + periferalMatch += 2; + } else if (input.lastIndexOf(delim, endOfName) >= matchEnd) { + periferalMatch += 2; + } + } + var delta = match[0].length === endOfName ? 0 : 1; // rank full match higher than partial match + for (var i = 1; i < match.length; i++) { + // lower ranking if parts of the name are missing + if (match[i]) + delta += match[i].length; + } + if (category === catTypes) { + // lower ranking if a type name contains unmatched camel-case parts + if (/[A-Z]/.test(input.substring(matchEnd))) + delta += 5; + if (/[A-Z]/.test(input.substring(0, index))) + delta += 5; + } + return leftBoundaryMatch + periferalMatch + (delta / 200); + +} +function doSearch(request, response) { + var result = []; + searchPattern = createSearchPattern(request.term); + fallbackPattern = createSearchPattern(request.term.toLowerCase()); + if (searchPattern === "") { + return this.close(); + } + var camelCaseMatcher = createMatcher(searchPattern, ""); + var fallbackMatcher = new RegExp(fallbackPattern, "i"); + + function searchIndexWithMatcher(indexArray, matcher, category, nameFunc) { + if (indexArray) { + var newResults = []; + $.each(indexArray, function (i, item) { + item.category = category; + var ranking = rankMatch(matcher.exec(nameFunc(item)), category); + if (ranking < RANKING_THRESHOLD) { + newResults.push({ranking: ranking, item: item}); + } + return newResults.length <= MAX_RESULTS; + }); + return newResults.sort(function(e1, e2) { + return e1.ranking - e2.ranking; + }).map(function(e) { + return e.item; + }); + } + return []; + } + function searchIndex(indexArray, category, nameFunc) { + var primaryResults = searchIndexWithMatcher(indexArray, camelCaseMatcher, category, nameFunc); + result = result.concat(primaryResults); + if (primaryResults.length <= MIN_RESULTS && !camelCaseMatcher.ignoreCase) { + var secondaryResults = searchIndexWithMatcher(indexArray, fallbackMatcher, category, nameFunc); + result = result.concat(secondaryResults.filter(function (item) { + return primaryResults.indexOf(item) === -1; + })); + } + } + + searchIndex(moduleSearchIndex, catModules, function(item) { return item.l; }); + searchIndex(packageSearchIndex, catPackages, function(item) { + return (item.m && request.term.indexOf("/") > -1) + ? (item.m + "/" + item.l) : item.l; + }); + searchIndex(typeSearchIndex, catTypes, function(item) { + return request.term.indexOf(".") > -1 ? item.p + "." + item.l : item.l; + }); + searchIndex(memberSearchIndex, catMembers, function(item) { + return request.term.indexOf(".") > -1 + ? item.p + "." + item.c + "." + item.l : item.l; + }); + searchIndex(tagSearchIndex, catSearchTags, function(item) { return item.l; }); + + if (!indexFilesLoaded()) { + updateSearchResults = function() { + doSearch(request, response); + } + result.unshift(loading); + } else { + updateSearchResults = function() {}; + } + response(result); +} +$(function() { + $("#search-input").catcomplete({ + minLength: 1, + delay: 300, + source: doSearch, + response: function(event, ui) { + if (!ui.content.length) { + ui.content.push(noResult); + } else { + $("#search-input").empty(); + } + }, + autoFocus: true, + focus: function(event, ui) { + return false; + }, + position: { + collision: "flip" + }, + select: function(event, ui) { + if (ui.item.category) { + var url = getURLPrefix(ui); + if (ui.item.category === catModules) { + url += "module-summary.html"; + } else if (ui.item.category === catPackages) { + if (ui.item.u) { + url = ui.item.u; + } else { + url += ui.item.l.replace(/\./g, '/') + "/package-summary.html"; + } + } else if (ui.item.category === catTypes) { + if (ui.item.u) { + url = ui.item.u; + } else if (ui.item.p === UNNAMED) { + url += ui.item.l + ".html"; + } else { + url += ui.item.p.replace(/\./g, '/') + "/" + ui.item.l + ".html"; + } + } else if (ui.item.category === catMembers) { + if (ui.item.p === UNNAMED) { + url += ui.item.c + ".html" + "#"; + } else { + url += ui.item.p.replace(/\./g, '/') + "/" + ui.item.c + ".html" + "#"; + } + if (ui.item.u) { + url += ui.item.u; + } else { + url += ui.item.l; + } + } else if (ui.item.category === catSearchTags) { + url += ui.item.u; + } + if (top !== window) { + parent.classFrame.location = pathtoroot + url; + } else { + window.location.href = pathtoroot + url; + } + $("#search-input").focus(); + } + } + }); +}); diff --git a/docs/serialized-form.html b/docs/serialized-form.html new file mode 100644 index 000000000..e275d4276 --- /dev/null +++ b/docs/serialized-form.html @@ -0,0 +1,85 @@ + + + + +Serialized Form + + + + + + + + + + + + + + + +
    + +
    +
    +
    +

    Serialized Form

    +
    + +
    +
    +
    + + diff --git a/docs/stylesheet.css b/docs/stylesheet.css new file mode 100644 index 000000000..4a576bd24 --- /dev/null +++ b/docs/stylesheet.css @@ -0,0 +1,869 @@ +/* + * Javadoc style sheet + */ + +@import url('resources/fonts/dejavu.css'); + +/* + * Styles for individual HTML elements. + * + * These are styles that are specific to individual HTML elements. Changing them affects the style of a particular + * HTML element throughout the page. + */ + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; + padding:0; + height:100%; + width:100%; +} +iframe { + margin:0; + padding:0; + height:100%; + width:100%; + overflow-y:scroll; + border:none; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a[href]:hover, a[href]:focus { + text-decoration:none; + color:#bb7a2a; +} +a[name] { + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; +} +h4 { + font-size:15px; +} +h5 { + font-size:14px; +} +h6 { + font-size:13px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; +} +:not(h1, h2, h3, h4, h5, h6) > code, +:not(h1, h2, h3, h4, h5, h6) > tt { + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +.summary-table dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +button { + font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size: 14px; +} +/* + * Styles for HTML generated by javadoc. + * + * These are style classes that are used by the standard doclet to generate HTML documentation. + */ + +/* + * Styles for document title and copyright. + */ +.clear { + clear:both; + height:0; + overflow:hidden; +} +.about-language { + float:right; + padding:0 21px 8px 8px; + font-size:11px; + margin-top:-9px; + height:2.9em; +} +.legal-copy { + margin-left:.5em; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* + * Styles for navigation bar. + */ +@media screen { + .flex-box { + position:fixed; + display:flex; + flex-direction:column; + height: 100%; + width: 100%; + } + .flex-header { + flex: 0 0 auto; + } + .flex-content { + flex: 1 1 auto; + overflow-y: auto; + } +} +.top-nav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + min-height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.sub-nav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.sub-nav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +.sub-nav .nav-list { + padding-top:5px; +} +ul.nav-list { + display:block; + margin:0 25px 0 0; + padding:0; +} +ul.sub-nav-list { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.nav-list li { + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +.sub-nav .nav-list-search { + float:right; + margin:0 0 0 0; + padding:5px 6px; + clear:none; +} +.nav-list-search label { + position:relative; + right:-16px; +} +ul.sub-nav-list li { + list-style:none; + float:left; + padding-top:10px; +} +.top-nav a:link, .top-nav a:active, .top-nav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.top-nav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.nav-bar-cell1-rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skip-nav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* + * Hide navigation links and search box in print layout + */ +@media print { + ul.nav-list, div.sub-nav { + display:none; + } +} +/* + * Styles for page header and footer. + */ +.title { + color:#2c4557; + margin:10px 0; +} +.sub-title { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* + * Styles for headings. + */ +body.class-declaration-page .summary h2, +body.class-declaration-page .details h2, +body.class-use-page h2, +body.module-declaration-page .block-list h2 { + font-style: italic; + padding:0; + margin:15px 0; +} +body.class-declaration-page .summary h3, +body.class-declaration-page .details h3, +body.class-declaration-page .summary .inherited-list h2 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +/* + * Styles for page layout containers. + */ +main { + clear:both; + padding:10px 20px; + position:relative; +} +dl.notes > dt { + font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +dl.notes > dd { + margin:5px 10px 10px 0; + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} +dl.name-value > dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +dl.name-value > dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* + * Styles for lists. + */ +li.circle { + list-style:circle; +} +ul.horizontal li { + display:inline; + font-size:0.9em; +} +div.inheritance { + margin:0; + padding:0; +} +div.inheritance div.inheritance { + margin-left:2em; +} +ul.block-list, +ul.details-list, +ul.member-list, +ul.summary-list { + margin:10px 0 10px 0; + padding:0; +} +ul.block-list > li, +ul.details-list > li, +ul.member-list > li, +ul.summary-list > li { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +.summary-table dl, .summary-table dl dt, .summary-table dl dd { + margin-top:0; + margin-bottom:1px; +} +ul.see-list, ul.see-list-long { + padding-left: 0; + list-style: none; +} +ul.see-list li { + display: inline; +} +ul.see-list li:not(:last-child):after, +ul.see-list-long li:not(:last-child):after { + content: ", "; + white-space: pre-wrap; +} +/* + * Styles for tables. + */ +.summary-table, .details-table { + width:100%; + border-spacing:0; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; + padding:0; +} +.caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0; + padding-top:10px; + padding-left:1px; + margin:0; + white-space:pre; +} +.caption a:link, .caption a:visited { + color:#1f389c; +} +.caption a:hover, +.caption a:active { + color:#FFFFFF; +} +.caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} +div.table-tabs { + padding:10px 0 0 1px; + margin:0; +} +div.table-tabs > button { + border: none; + cursor: pointer; + padding: 5px 12px 7px 12px; + font-weight: bold; + margin-right: 3px; +} +div.table-tabs > button.active-table-tab { + background: #F8981D; + color: #253441; +} +div.table-tabs > button.table-tab { + background: #4D7A97; + color: #FFFFFF; +} +.two-column-summary { + display: grid; + grid-template-columns: minmax(15%, max-content) minmax(15%, auto); +} +.three-column-summary { + display: grid; + grid-template-columns: minmax(10%, max-content) minmax(15%, max-content) minmax(15%, auto); +} +.four-column-summary { + display: grid; + grid-template-columns: minmax(10%, max-content) minmax(10%, max-content) minmax(10%, max-content) minmax(10%, auto); +} +@media screen and (max-width: 600px) { + .two-column-summary { + display: grid; + grid-template-columns: 1fr; + } +} +@media screen and (max-width: 800px) { + .three-column-summary { + display: grid; + grid-template-columns: minmax(10%, max-content) minmax(25%, auto); + } + .three-column-summary .col-last { + grid-column-end: span 2; + } +} +@media screen and (max-width: 1000px) { + .four-column-summary { + display: grid; + grid-template-columns: minmax(15%, max-content) minmax(15%, auto); + } +} +.summary-table > div, .details-table > div { + text-align:left; + padding: 8px 3px 3px 7px; +} +.col-first, .col-second, .col-last, .col-constructor-name, .col-summary-item-name { + vertical-align:top; + padding-right:0; + padding-top:8px; + padding-bottom:3px; +} +.table-header { + background:#dee3e9; + font-weight: bold; +} +.col-first, .col-first { + font-size:13px; +} +.col-second, .col-second, .col-last, .col-constructor-name, .col-summary-item-name, .col-last { + font-size:13px; +} +.col-first, .col-second, .col-constructor-name { + vertical-align:top; + overflow: auto; +} +.col-last { + white-space:normal; +} +.col-first a:link, .col-first a:visited, +.col-second a:link, .col-second a:visited, +.col-first a:link, .col-first a:visited, +.col-second a:link, .col-second a:visited, +.col-constructor-name a:link, .col-constructor-name a:visited, +.col-summary-item-name a:link, .col-summary-item-name a:visited, +.constant-values-container a:link, .constant-values-container a:visited, +.all-classes-container a:link, .all-classes-container a:visited, +.all-packages-container a:link, .all-packages-container a:visited { + font-weight:bold; +} +.table-sub-heading-color { + background-color:#EEEEFF; +} +.even-row-color, .even-row-color .table-header { + background-color:#FFFFFF; +} +.odd-row-color, .odd-row-color .table-header { + background-color:#EEEEEF; +} +/* + * Styles for contents. + */ +.deprecated-content { + margin:0; + padding:10px 0; +} +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} +.col-last div { + padding-top:0; +} +.col-last a { + padding-bottom:3px; +} +.module-signature, +.package-signature, +.type-signature, +.member-signature { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + margin:14px 0; + white-space: pre-wrap; +} +.module-signature, +.package-signature, +.type-signature { + margin-top: 0; +} +.member-signature .type-parameters-long, +.member-signature .parameters, +.member-signature .exceptions { + display: inline-block; + vertical-align: top; + white-space: pre; +} +.member-signature .type-parameters { + white-space: normal; +} +/* + * Styles for formatting effect. + */ +.source-line-no { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:0 10px 5px 0; + color:#474747; +} +.deprecated-label, .descfrm-type-label, .implementation-label, .member-name-label, .member-name-link, +.module-label-in-package, .module-label-in-type, .override-specify-label, .package-label-in-type, +.package-hierarchy-label, .type-name-label, .type-name-link, .search-tag-link, .preview-label { + font-weight:bold; +} +.deprecation-comment, .help-footnote, .preview-comment { + font-style:italic; +} +.deprecation-block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; + border-style:solid; + border-width:thin; + border-radius:10px; + padding:10px; + margin-bottom:10px; + margin-right:10px; + display:inline-block; +} +.preview-block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; + border-style:solid; + border-width:thin; + border-radius:10px; + padding:10px; + margin-bottom:10px; + margin-right:10px; + display:inline-block; +} +div.block div.deprecation-comment { + font-style:normal; +} +/* + * Styles specific to HTML5 elements. + */ +main, nav, header, footer, section { + display:block; +} +/* + * Styles for javadoc search. + */ +.ui-autocomplete-category { + font-weight:bold; + font-size:15px; + padding:7px 0 7px 3px; + background-color:#4D7A97; + color:#FFFFFF; +} +.result-item { + font-size:13px; +} +.ui-autocomplete { + max-height:85%; + max-width:65%; + overflow-y:scroll; + overflow-x:scroll; + white-space:nowrap; + box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23); +} +ul.ui-autocomplete { + position:fixed; + z-index:999999; + background-color: #FFFFFF; +} +ul.ui-autocomplete li { + float:left; + clear:both; + width:100%; +} +.result-highlight { + font-weight:bold; +} +.ui-autocomplete .result-item { + font-size: inherit; +} +#search-input { + background-image:url('resources/glass.png'); + background-size:13px; + background-repeat:no-repeat; + background-position:2px 3px; + padding-left:20px; + position:relative; + right:-18px; + width:400px; +} +#reset-button { + background-color: rgb(255,255,255); + background-image:url('resources/x.png'); + background-position:center; + background-repeat:no-repeat; + background-size:12px; + border:0 none; + width:16px; + height:16px; + position:relative; + left:-4px; + top:-4px; + font-size:0px; +} +.watermark { + color:#545454; +} +.search-tag-desc-result { + font-style:italic; + font-size:11px; +} +.search-tag-holder-result { + font-style:italic; + font-size:12px; +} +.search-tag-result:target { + background-color:yellow; +} +.module-graph span { + display:none; + position:absolute; +} +.module-graph:hover span { + display:block; + margin: -100px 0 0 100px; + z-index: 1; +} +.inherited-list { + margin: 10px 0 10px 0; +} +section.class-description { + line-height: 1.4; +} +.summary section[class$="-summary"], .details section[class$="-details"], +.class-uses .detail, .serialized-class-details { + padding: 0px 20px 5px 10px; + border: 1px solid #ededed; + background-color: #f8f8f8; +} +.inherited-list, section[class$="-details"] .detail { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +.vertical-separator { + padding: 0 5px; +} +ul.help-section-list { + margin: 0; +} +ul.help-subtoc > li { + display: inline-block; + padding-right: 5px; + font-size: smaller; +} +ul.help-subtoc > li::before { + content: "\2022" ; + padding-right:2px; +} +span.help-note { + font-style: italic; +} +/* + * Indicator icon for external links. + */ +main a[href*="://"]::after { + content:""; + display:inline-block; + background-image:url('data:image/svg+xml; utf8, \ + \ + \ + '); + background-size:100% 100%; + width:7px; + height:7px; + margin-left:2px; + margin-bottom:4px; +} +main a[href*="://"]:hover::after, +main a[href*="://"]:focus::after { + background-image:url('data:image/svg+xml; utf8, \ + \ + \ + '); +} + +/* + * Styles for user-provided tables. + * + * borderless: + * No borders, vertical margins, styled caption. + * This style is provided for use with existing doc comments. + * In general, borderless tables should not be used for layout purposes. + * + * plain: + * Plain borders around table and cells, vertical margins, styled caption. + * Best for small tables or for complex tables for tables with cells that span + * rows and columns, when the "striped" style does not work well. + * + * striped: + * Borders around the table and vertical borders between cells, striped rows, + * vertical margins, styled caption. + * Best for tables that have a header row, and a body containing a series of simple rows. + */ + +table.borderless, +table.plain, +table.striped { + margin-top: 10px; + margin-bottom: 10px; +} +table.borderless > caption, +table.plain > caption, +table.striped > caption { + font-weight: bold; + font-size: smaller; +} +table.borderless th, table.borderless td, +table.plain th, table.plain td, +table.striped th, table.striped td { + padding: 2px 5px; +} +table.borderless, +table.borderless > thead > tr > th, table.borderless > tbody > tr > th, table.borderless > tr > th, +table.borderless > thead > tr > td, table.borderless > tbody > tr > td, table.borderless > tr > td { + border: none; +} +table.borderless > thead > tr, table.borderless > tbody > tr, table.borderless > tr { + background-color: transparent; +} +table.plain { + border-collapse: collapse; + border: 1px solid black; +} +table.plain > thead > tr, table.plain > tbody tr, table.plain > tr { + background-color: transparent; +} +table.plain > thead > tr > th, table.plain > tbody > tr > th, table.plain > tr > th, +table.plain > thead > tr > td, table.plain > tbody > tr > td, table.plain > tr > td { + border: 1px solid black; +} +table.striped { + border-collapse: collapse; + border: 1px solid black; +} +table.striped > thead { + background-color: #E3E3E3; +} +table.striped > thead > tr > th, table.striped > thead > tr > td { + border: 1px solid black; +} +table.striped > tbody > tr:nth-child(even) { + background-color: #EEE +} +table.striped > tbody > tr:nth-child(odd) { + background-color: #FFF +} +table.striped > tbody > tr > th, table.striped > tbody > tr > td { + border-left: 1px solid black; + border-right: 1px solid black; +} +table.striped > tbody > tr > th { + font-weight: normal; +} +/** + * Tweak font sizes and paddings for small screens. + */ +@media screen and (max-width: 1050px) { + #search-input { + width: 300px; + } +} +@media screen and (max-width: 800px) { + #search-input { + width: 200px; + } + .top-nav, + .bottom-nav { + font-size: 11px; + padding-top: 6px; + } + .sub-nav { + font-size: 11px; + } + .about-language { + padding-right: 16px; + } + ul.nav-list li, + .sub-nav .nav-list-search { + padding: 6px; + } + ul.sub-nav-list li { + padding-top: 5px; + } + main { + padding: 10px; + } + .summary section[class$="-summary"], .details section[class$="-details"], + .class-uses .detail, .serialized-class-details { + padding: 0 8px 5px 8px; + } + body { + -webkit-text-size-adjust: none; + } +} +@media screen and (max-width: 500px) { + #search-input { + width: 150px; + } + .top-nav, + .bottom-nav { + font-size: 10px; + } + .sub-nav { + font-size: 10px; + } + .about-language { + font-size: 10px; + padding-right: 12px; + } +} diff --git a/docs/tag-search-index.js b/docs/tag-search-index.js new file mode 100644 index 000000000..bf10aaf6d --- /dev/null +++ b/docs/tag-search-index.js @@ -0,0 +1 @@ +tagSearchIndex = [{"l":"Constant Field Values","h":"","u":"constant-values.html"},{"l":"Serialized Form","h":"","u":"serialized-form.html"}];updateSearchResults(); \ No newline at end of file diff --git a/docs/type-search-index.js b/docs/type-search-index.js new file mode 100644 index 000000000..0ad1f45f6 --- /dev/null +++ b/docs/type-search-index.js @@ -0,0 +1 @@ +typeSearchIndex = [{"l":"All Classes and Interfaces","u":"allclasses-index.html"},{"p":"webserver.config","l":"AppConfig"},{"p":"model","l":"Article"},{"p":"db","l":"ArticleDao"},{"p":"webserver.handler","l":"ArticleIndexHandler"},{"p":"webserver.handler","l":"ArticleWriteHandler"},{"p":"webserver.config","l":"Config"},{"p":"db","l":"ConnectionManager"},{"p":"db","l":"Database"},{"p":"webserver.handler","l":"Handler"},{"p":"webserver","l":"HttpRequest"},{"p":"utils","l":"HttpRequestUtils"},{"p":"webserver","l":"HttpResponse"},{"p":"webserver.config","l":"HttpStatus"},{"p":"utils","l":"IOUtils"},{"p":"webserver.handler","l":"LikeHandler"},{"p":"webserver.handler","l":"LoginRequestHandler"},{"p":"webserver.handler","l":"LogoutRequestHandler"},{"p":"webserver.config","l":"MimeType"},{"p":"webserver","l":"MimeTypeTest"},{"p":"model","l":"MultipartPart"},{"p":"webserver.handler","l":"MyPageHandler"},{"p":"webserver","l":"PageRender"},{"p":"webserver.config","l":"Pair"},{"p":"webserver.handler","l":"ProfileUpdateHandler"},{"p":"webserver","l":"RequestHandler"},{"p":"webserver.handler","l":"RouteGuide"},{"p":"webserver","l":"SecurityInterceptor"},{"p":"db","l":"SessionDatabase"},{"p":"db","l":"SessionEntry"},{"p":"webserver","l":"SessionManager"},{"p":"webserver.http","l":"SessionManagerTest"},{"p":"webserver","l":"TemplateEngine"},{"p":"model","l":"User"},{"p":"db","l":"UserDao"},{"p":"webserver.handler","l":"UserRequestHandler"},{"p":"webserver","l":"WebServer"},{"p":"exception","l":"WebsServerException"}];updateSearchResults(); \ No newline at end of file diff --git a/docs/utils/HttpRequestUtils.html b/docs/utils/HttpRequestUtils.html new file mode 100644 index 000000000..76be4b056 --- /dev/null +++ b/docs/utils/HttpRequestUtils.html @@ -0,0 +1,223 @@ + + + + +HttpRequestUtils + + + + + + + + + + + + + + + +
    + +
    +
    + +
    +
    Package utils
    +

    Class HttpRequestUtils

    +
    +
    java.lang.Object +
    utils.HttpRequestUtils
    +
    +
    +
    +
    public class HttpRequestUtils +extends Object
    +
    +
    + +
    +
    +
      + +
    • +
      +

      Constructor Details

      +
        +
      • +
        +

        HttpRequestUtils

        +
        public HttpRequestUtils()
        +
        +
      • +
      +
      +
    • + +
    • +
      +

      Method Details

      +
        +
      • +
        +

        parseUrl

        +
        public static String parseUrl(String requestLine)
        +
        +
      • +
      • +
        +

        getFileExtension

        +
        public static String getFileExtension(String url)
        +
        +
      • +
      • +
        +

        parsePath

        +
        public static String parsePath(String url)
        +
        +
      • +
      • +
        +

        parseQueryString

        +
        public static String parseQueryString(String url)
        +
        +
      • +
      • +
        +

        parseParameters

        +
        public static Map<String,String> parseParameters(String queryString)
        +
        +
      • +
      • +
        +

        parseCookies

        +
        public static Map<String,String> parseCookies(String cookieHeaderValue)
        +
        +
      • +
      • +
        +

        parseHeader

        +
        public static Pair parseHeader(String headerLine)
        +
        +
      • +
      • +
        +

        parseMultipartBody

        +
        public static List<MultipartPart> parseMultipartBody(byte[] body, + String boundary)
        +
        +
      • +
      +
      +
    • +
    +
    + +
    +
    +
    + + diff --git a/docs/utils/IOUtils.html b/docs/utils/IOUtils.html new file mode 100644 index 000000000..b33ca4889 --- /dev/null +++ b/docs/utils/IOUtils.html @@ -0,0 +1,165 @@ + + + + +IOUtils + + + + + + + + + + + + + + + +
    + +
    +
    + +
    +
    Package utils
    +

    Class IOUtils

    +
    +
    java.lang.Object +
    utils.IOUtils
    +
    +
    +
    +
    public class IOUtils +extends Object
    +
    +
    + +
    +
    +
      + +
    • +
      +

      Constructor Details

      +
        +
      • +
        +

        IOUtils

        +
        public IOUtils()
        +
        +
      • +
      +
      +
    • + +
    • +
      +

      Method Details

      + +
      +
    • +
    +
    + +
    +
    +
    + + diff --git a/docs/utils/package-summary.html b/docs/utils/package-summary.html new file mode 100644 index 000000000..ea8a97ab6 --- /dev/null +++ b/docs/utils/package-summary.html @@ -0,0 +1,84 @@ + + + + +utils + + + + + + + + + + + + + + + +
    + +
    +
    +
    +

    Package utils

    +
    +
    +
    package utils
    +
    + +
    +
    +
    +
    + + diff --git a/docs/utils/package-tree.html b/docs/utils/package-tree.html new file mode 100644 index 000000000..ac651c1d5 --- /dev/null +++ b/docs/utils/package-tree.html @@ -0,0 +1,72 @@ + + + + +utils Class Hierarchy + + + + + + + + + + + + + + + +
    + +
    +
    +
    +

    Hierarchy For Package utils

    +Package Hierarchies: + +
    +
    +

    Class Hierarchy

    + +
    +
    +
    +
    + + diff --git a/docs/webserver/HttpRequest.html b/docs/webserver/HttpRequest.html new file mode 100644 index 000000000..b9bd17c88 --- /dev/null +++ b/docs/webserver/HttpRequest.html @@ -0,0 +1,226 @@ + + + + +HttpRequest + + + + + + + + + + + + + + + +
    + +
    +
    + +
    +
    Package webserver
    +

    Class HttpRequest

    +
    +
    java.lang.Object +
    webserver.HttpRequest
    +
    +
    +
    +
    public class HttpRequest +extends Object
    +
    +
    + +
    +
    +
      + +
    • +
      +

      Constructor Details

      + +
      +
    • + +
    • +
      +

      Method Details

      +
        +
      • +
        +

        getMethod

        +
        public String getMethod()
        +
        +
      • +
      • +
        +

        getUrl

        +
        public String getUrl()
        +
        +
      • +
      • +
        +

        getPath

        +
        public String getPath()
        +
        +
      • +
      • +
        +

        getQueryString

        +
        public String getQueryString()
        +
        +
      • +
      • +
        +

        getParameter

        +
        public String getParameter(String name)
        +
        +
      • +
      • +
        +

        getContentLength

        +
        public int getContentLength()
        +
        +
      • +
      • +
        +

        getCookie

        +
        public String getCookie(String name)
        +
        +
      • +
      • +
        +

        getMultipartParts

        +
        public List<MultipartPart> getMultipartParts()
        +
        +
      • +
      +
      +
    • +
    +
    + +
    +
    +
    + + diff --git a/docs/webserver/HttpResponse.html b/docs/webserver/HttpResponse.html new file mode 100644 index 000000000..1aa38774a --- /dev/null +++ b/docs/webserver/HttpResponse.html @@ -0,0 +1,229 @@ + + + + +HttpResponse + + + + + + + + + + + + + + + +
    + +
    +
    + +
    +
    Package webserver
    +

    Class HttpResponse

    +
    +
    java.lang.Object +
    webserver.HttpResponse
    +
    +
    +
    +
    public class HttpResponse +extends Object
    +
    +
    + +
    +
    +
      + +
    • +
      +

      Field Details

      +
        +
      • +
        +

        logger

        +
        public static final org.slf4j.Logger logger
        +
        +
      • +
      +
      +
    • + +
    • +
      +

      Constructor Details

      +
        +
      • +
        +

        HttpResponse

        +
        public HttpResponse(OutputStream out)
        +
        +
      • +
      +
      +
    • + +
    • +
      +

      Method Details

      +
        +
      • +
        +

        addHeader

        +
        public void addHeader(String key, + String value)
        +
        +
      • +
      • +
        +

        sendError

        +
        public void sendError(HttpStatus status)
        +
        +
      • +
      • +
        +

        sendRedirect

        +
        public void sendRedirect(String redirectUrl)
        +
        +
      • +
      • +
        +

        fileResponse

        +
        public void fileResponse(String url, + User loginUser, + Map<String,String> additionalModel)
        +
        +
      • +
      • +
        +

        sendHtmlContent

        +
        public void sendHtmlContent(String content)
        +
        +
      • +
      +
      +
    • +
    +
    + +
    +
    +
    + + diff --git a/docs/webserver/MimeTypeTest.html b/docs/webserver/MimeTypeTest.html new file mode 100644 index 000000000..90b6fa9c5 --- /dev/null +++ b/docs/webserver/MimeTypeTest.html @@ -0,0 +1,127 @@ + + + + +MimeTypeTest + + + + + + + + + + + + + + + +
    + +
    +
    + +
    +
    Package webserver
    +

    Class MimeTypeTest

    +
    +
    java.lang.Object +
    webserver.MimeTypeTest
    +
    +
    +
    +
    public class MimeTypeTest +extends Object
    +
    +
    + +
    +
    +
      + +
    • +
      +

      Constructor Details

      +
        +
      • +
        +

        MimeTypeTest

        +
        public MimeTypeTest()
        +
        +
      • +
      +
      +
    • +
    +
    + +
    +
    +
    + + diff --git a/docs/webserver/PageRender.html b/docs/webserver/PageRender.html new file mode 100644 index 000000000..1f5704e3a --- /dev/null +++ b/docs/webserver/PageRender.html @@ -0,0 +1,191 @@ + + + + +PageRender + + + + + + + + + + + + + + + +
    + +
    +
    + +
    +
    Package webserver
    +

    Class PageRender

    +
    +
    java.lang.Object +
    webserver.PageRender
    +
    +
    +
    +
    public class PageRender +extends Object
    +
    +
    + +
    +
    +
      + +
    • +
      +

      Constructor Details

      +
        +
      • +
        +

        PageRender

        +
        public PageRender()
        +
        +
      • +
      +
      +
    • + +
    • +
      +

      Method Details

      +
        +
      • +
        +

        renderHeader

        +
        public static String renderHeader(User loginUser)
        +
        +
      • +
      • +
        +

        renderArticleList

        +
        public static String renderArticleList(List<Article> articles, + UserDao userDao)
        +
        +
      • +
      • +
        +

        renderProfile

        +
        public static String renderProfile(User user)
        +
        +
      • +
      • +
        +

        renderLatestArticle

        +
        public static String renderLatestArticle(Article article, + User writer, + int commentCount)
        +
        +
      • +
      +
      +
    • +
    +
    + +
    +
    +
    + + diff --git a/docs/webserver/RequestHandler.html b/docs/webserver/RequestHandler.html new file mode 100644 index 000000000..30d6f472e --- /dev/null +++ b/docs/webserver/RequestHandler.html @@ -0,0 +1,171 @@ + + + + +RequestHandler + + + + + + + + + + + + + + + +
    + +
    +
    + +
    +
    Package webserver
    +

    Class RequestHandler

    +
    +
    java.lang.Object +
    webserver.RequestHandler
    +
    +
    +
    +
    All Implemented Interfaces:
    +
    Runnable
    +
    +
    +
    public class RequestHandler +extends Object +implements Runnable
    +
    +
    + +
    +
    +
      + +
    • +
      +

      Constructor Details

      +
        +
      • +
        +

        RequestHandler

        +
        public RequestHandler(Socket connectionSocket, + RouteGuide routeGuide, + UserDao userDao)
        +
        +
      • +
      +
      +
    • + +
    • +
      +

      Method Details

      +
        +
      • +
        +

        run

        +
        public void run()
        +
        +
        Specified by:
        +
        run in interface Runnable
        +
        +
        +
      • +
      +
      +
    • +
    +
    + +
    +
    +
    + + diff --git a/docs/webserver/SecurityInterceptor.html b/docs/webserver/SecurityInterceptor.html new file mode 100644 index 000000000..e04087ab9 --- /dev/null +++ b/docs/webserver/SecurityInterceptor.html @@ -0,0 +1,160 @@ + + + + +SecurityInterceptor + + + + + + + + + + + + + + + +
    + +
    +
    + +
    +
    Package webserver
    +

    Class SecurityInterceptor

    +
    +
    java.lang.Object +
    webserver.SecurityInterceptor
    +
    +
    +
    +
    public class SecurityInterceptor +extends Object
    +
    +
    + +
    +
    +
      + +
    • +
      +

      Constructor Details

      +
        +
      • +
        +

        SecurityInterceptor

        +
        public SecurityInterceptor()
        +
        +
      • +
      +
      +
    • + +
    • +
      +

      Method Details

      +
        +
      • +
        +

        preHandler

        +
        public static boolean preHandler(String path, + User loginUser)
        +
        +
      • +
      +
      +
    • +
    +
    + +
    +
    +
    + + diff --git a/docs/webserver/SessionManager.html b/docs/webserver/SessionManager.html new file mode 100644 index 000000000..b1d555a27 --- /dev/null +++ b/docs/webserver/SessionManager.html @@ -0,0 +1,209 @@ + + + + +SessionManager + + + + + + + + + + + + + + + +
    + +
    +
    + +
    +
    Package webserver
    +

    Class SessionManager

    +
    +
    java.lang.Object +
    webserver.SessionManager
    +
    +
    +
    +
    public class SessionManager +extends Object
    +
    +
    + +
    +
    +
      + +
    • +
      +

      Constructor Details

      +
        +
      • +
        +

        SessionManager

        +
        public SessionManager()
        +
        +
      • +
      +
      +
    • + +
    • +
      +

      Method Details

      +
        +
      • +
        +

        createSession

        +
        public static String createSession(User user)
        +
        +
      • +
      • +
        +

        getSessionUser

        +
        public static User getSessionUser(String sessionId, + UserDao userDao)
        +
        +
      • +
      • +
        +

        getLoginUser

        +
        public static User getLoginUser(String sessionId, + UserDao userDao)
        +
        +
      • +
      • +
        +

        isExpired

        +
        public static boolean isExpired(SessionEntry entry)
        +
        +
      • +
      • +
        +

        getSessionCookieValue

        +
        public static String getSessionCookieValue(String sessionId)
        +
        +
      • +
      • +
        +

        getUserBySessionId

        +
        public static User getUserBySessionId(String sessionId, + Database database)
        +
        +
      • +
      +
      +
    • +
    +
    + +
    +
    +
    + + diff --git a/docs/webserver/TemplateEngine.html b/docs/webserver/TemplateEngine.html new file mode 100644 index 000000000..c12816de0 --- /dev/null +++ b/docs/webserver/TemplateEngine.html @@ -0,0 +1,160 @@ + + + + +TemplateEngine + + + + + + + + + + + + + + + +
    + +
    +
    + +
    +
    Package webserver
    +

    Class TemplateEngine

    +
    +
    java.lang.Object +
    webserver.TemplateEngine
    +
    +
    +
    +
    public class TemplateEngine +extends Object
    +
    +
    + +
    +
    +
      + +
    • +
      +

      Constructor Details

      +
        +
      • +
        +

        TemplateEngine

        +
        public TemplateEngine()
        +
        +
      • +
      +
      +
    • + +
    • +
      +

      Method Details

      + +
      +
    • +
    +
    + +
    +
    +
    + + diff --git a/docs/webserver/WebServer.html b/docs/webserver/WebServer.html new file mode 100644 index 000000000..70021ea53 --- /dev/null +++ b/docs/webserver/WebServer.html @@ -0,0 +1,163 @@ + + + + +WebServer + + + + + + + + + + + + + + + +
    + +
    +
    + +
    +
    Package webserver
    +

    Class WebServer

    +
    +
    java.lang.Object +
    webserver.WebServer
    +
    +
    +
    +
    public class WebServer +extends Object
    +
    +
    + +
    +
    +
      + +
    • +
      +

      Constructor Details

      +
        +
      • +
        +

        WebServer

        +
        public WebServer()
        +
        +
      • +
      +
      +
    • + +
    • +
      +

      Method Details

      + +
      +
    • +
    +
    + +
    +
    +
    + + diff --git a/docs/webserver/config/AppConfig.html b/docs/webserver/config/AppConfig.html new file mode 100644 index 000000000..bc4ad4c62 --- /dev/null +++ b/docs/webserver/config/AppConfig.html @@ -0,0 +1,167 @@ + + + + +AppConfig + + + + + + + + + + + + + + + +
    + +
    +
    + +
    + +

    Class AppConfig

    +
    +
    java.lang.Object +
    webserver.config.AppConfig
    +
    +
    +
    +
    public class AppConfig +extends Object
    +
    +
    + +
    +
    +
      + +
    • +
      +

      Constructor Details

      +
        +
      • +
        +

        AppConfig

        +
        public AppConfig()
        +
        +
      • +
      +
      +
    • + +
    • +
      +

      Method Details

      +
        +
      • +
        +

        getRouteMappings

        +
        public static Map<String,Handler> getRouteMappings()
        +
        +
      • +
      • +
        +

        getUserDao

        +
        public static UserDao getUserDao()
        +
        +
      • +
      +
      +
    • +
    +
    + +
    +
    +
    + + diff --git a/docs/webserver/config/Config.html b/docs/webserver/config/Config.html new file mode 100644 index 000000000..95b4a7582 --- /dev/null +++ b/docs/webserver/config/Config.html @@ -0,0 +1,368 @@ + + + + +Config + + + + + + + + + + + + + + + +
    + +
    +
    + +
    + +

    Class Config

    +
    +
    java.lang.Object +
    webserver.config.Config
    +
    +
    +
    +
    public class Config +extends Object
    +
    +
    + +
    +
    + +
    + +
    +
    +
    + + diff --git a/docs/webserver/config/HttpStatus.html b/docs/webserver/config/HttpStatus.html new file mode 100644 index 000000000..a10b8efa5 --- /dev/null +++ b/docs/webserver/config/HttpStatus.html @@ -0,0 +1,297 @@ + + + + +HttpStatus + + + + + + + + + + + + + + + +
    + +
    +
    + +
    + +

    Enum Class HttpStatus

    +
    +
    java.lang.Object +
    java.lang.Enum<HttpStatus> +
    webserver.config.HttpStatus
    +
    +
    +
    +
    +
    All Implemented Interfaces:
    +
    Serializable, Comparable<HttpStatus>, Constable
    +
    +
    +
    public enum HttpStatus +extends Enum<HttpStatus>
    +
    +
    + +
    +
    +
      + +
    • +
      +

      Enum Constant Details

      +
        +
      • +
        +

        OK

        +
        public static final HttpStatus OK
        +
        +
      • +
      • +
        +

        FOUND

        +
        public static final HttpStatus FOUND
        +
        +
      • +
      • +
        +

        FORBIDDEN

        +
        public static final HttpStatus FORBIDDEN
        +
        +
      • +
      • +
        +

        BAD_REQUEST

        +
        public static final HttpStatus BAD_REQUEST
        +
        +
      • +
      • +
        +

        NOT_FOUND

        +
        public static final HttpStatus NOT_FOUND
        +
        +
      • +
      • +
        +

        METHOD_NOT_ALLOWED

        +
        public static final HttpStatus METHOD_NOT_ALLOWED
        +
        +
      • +
      • +
        +

        INTERNAL_SERVER_ERROR

        +
        public static final HttpStatus INTERNAL_SERVER_ERROR
        +
        +
      • +
      +
      +
    • + +
    • +
      +

      Method Details

      +
        +
      • +
        +

        values

        +
        public static HttpStatus[] values()
        +
        Returns an array containing the constants of this enum class, in +the order they are declared.
        +
        +
        Returns:
        +
        an array containing the constants of this enum class, in the order they are declared
        +
        +
        +
      • +
      • +
        +

        valueOf

        +
        public static HttpStatus valueOf(String name)
        +
        Returns the enum constant of this class with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this class. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        IllegalArgumentException - if this enum class has no constant with the specified name
        +
        NullPointerException - if the argument is null
        +
        +
        +
      • +
      • +
        +

        getErrorMessageBytes

        +
        public byte[] getErrorMessageBytes()
        +
        +
      • +
      • +
        +

        getCode

        +
        public int getCode()
        +
        +
      • +
      • +
        +

        getMessage

        +
        public String getMessage()
        +
        +
      • +
      • +
        +

        toString

        +
        public String toString()
        +
        +
        Overrides:
        +
        toString in class Enum<HttpStatus>
        +
        +
        +
      • +
      +
      +
    • +
    +
    + +
    +
    +
    + + diff --git a/docs/webserver/config/MimeType.html b/docs/webserver/config/MimeType.html new file mode 100644 index 000000000..ebb4658f0 --- /dev/null +++ b/docs/webserver/config/MimeType.html @@ -0,0 +1,274 @@ + + + + +MimeType + + + + + + + + + + + + + + + +
    + +
    +
    + +
    + +

    Enum Class MimeType

    +
    +
    java.lang.Object +
    java.lang.Enum<MimeType> +
    webserver.config.MimeType
    +
    +
    +
    +
    +
    All Implemented Interfaces:
    +
    Serializable, Comparable<MimeType>, Constable
    +
    +
    +
    public enum MimeType +extends Enum<MimeType>
    +
    +
    + +
    +
    +
      + +
    • +
      +

      Enum Constant Details

      +
        +
      • +
        +

        HTML

        +
        public static final MimeType HTML
        +
        +
      • +
      • +
        +

        CSS

        +
        public static final MimeType CSS
        +
        +
      • +
      • +
        +

        JS

        +
        public static final MimeType JS
        +
        +
      • +
      • +
        +

        ICO

        +
        public static final MimeType ICO
        +
        +
      • +
      • +
        +

        PNG

        +
        public static final MimeType PNG
        +
        +
      • +
      • +
        +

        JPG

        +
        public static final MimeType JPG
        +
        +
      • +
      • +
        +

        SVG

        +
        public static final MimeType SVG
        +
        +
      • +
      • +
        +

        DEFAULT

        +
        public static final MimeType DEFAULT
        +
        +
      • +
      +
      +
    • + +
    • +
      +

      Method Details

      +
        +
      • +
        +

        values

        +
        public static MimeType[] values()
        +
        Returns an array containing the constants of this enum class, in +the order they are declared.
        +
        +
        Returns:
        +
        an array containing the constants of this enum class, in the order they are declared
        +
        +
        +
      • +
      • +
        +

        valueOf

        +
        public static MimeType valueOf(String name)
        +
        Returns the enum constant of this class with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this class. (Extraneous whitespace characters are +not permitted.)
        +
        +
        Parameters:
        +
        name - the name of the enum constant to be returned.
        +
        Returns:
        +
        the enum constant with the specified name
        +
        Throws:
        +
        IllegalArgumentException - if this enum class has no constant with the specified name
        +
        NullPointerException - if the argument is null
        +
        +
        +
      • +
      • +
        +

        getContentType

        +
        public static String getContentType(String ext)
        +
        +
      • +
      +
      +
    • +
    +
    + +
    +
    +
    + + diff --git a/docs/webserver/config/Pair.html b/docs/webserver/config/Pair.html new file mode 100644 index 000000000..96d523974 --- /dev/null +++ b/docs/webserver/config/Pair.html @@ -0,0 +1,167 @@ + + + + +Pair + + + + + + + + + + + + + + + +
    + +
    +
    + +
    + +

    Class Pair

    +
    +
    java.lang.Object +
    webserver.config.Pair
    +
    +
    +
    +
    public class Pair +extends Object
    +
    +
    + +
    +
    +
      + +
    • +
      +

      Field Details

      +
        +
      • +
        +

        key

        +
        public final String key
        +
        +
      • +
      • +
        +

        value

        +
        public final String value
        +
        +
      • +
      +
      +
    • + +
    • +
      +

      Constructor Details

      +
        +
      • +
        +

        Pair

        +
        public Pair(String key, + String value)
        +
        +
      • +
      +
      +
    • +
    +
    + +
    +
    +
    + + diff --git a/docs/webserver/config/package-summary.html b/docs/webserver/config/package-summary.html new file mode 100644 index 000000000..80b34a5b0 --- /dev/null +++ b/docs/webserver/config/package-summary.html @@ -0,0 +1,111 @@ + + + + +webserver.config + + + + + + + + + + + + + + + +
    + +
    +
    +
    +

    Package webserver.config

    +
    +
    +
    package webserver.config
    +
    + +
    +
    +
    +
    + + diff --git a/docs/webserver/config/package-tree.html b/docs/webserver/config/package-tree.html new file mode 100644 index 000000000..e380a37a2 --- /dev/null +++ b/docs/webserver/config/package-tree.html @@ -0,0 +1,88 @@ + + + + +webserver.config Class Hierarchy + + + + + + + + + + + + + + + +
    + +
    +
    +
    +

    Hierarchy For Package webserver.config

    +Package Hierarchies: + +
    +
    +

    Class Hierarchy

    + +
    +
    +

    Enum Class Hierarchy

    + +
    +
    +
    +
    + + diff --git a/docs/webserver/handler/ArticleIndexHandler.html b/docs/webserver/handler/ArticleIndexHandler.html new file mode 100644 index 000000000..11578eb19 --- /dev/null +++ b/docs/webserver/handler/ArticleIndexHandler.html @@ -0,0 +1,171 @@ + + + + +ArticleIndexHandler + + + + + + + + + + + + + + + +
    + +
    +
    + +
    + +

    Class ArticleIndexHandler

    +
    +
    java.lang.Object +
    webserver.handler.ArticleIndexHandler
    +
    +
    +
    +
    All Implemented Interfaces:
    +
    Handler
    +
    +
    +
    public class ArticleIndexHandler +extends Object +implements Handler
    +
    +
    + +
    +
    +
      + +
    • +
      +

      Constructor Details

      +
        +
      • +
        +

        ArticleIndexHandler

        +
        public ArticleIndexHandler(ArticleDao articleDao, + UserDao userDao)
        +
        +
      • +
      +
      +
    • + +
    • +
      +

      Method Details

      + +
      +
    • +
    +
    + +
    +
    +
    + + diff --git a/docs/webserver/handler/ArticleWriteHandler.html b/docs/webserver/handler/ArticleWriteHandler.html new file mode 100644 index 000000000..1b09d8ff8 --- /dev/null +++ b/docs/webserver/handler/ArticleWriteHandler.html @@ -0,0 +1,180 @@ + + + + +ArticleWriteHandler + + + + + + + + + + + + + + + +
    + +
    +
    + +
    + +

    Class ArticleWriteHandler

    +
    +
    java.lang.Object +
    webserver.handler.ArticleWriteHandler
    +
    +
    +
    +
    All Implemented Interfaces:
    +
    Handler
    +
    +
    +
    public class ArticleWriteHandler +extends Object +implements Handler
    +
    게시글 작성 요청을 처리하는 핸들러 클래스 + 사용자가 입력한 게시글 데이터와 업로드된 이미지를 저장
    +
    +
    + +
    +
    +
      + +
    • +
      +

      Constructor Details

      +
        +
      • +
        +

        ArticleWriteHandler

        +
        public ArticleWriteHandler(ArticleDao articleDao, + UserDao userDao)
        +
        +
      • +
      +
      +
    • + +
    • +
      +

      Method Details

      +
        +
      • +
        +

        process

        +
        public void process(HttpRequest request, + HttpResponse response)
        +
        게시글 작성 요청을 처리하여 DB에 저장하고 메인 페이지로 리다이렉트 + * @param request 클라이언트의 HTTP 요청 정보 객체
        +
        +
        Specified by:
        +
        process in interface Handler
        +
        Parameters:
        +
        response - 서버의 HTTP 응답 제어 객체
        +
        +
        +
      • +
      +
      +
    • +
    +
    + +
    +
    +
    + + diff --git a/docs/webserver/handler/Handler.html b/docs/webserver/handler/Handler.html new file mode 100644 index 000000000..2fa54b282 --- /dev/null +++ b/docs/webserver/handler/Handler.html @@ -0,0 +1,130 @@ + + + + +Handler + + + + + + + + + + + + + + + +
    + +
    +
    + +
    + +

    Interface Handler

    +
    +
    +
    +
    All Known Implementing Classes:
    +
    ArticleIndexHandler, ArticleWriteHandler, LikeHandler, LoginRequestHandler, LogoutRequestHandler, MyPageHandler, ProfileUpdateHandler, UserRequestHandler
    +
    +
    +
    public interface Handler
    +
    +
    +
      + +
    • +
      +

      Method Summary

      +
      +
      +
      +
      +
      Modifier and Type
      +
      Method
      +
      Description
      +
      void
      +
      process(HttpRequest request, + HttpResponse response)
      +
       
      +
      +
      +
      +
      +
    • +
    +
    +
    + +
    + +
    +
    +
    + + diff --git a/docs/webserver/handler/LikeHandler.html b/docs/webserver/handler/LikeHandler.html new file mode 100644 index 000000000..88bfcc27b --- /dev/null +++ b/docs/webserver/handler/LikeHandler.html @@ -0,0 +1,169 @@ + + + + +LikeHandler + + + + + + + + + + + + + + + +
    + +
    +
    + +
    + +

    Class LikeHandler

    +
    +
    java.lang.Object +
    webserver.handler.LikeHandler
    +
    +
    +
    +
    All Implemented Interfaces:
    +
    Handler
    +
    +
    +
    public class LikeHandler +extends Object +implements Handler
    +
    +
    + +
    +
    +
      + +
    • +
      +

      Constructor Details

      +
        +
      • +
        +

        LikeHandler

        +
        public LikeHandler(ArticleDao articleDao)
        +
        +
      • +
      +
      +
    • + +
    • +
      +

      Method Details

      + +
      +
    • +
    +
    + +
    +
    +
    + + diff --git a/docs/webserver/handler/LoginRequestHandler.html b/docs/webserver/handler/LoginRequestHandler.html new file mode 100644 index 000000000..63c9adc58 --- /dev/null +++ b/docs/webserver/handler/LoginRequestHandler.html @@ -0,0 +1,169 @@ + + + + +LoginRequestHandler + + + + + + + + + + + + + + + +
    + +
    +
    + +
    + +

    Class LoginRequestHandler

    +
    +
    java.lang.Object +
    webserver.handler.LoginRequestHandler
    +
    +
    +
    +
    All Implemented Interfaces:
    +
    Handler
    +
    +
    +
    public class LoginRequestHandler +extends Object +implements Handler
    +
    +
    + +
    +
    +
      + +
    • +
      +

      Constructor Details

      +
        +
      • +
        +

        LoginRequestHandler

        +
        public LoginRequestHandler(UserDao userDao)
        +
        +
      • +
      +
      +
    • + +
    • +
      +

      Method Details

      + +
      +
    • +
    +
    + +
    +
    +
    + + diff --git a/docs/webserver/handler/LogoutRequestHandler.html b/docs/webserver/handler/LogoutRequestHandler.html new file mode 100644 index 000000000..ac3259650 --- /dev/null +++ b/docs/webserver/handler/LogoutRequestHandler.html @@ -0,0 +1,169 @@ + + + + +LogoutRequestHandler + + + + + + + + + + + + + + + +
    + +
    +
    + +
    + +

    Class LogoutRequestHandler

    +
    +
    java.lang.Object +
    webserver.handler.LogoutRequestHandler
    +
    +
    +
    +
    All Implemented Interfaces:
    +
    Handler
    +
    +
    +
    public class LogoutRequestHandler +extends Object +implements Handler
    +
    +
    + +
    +
    +
      + +
    • +
      +

      Constructor Details

      +
        +
      • +
        +

        LogoutRequestHandler

        +
        public LogoutRequestHandler(UserDao userDao)
        +
        +
      • +
      +
      +
    • + +
    • +
      +

      Method Details

      + +
      +
    • +
    +
    + +
    +
    +
    + + diff --git a/docs/webserver/handler/MyPageHandler.html b/docs/webserver/handler/MyPageHandler.html new file mode 100644 index 000000000..eb4060f7c --- /dev/null +++ b/docs/webserver/handler/MyPageHandler.html @@ -0,0 +1,169 @@ + + + + +MyPageHandler + + + + + + + + + + + + + + + +
    + +
    +
    + +
    + +

    Class MyPageHandler

    +
    +
    java.lang.Object +
    webserver.handler.MyPageHandler
    +
    +
    +
    +
    All Implemented Interfaces:
    +
    Handler
    +
    +
    +
    public class MyPageHandler +extends Object +implements Handler
    +
    +
    + +
    +
    +
      + +
    • +
      +

      Constructor Details

      +
        +
      • +
        +

        MyPageHandler

        +
        public MyPageHandler(UserDao userDao)
        +
        +
      • +
      +
      +
    • + +
    • +
      +

      Method Details

      + +
      +
    • +
    +
    + +
    +
    +
    + + diff --git a/docs/webserver/handler/ProfileUpdateHandler.html b/docs/webserver/handler/ProfileUpdateHandler.html new file mode 100644 index 000000000..159598c99 --- /dev/null +++ b/docs/webserver/handler/ProfileUpdateHandler.html @@ -0,0 +1,169 @@ + + + + +ProfileUpdateHandler + + + + + + + + + + + + + + + +
    + +
    +
    + +
    + +

    Class ProfileUpdateHandler

    +
    +
    java.lang.Object +
    webserver.handler.ProfileUpdateHandler
    +
    +
    +
    +
    All Implemented Interfaces:
    +
    Handler
    +
    +
    +
    public class ProfileUpdateHandler +extends Object +implements Handler
    +
    +
    + +
    +
    +
      + +
    • +
      +

      Constructor Details

      +
        +
      • +
        +

        ProfileUpdateHandler

        +
        public ProfileUpdateHandler(UserDao userDao)
        +
        +
      • +
      +
      +
    • + +
    • +
      +

      Method Details

      + +
      +
    • +
    +
    + +
    +
    +
    + + diff --git a/docs/webserver/handler/RouteGuide.html b/docs/webserver/handler/RouteGuide.html new file mode 100644 index 000000000..9496520aa --- /dev/null +++ b/docs/webserver/handler/RouteGuide.html @@ -0,0 +1,158 @@ + + + + +RouteGuide + + + + + + + + + + + + + + + +
    + +
    +
    + +
    + +

    Class RouteGuide

    +
    +
    java.lang.Object +
    webserver.handler.RouteGuide
    +
    +
    +
    +
    public class RouteGuide +extends Object
    +
    +
    + +
    +
    +
      + +
    • +
      +

      Constructor Details

      + +
      +
    • + +
    • +
      +

      Method Details

      +
        +
      • +
        +

        findHandler

        +
        public Handler findHandler(String path)
        +
        +
      • +
      +
      +
    • +
    +
    + +
    +
    +
    + + diff --git a/docs/webserver/handler/UserRequestHandler.html b/docs/webserver/handler/UserRequestHandler.html new file mode 100644 index 000000000..b61d1b47c --- /dev/null +++ b/docs/webserver/handler/UserRequestHandler.html @@ -0,0 +1,198 @@ + + + + +UserRequestHandler + + + + + + + + + + + + + + + +
    + +
    +
    + +
    + +

    Class UserRequestHandler

    +
    +
    java.lang.Object +
    webserver.handler.UserRequestHandler
    +
    +
    +
    +
    All Implemented Interfaces:
    +
    Handler
    +
    +
    +
    public class UserRequestHandler +extends Object +implements Handler
    +
    +
    + +
    +
    +
      + +
    • +
      +

      Field Details

      +
        +
      • +
        +

        logger

        +
        public static final org.slf4j.Logger logger
        +
        +
      • +
      +
      +
    • + +
    • +
      +

      Constructor Details

      +
        +
      • +
        +

        UserRequestHandler

        +
        public UserRequestHandler(UserDao userDao)
        +
        +
      • +
      +
      +
    • + +
    • +
      +

      Method Details

      + +
      +
    • +
    +
    + +
    +
    +
    + + diff --git a/docs/webserver/handler/package-summary.html b/docs/webserver/handler/package-summary.html new file mode 100644 index 000000000..9cea3d1d8 --- /dev/null +++ b/docs/webserver/handler/package-summary.html @@ -0,0 +1,124 @@ + + + + +webserver.handler + + + + + + + + + + + + + + + +
    + +
    +
    +
    +

    Package webserver.handler

    +
    +
    +
    package webserver.handler
    +
    + +
    +
    +
    +
    + + diff --git a/docs/webserver/handler/package-tree.html b/docs/webserver/handler/package-tree.html new file mode 100644 index 000000000..6a3aa6468 --- /dev/null +++ b/docs/webserver/handler/package-tree.html @@ -0,0 +1,85 @@ + + + + +webserver.handler Class Hierarchy + + + + + + + + + + + + + + + +
    + +
    +
    +
    +

    Hierarchy For Package webserver.handler

    +Package Hierarchies: + +
    +
    +

    Class Hierarchy

    + +
    +
    +

    Interface Hierarchy

    + +
    +
    +
    +
    + + diff --git a/docs/webserver/http/SessionManagerTest.html b/docs/webserver/http/SessionManagerTest.html new file mode 100644 index 000000000..4c79b9d7b --- /dev/null +++ b/docs/webserver/http/SessionManagerTest.html @@ -0,0 +1,127 @@ + + + + +SessionManagerTest + + + + + + + + + + + + + + + +
    + +
    +
    + +
    + +

    Class SessionManagerTest

    +
    +
    java.lang.Object +
    webserver.http.SessionManagerTest
    +
    +
    +
    +
    public class SessionManagerTest +extends Object
    +
    +
    + +
    +
    +
      + +
    • +
      +

      Constructor Details

      +
        +
      • +
        +

        SessionManagerTest

        +
        public SessionManagerTest()
        +
        +
      • +
      +
      +
    • +
    +
    + +
    +
    +
    + + diff --git a/docs/webserver/http/package-summary.html b/docs/webserver/http/package-summary.html new file mode 100644 index 000000000..4f117b911 --- /dev/null +++ b/docs/webserver/http/package-summary.html @@ -0,0 +1,97 @@ + + + + +webserver.http + + + + + + + + + + + + + + + +
    + +
    +
    +
    +

    Package webserver.http

    +
    +
    +
    package webserver.http
    +
    + +
    +
    +
    +
    + + diff --git a/docs/webserver/http/package-tree.html b/docs/webserver/http/package-tree.html new file mode 100644 index 000000000..9500ae866 --- /dev/null +++ b/docs/webserver/http/package-tree.html @@ -0,0 +1,71 @@ + + + + +webserver.http Class Hierarchy + + + + + + + + + + + + + + + +
    + +
    +
    +
    +

    Hierarchy For Package webserver.http

    +Package Hierarchies: + +
    +
    +

    Class Hierarchy

    + +
    +
    +
    +
    + + diff --git a/docs/webserver/package-summary.html b/docs/webserver/package-summary.html new file mode 100644 index 000000000..020b0a4fd --- /dev/null +++ b/docs/webserver/package-summary.html @@ -0,0 +1,113 @@ + + + + +webserver + + + + + + + + + + + + + + + +
    + +
    +
    +
    +

    Package webserver

    +
    +
    +
    package webserver
    +
    + +
    +
    +
    +
    + + diff --git a/docs/webserver/package-tree.html b/docs/webserver/package-tree.html new file mode 100644 index 000000000..08cdfa409 --- /dev/null +++ b/docs/webserver/package-tree.html @@ -0,0 +1,79 @@ + + + + +webserver Class Hierarchy + + + + + + + + + + + + + + + +
    + +
    +
    +
    +

    Hierarchy For Package webserver

    +Package Hierarchies: + +
    +
    +

    Class Hierarchy

    + +
    +
    +
    +
    + + diff --git a/src/main/java/db/ArticleDao.java b/src/main/java/db/ArticleDao.java new file mode 100644 index 000000000..4affba395 --- /dev/null +++ b/src/main/java/db/ArticleDao.java @@ -0,0 +1,147 @@ +package db; + +import model.Article; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.sql.*; +import java.util.ArrayList; +import java.util.List; + +public class ArticleDao { + private static final Logger logger = LoggerFactory.getLogger(Article.class); + + // 게시글 저장 + public void insert(Article article) { + String sql = "INSERT INTO ARTICLE (writer, title, contents, imagePath) VALUES (?, ?, ?, ?)"; + + try (Connection connection = ConnectionManager.getConnection(); + PreparedStatement pstmt = connection.prepareStatement(sql)) { + + pstmt.setString(1, article.writer()); + pstmt.setString(2, article.title()); + pstmt.setString(3, article.contents()); + pstmt.setString(4, article.imagePath()); + + pstmt.executeUpdate(); + } catch (SQLException e) { + throw new RuntimeException("Failed to save article: " + e.getMessage()); + } + } + + // 게시글 조회 + public List
    selectAll() { + String sql = "SELECT * FROM ARTICLE ORDER BY createdAt DESC"; + List
    articles = new ArrayList<>(); + + try (Connection connection = ConnectionManager.getConnection(); + Statement stmt = connection.createStatement(); + ResultSet rs = stmt.executeQuery(sql)) { + + while (rs.next()) { + Article article = new Article( + rs.getLong("id"), + rs.getString("writer"), + rs.getString("title"), + rs.getString("contents"), + rs.getTimestamp("createdAt").toLocalDateTime(), + rs.getString("imagePath"), + rs.getInt("likeCount") + ); + articles.add(article); + } + } catch (SQLException e) { + throw new RuntimeException("Failed to retrieve article list: {}", e); + } + return articles; + } + + // 최신 게시글 1개 조회 + public Article selectLatest() { + String sql = "SELECT * FROM ARTICLE ORDER BY id DESC LIMIT 1"; + try (Connection connection = ConnectionManager.getConnection(); + Statement stmt = connection.createStatement(); + ResultSet rs = stmt.executeQuery(sql)) { + if (rs.next()) { + return new Article( + rs.getLong("id"), + rs.getString("writer"), + rs.getString("title"), + rs.getString("contents"), + rs.getTimestamp("createdAt").toLocalDateTime(), + rs.getString("imagePath"), + rs.getInt("likeCount") + ); + } + } catch (SQLException e) { + logger.error("Failed to get recent article", e); + } + return null; + } + + // 좋아요 수 증가 + public void updateLikeCount(Long id) { + String sql = "UPDATE ARTICLE SET likeCount = likeCount + 1 WHERE id = ?"; + try (Connection connection = ConnectionManager.getConnection(); + PreparedStatement pstmt = connection.prepareStatement(sql)) { + + pstmt.setLong(1, id); + pstmt.executeUpdate(); + } catch (SQLException e) { + throw new RuntimeException("좋아요 업데이트 실패: " + e.getMessage()); + } + } + + // id로 글 찾기 + public Article findById(Long id) { + String sql = "SELECT * FROM ARTICLE WHERE id = ?"; + try (Connection conn = ConnectionManager.getConnection(); + PreparedStatement pstmt = conn.prepareStatement(sql)) { + + pstmt.setLong(1, id); + + try (ResultSet rs = pstmt.executeQuery()) { + if (rs.next()) { + return new Article( + rs.getLong("id"), + rs.getString("writer"), + rs.getString("title"), + rs.getString("contents"), + rs.getTimestamp("createdAt").toLocalDateTime(), + rs.getString("imagePath"), + rs.getInt("likeCount") + ); + } + } + } catch (SQLException e) { + logger.error("Failed get Article Detail (ID: {}): ", id, e); + } + return null; + } + + // 이전 글 id 찾기 + public Long findPreviousId(Long currentId) { + String sql = "SELECT id FROM ARTICLE WHERE id < ? ORDER BY id DESC LIMIT 1"; + try (Connection conn = ConnectionManager.getConnection(); + PreparedStatement pstmt = conn.prepareStatement(sql)) { + pstmt.setLong(1, currentId); + try (ResultSet rs = pstmt.executeQuery()) { + if (rs.next()) return rs.getLong("id"); + } + } catch (SQLException e) { logger.error("Failed to get Prev ID", e); } + return null; + } + + // 다음 글 id 찾기 + public Long findNextId(Long currentId) { + String sql = "SELECT id FROM ARTICLE WHERE id > ? ORDER BY id ASC LIMIT 1"; + try (Connection conn = ConnectionManager.getConnection(); + PreparedStatement pstmt = conn.prepareStatement(sql)) { + pstmt.setLong(1, currentId); + try (ResultSet rs = pstmt.executeQuery()) { + if (rs.next()) return rs.getLong("id"); + } + } catch (SQLException e) { logger.error("Failed to get Next ID", e); } + return null; + } +} diff --git a/src/main/java/db/CommentDao.java b/src/main/java/db/CommentDao.java new file mode 100644 index 000000000..8a499f513 --- /dev/null +++ b/src/main/java/db/CommentDao.java @@ -0,0 +1,52 @@ +package db; + +import model.Comment; + +import java.sql.*; +import java.util.ArrayList; +import java.util.List; + +public class CommentDao { + + // 특정 게시글의 댓글 목록 조회 (최신순) + public List findAllByArticleId(Long articleId) { + String sql = "SELECT * FROM COMMENT WHERE articleId = ? ORDER BY id DESC"; + List comments = new ArrayList<>(); + + try (Connection connection = ConnectionManager.getConnection(); + PreparedStatement pstmt = connection.prepareStatement(sql)) { + + pstmt.setLong(1, articleId); + try (ResultSet rs = pstmt.executeQuery()) { + while (rs.next()) { + comments.add(new Comment( + rs.getLong("id"), + rs.getLong("articleId"), + rs.getString("writer"), + rs.getString("text"), + rs.getTimestamp("createdAt").toLocalDateTime() + )); + } + } + } catch (SQLException e) { + throw new RuntimeException("Failed to get comment", e); + } + return comments; + } + + // 댓글 작성 + public void insert(Comment comment) { + String sql = "INSERT INTO COMMENT (articleId, writer, text, createdAt) VALUES (?, ?, ?, ?)"; + try (Connection connection = ConnectionManager.getConnection(); + PreparedStatement pstmt = connection.prepareStatement(sql)) { + + pstmt.setLong(1, comment.articleId()); + pstmt.setString(2, comment.writer()); + pstmt.setString(3, comment.text()); + pstmt.setTimestamp(4, Timestamp.valueOf(comment.createdAt())); + pstmt.executeUpdate(); + } catch (SQLException e) { + throw new RuntimeException("Failed to save comment", e); + } + } +} diff --git a/src/main/java/db/ConnectionManager.java b/src/main/java/db/ConnectionManager.java new file mode 100644 index 000000000..6f152481b --- /dev/null +++ b/src/main/java/db/ConnectionManager.java @@ -0,0 +1,59 @@ +package db; + +import webserver.config.Config; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.sql.Statement; + +public class ConnectionManager { + static { + // 서버 시작 시 테이블 자동 생성 + initializeDatabase(); + } + + private static void initializeDatabase() { + try (Connection conn = getConnection(); + Statement stmt = conn.createStatement()) { + + // 1. USERS 테이블 + stmt.execute("CREATE TABLE IF NOT EXISTS USERS (" + + "userId VARCHAR(50) PRIMARY KEY, " + + "password VARCHAR(50) NOT NULL, " + + "name VARCHAR(50) NOT NULL, " + + "email VARCHAR(100), " + + "profileImage VARCHAR(255) DEFAULT '/img/basic_profileImage.svg')"); + + // 2. ARTICLE 테이블 + stmt.execute("CREATE TABLE IF NOT EXISTS ARTICLE (" + + "id BIGINT AUTO_INCREMENT PRIMARY KEY, " + + "writer VARCHAR(50) NOT NULL, " + + "title VARCHAR(255)," + + "contents TEXT , " + + "imagePath VARCHAR(255), " + + "likeCount INT DEFAULT 0, " + + "createdAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP)"); + + // 3. COMMENTS 테이블 + stmt.execute("CREATE TABLE IF NOT EXISTS COMMENT (" + + "id BIGINT AUTO_INCREMENT PRIMARY KEY, " + + "articleId BIGINT NOT NULL, " + + "writer VARCHAR(50) NOT NULL, " + + "text TEXT NOT NULL, " + + "createdAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP)"); + + } catch (SQLException e) { + e.printStackTrace(); + } + } + + public static Connection getConnection() { + try { + Class.forName("org.h2.Driver"); + return DriverManager.getConnection(Config.DB_URL, Config.DB_USER, Config.DB_PW); + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} \ No newline at end of file diff --git a/src/main/java/db/UserDao.java b/src/main/java/db/UserDao.java new file mode 100644 index 000000000..55e2d0ef9 --- /dev/null +++ b/src/main/java/db/UserDao.java @@ -0,0 +1,114 @@ +package db; + +import model.User; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +public class UserDao { + private static final Logger logger = LoggerFactory.getLogger(UserDao.class); + + // 회원가입 + public void insert(User user) { + String sql = "INSERT INTO USERS (userId, name, password, email, profileImage) VALUES (?, ?, ?, ?, ?)"; + + try (Connection connection = ConnectionManager.getConnection(); + PreparedStatement pstmt = connection.prepareStatement(sql)) { + + pstmt.setString(1, user.userId()); + pstmt.setString(2, user.name()); + pstmt.setString(3, user.password()); + pstmt.setString(4, user.email()); + pstmt.setString(5, user.profileImage()); + + pstmt.executeUpdate(); + } catch (SQLException e) { + throw new RuntimeException("Failed to save user", e); + } + } + + // ID로 유저 정보 찾기 + public User findUserById(String userId) { + String sql = "SELECT * FROM USERS WHERE userId = ?"; + + try (Connection connection = ConnectionManager.getConnection(); + PreparedStatement pstmt = connection.prepareStatement(sql)) { + + pstmt.setString(1, userId); + try (ResultSet rs = pstmt.executeQuery()) { + if (rs.next()) { + return new User( + rs.getString("userId"), + rs.getString("password"), + rs.getString("name"), + rs.getString("email"), + rs.getString("profileImage") + ); + } + } + } catch (SQLException e) { + throw new RuntimeException("Failed to find user", e); + } + return null; + } + + // 정보 갱신 + public void update(User user) { + String sql = "UPDATE USERS SET name = ?, email = ?, profileImage = ?, password = ? WHERE userId = ?"; + + try (Connection connection = ConnectionManager.getConnection(); + PreparedStatement pstmt = connection.prepareStatement(sql)) { + + pstmt.setString(1, user.name()); + pstmt.setString(2, user.email()); + pstmt.setString(3, user.profileImage()); + pstmt.setString(4, user.password()); + pstmt.setString(5, user.userId()); + + pstmt.executeUpdate(); + logger.debug("User updated in DB: {}", user.userId()); + + } catch (SQLException e) { + logger.error("DB Update Error (User): {}", e.getMessage()); + } + } + + // 아이디 중복 체크 + public boolean existsByUserId(String userId) { + String sql = "SELECT COUNT(*) FROM USERS WHERE userId = ?"; + try (Connection connection = ConnectionManager.getConnection(); + PreparedStatement pstmt = connection.prepareStatement(sql)) { + + pstmt.setString(1, userId); + try (ResultSet rs = pstmt.executeQuery()) { + if (rs.next()) { + return rs.getInt(1) > 0; + } + } + } catch (SQLException e) { + logger.error("Error checking userId existence", e); + } + return false; + } + + // 닉네임 중복 체크 + public boolean existsByName(String name) { + String sql = "SELECT COUNT(*) FROM USERS WHERE name = ?"; + try (Connection connection = ConnectionManager.getConnection(); + PreparedStatement pstmt = connection.prepareStatement(sql)) { + pstmt.setString(1, name); + try (ResultSet rs = pstmt.executeQuery()) { + if (rs.next()) { + return rs.getInt(1) > 0; + } + } + } catch (SQLException e) { + logger.error("Error checking name existence", e); + } + return false; + } +} \ No newline at end of file diff --git a/src/main/java/model/Article.java b/src/main/java/model/Article.java new file mode 100644 index 000000000..8a125ae73 --- /dev/null +++ b/src/main/java/model/Article.java @@ -0,0 +1,16 @@ +package model; + +import java.time.LocalDateTime; + +public record Article(Long id, String writer, String title, String contents, LocalDateTime createdAt, String imagePath, Integer likeCount) { + + public Article { + if (likeCount == null) { + likeCount = 0; + } + } + + public Article(String writer, String title, String contents, String imagePath) { + this(null, writer, title, contents, null, imagePath, 0); + } +} \ No newline at end of file diff --git a/src/main/java/model/Comment.java b/src/main/java/model/Comment.java new file mode 100644 index 000000000..1e21dc8e9 --- /dev/null +++ b/src/main/java/model/Comment.java @@ -0,0 +1,9 @@ +package model; + +import java.time.LocalDateTime; + +public record Comment(Long id, Long articleId, String writer, String text, LocalDateTime createdAt) { + public Comment(Long articleId, String writer, String text) { + this(null, articleId, writer, text, LocalDateTime.now()); + } +} \ No newline at end of file diff --git a/src/main/java/model/MultipartPart.java b/src/main/java/model/MultipartPart.java new file mode 100644 index 000000000..fe1703e60 --- /dev/null +++ b/src/main/java/model/MultipartPart.java @@ -0,0 +1,7 @@ +package model; + +public record MultipartPart (String name, String fileName, String contentType, byte[] data) { + public boolean isFile() { + return fileName != null; + } +} diff --git a/src/main/java/model/User.java b/src/main/java/model/User.java index 8881a3253..075f13103 100644 --- a/src/main/java/model/User.java +++ b/src/main/java/model/User.java @@ -1,4 +1,4 @@ package model; -public record User(String userId, String password, String name, String email) { +public record User(String userId, String password, String name, String email, String profileImage) { } \ No newline at end of file diff --git a/src/main/java/utils/HttpRequestUtils.java b/src/main/java/utils/HttpRequestUtils.java index b7c294349..e215a1a6c 100644 --- a/src/main/java/utils/HttpRequestUtils.java +++ b/src/main/java/utils/HttpRequestUtils.java @@ -1,11 +1,11 @@ package utils; +import model.MultipartPart; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import webserver.config.Pair; -import java.util.HashMap; -import java.util.Map; +import java.util.*; public class HttpRequestUtils { private static final Logger logger = LoggerFactory.getLogger(HttpRequestUtils.class); @@ -111,4 +111,75 @@ public static Pair parseHeader(String headerLine) { String value = headerLine.substring(index + 1).trim(); return new Pair(key, value); } -} + + // 멀티파트 파싱 + public static List parseMultipartBody(byte[] body, String boundary) { + List parts = new ArrayList<>(); + String delimiter = "--" + boundary; + byte[] delimiterBytes = delimiter.getBytes(); + + int start = 0; + while ((start = findIndex(body, delimiterBytes, start)) != -1) { + start += delimiterBytes.length; + + if (start + 1 < body.length && body[start] == '-' && body[start + 1] == '-') break; + + int headerEnd = findIndex(body, new byte[]{13, 10, 13, 10}, start); + if (headerEnd == -1) break; + + String headerSection = new String(body, start + 2, headerEnd - start - 2); + + String name = extractAttribute(headerSection, "name"); + String fileName = extractAttribute(headerSection, "filename"); + String contentType = extractAttribute(headerSection, "Content-Type"); + + int nextDelimiter = findIndex(body, delimiterBytes, headerEnd + 4); + if (nextDelimiter == -1) break; + + int end = nextDelimiter; + if (body[end - 1] == 10) end--; + if (body[end - 1] == 13) end--; + + byte[] partData = Arrays.copyOfRange(body, headerEnd + 4, nextDelimiter - 2); + + parts.add(new MultipartPart(name, fileName, contentType, partData)); + start = nextDelimiter; + } + return parts; + } + + private static int findIndex(byte[] source, byte[] target, int start) { + for (int i = start; i <= source.length - target.length; i++) { + boolean match = true; + for (int j = 0; j < target.length; j++) { + if (source[i + j] != target[j]) { + match = false; + break; + } + } + if (match) return i; + } + return -1; + } + + private static String extractAttribute(String header, String attr) { + // name="value" 또는 filename="value" 형태 + int start = header.indexOf(attr + "=\""); + if (start != -1) { + start += attr.length() + 2; + int end = header.indexOf("\"", start); + return (end != -1) ? header.substring(start, end) : null; + } + + // Content-Type: image/png 형태 + start = header.indexOf(attr + ": "); + if (start != -1) { + start += attr.length() + 2; + int end = header.indexOf("\r\n", start); + if (end == -1) end = header.length(); + return header.substring(start, end).trim(); + } + + return null; + } +} \ No newline at end of file diff --git a/src/main/java/webserver/HttpRequest.java b/src/main/java/webserver/HttpRequest.java index 041b63e5e..a6d035700 100644 --- a/src/main/java/webserver/HttpRequest.java +++ b/src/main/java/webserver/HttpRequest.java @@ -1,5 +1,6 @@ package webserver; +import model.MultipartPart; import model.User; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -7,14 +8,9 @@ import utils.IOUtils; import webserver.config.Pair; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; +import java.io.*; import java.nio.charset.StandardCharsets; -import java.util.HashMap; -import java.util.Map; -import java.util.Stack; +import java.util.*; public class HttpRequest { private static final Logger logger = LoggerFactory.getLogger(HttpRequest.class); @@ -27,6 +23,7 @@ public class HttpRequest { private Map cookies = new HashMap<>(); private Map headers = new HashMap<>(); private Map params = new HashMap<>(); + private List multipartParts = new ArrayList<>(); // 바디 길이를 저장 private int contentLength = 0; @@ -34,9 +31,8 @@ public class HttpRequest { private boolean isChunked = false; public HttpRequest(InputStream in) throws IOException { - BufferedReader br = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8)); - String line = br.readLine(); + String line = readLine(in); if (line == null) return; // Request Line 파싱 @@ -51,36 +47,67 @@ public HttpRequest(InputStream in) throws IOException { } // 나머지 헤더 정보 읽음 - while ((line = br.readLine()) != null && !line.isEmpty()) { + while (true) { + line = readLine(in); + if (line == null || line.isEmpty()) { + break; + } + Pair pair = HttpRequestUtils.parseHeader(line); if (pair != null) { headers.put(pair.key, pair.value); - if ("Content-Length".equalsIgnoreCase(pair.key)) { this.contentLength = Integer.parseInt(pair.value); } - if ("Transfer-Encoding".equalsIgnoreCase(pair.key) && "chunked".equalsIgnoreCase(pair.value)) { - this.isChunked = true; - } - // 쿠키 파싱 if ("Cookie".equalsIgnoreCase(pair.key)) { this.cookies = HttpRequestUtils.parseCookies(pair.value); } } } - if (hasRequestBody()) { - if (isChunked) { - logger.debug("Body is chunked. Reading chunked data"); - String body = readChunkedBody(br); - this.params.putAll(HttpRequestUtils.parseParameters(body)); - } else if (contentLength > 0) { - String body = IOUtils.readData(br, contentLength); - this.params.putAll(HttpRequestUtils.parseParameters(body)); - } else { - logger.warn("POST request missing Content-Length or Transfer-Encoding. Path: {}", path); + if (contentLength > 0) { + parseBody(in); + } + } + + private String readLine(InputStream in) throws IOException { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + int b; + while ((b = in.read()) != -1) { + if (b == '\n') break; + if (b != '\r') baos.write(b); + } + if (b == -1 && baos.size() == 0) return null; + return baos.toString(StandardCharsets.UTF_8); + } + + private void parseBody(InputStream in) throws IOException { + logger.debug("Starting parseBody. Content-Length to read: {}", contentLength); + + byte[] body = new byte[contentLength]; + int totalRead = 0; + while (totalRead < contentLength) { + int read = in.read(body, totalRead, contentLength - totalRead); + if (read == -1) break; + totalRead += read; + } + + String contentType = headers.get("Content-Type"); + + if (contentType != null && contentType.contains("multipart/form-data")) { + String boundary = contentType.split("boundary=")[1]; + this.multipartParts = HttpRequestUtils.parseMultipartBody(body, boundary); + + for (MultipartPart part : multipartParts) { + if (!part.isFile()) { + params.put(part.name(), new String(part.data(), StandardCharsets.UTF_8)); + } } + + } else { + String bodyStr = new String(body, StandardCharsets.UTF_8); + this.params.putAll(HttpRequestUtils.parseParameters(bodyStr)); } } @@ -149,4 +176,8 @@ public String getCookie(String name) { if (this.cookies == null) return null; return cookies.get(name); } + + public List getMultipartParts() { + return multipartParts; + } } \ No newline at end of file diff --git a/src/main/java/webserver/HttpResponse.java b/src/main/java/webserver/HttpResponse.java index 6f1af4591..e8b9b7f73 100644 --- a/src/main/java/webserver/HttpResponse.java +++ b/src/main/java/webserver/HttpResponse.java @@ -16,6 +16,8 @@ import java.util.HashMap; import java.util.Map; +import static webserver.config.MimeType.getContentType; + public class HttpResponse { public static final Logger logger = LoggerFactory.getLogger(HttpResponse.class); private final DataOutputStream dos; @@ -33,14 +35,25 @@ public void addHeader(String key, String value) { } public void sendError(HttpStatus status) { - if (isCommitted) { - logger.warn("The error page cannot be sent because the response has already started."); - return; - } + if (isCommitted) return; this.status = status; - byte[] body = status.getErrorMessageBytes(); - setHttpHeader("text/plain", body.length); - processWrite(body); + + String errorPagePath = "/error/" + status.getCode() + ".html"; + File file = new File(Config.STATIC_RESOURCE_PATH + errorPagePath); + + try { + byte[] body; + if (file.exists()) { + body = Files.readAllBytes(file.toPath()); + setHttpHeader("text/html", body.length); + } else { + body = status.getMessage().getBytes(Config.UTF_8); + setHttpHeader("text/plain", body.length); + } + processWrite(body); + } catch (IOException e) { + logger.error("Error while sending error page: {}", e.getMessage()); + } } public void sendRedirect(String redirectUrl) { @@ -49,8 +62,19 @@ public void sendRedirect(String redirectUrl) { processWrite(new byte[0]); // 바디 없음 } - public void fileResponse(String url, User loginUser) { + public void fileResponse(String url, User loginUser, Map additionalModel) { File file = new File(Config.STATIC_RESOURCE_PATH + url); + + if (!file.exists() && !url.contains(".")) { + file = new File(Config.STATIC_RESOURCE_PATH + url + ".html"); + } + + if (file.isDirectory()) { + logger.warn("Request path is a directory: {}", url); + sendError(HttpStatus.NOT_FOUND); + return; + } + if (!file.exists()) { sendError(HttpStatus.NOT_FOUND); return; @@ -58,19 +82,34 @@ public void fileResponse(String url, User loginUser) { try { byte[] body = Files.readAllBytes(file.toPath()); + String fileName = file.getName(); // 동적 HTML 처리 - if (url.endsWith(".html")) { + if (fileName.endsWith(".html")) { String content = new String(body, Config.UTF_8); Map model = new HashMap<>(); model.put("header_items", PageRender.renderHeader(loginUser)); + if (additionalModel != null) { + model.putAll(additionalModel); + } + + logger.debug("Rendering HTML with model: {}", model.keySet()); + content = TemplateEngine.render(content, model); body = content.getBytes(Config.UTF_8); } - String contentType = MimeType.getContentType(HttpRequestUtils.getFileExtension(url)); + + String extension = HttpRequestUtils.getFileExtension(url); + if (extension == null || extension.isEmpty() || url.contains("?")) { + if (url.equals("/") || url.startsWith("/article") || url.startsWith("/?")) { + extension = "html"; + } + } + + String contentType = getContentType(extension); this.status = HttpStatus.OK; setHttpHeader(contentType, body.length); processWrite(body); @@ -82,10 +121,17 @@ public void fileResponse(String url, User loginUser) { private void processWrite(byte[] body) { try { - // 헤더 전송 if (!isCommitted) { - writeStatusLine(); - writeAllHeaders(); + // 헤더를 먼저 생성하여 전송 + StringBuilder sb = new StringBuilder(); + sb.append("HTTP/1.1 ").append(status.toString()).append(Config.CRLF); + + for (Map.Entry entry : headers.entrySet()) { + sb.append(entry.getKey()).append(": ").append(entry.getValue()).append(Config.CRLF); + } + sb.append(Config.CRLF); + + dos.writeBytes(sb.toString()); isCommitted = true; } @@ -122,4 +168,50 @@ private void setHttpHeader(String contentType, int contentLength) { addHeader("Content-Type", contentType + ";charset=" + Config.UTF_8); addHeader("Content-Length", String.valueOf(contentLength)); } + + public void sendHtmlContent(String content) { + try { + byte[] body = content.getBytes(Config.UTF_8); + this.status = HttpStatus.OK; + setHttpHeader("text/html", body.length); + processWrite(body); + } catch (Exception e) { + logger.error("Error while encoding HTML content: {}", e.getMessage()); + sendError(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + public void fileResponseFromExternal(File file) { + try { + if (!file.exists()) { + sendError(HttpStatus.NOT_FOUND); + return; + } + + byte[] body = Files.readAllBytes(file.toPath()); + + // 파일 확장자를 통해 Content-Type 결정 + String fileName = file.getName(); + String extension = ""; + int lastIndex = fileName.lastIndexOf('.'); + if (lastIndex > 0 && lastIndex < fileName.length() - 1) { + extension = fileName.substring(lastIndex + 1).toLowerCase(); // 소문자로 통일 + } + + String contentType = getContentType(extension); + + this.status = HttpStatus.OK; + if (contentType.startsWith("image/")) { + addHeader("Content-Type", contentType); + } else { + addHeader("Content-Type", contentType + ";charset=" + Config.UTF_8); + } + addHeader("Content-Length", String.valueOf(body.length)); + processWrite(body); + + } catch (IOException e) { + logger.error("Error while serving external file {}: {}", file.getName(), e.getMessage()); + sendError(HttpStatus.INTERNAL_SERVER_ERROR); + } + } } \ No newline at end of file diff --git a/src/main/java/webserver/PageRender.java b/src/main/java/webserver/PageRender.java index 044e4c3cb..53e0db468 100644 --- a/src/main/java/webserver/PageRender.java +++ b/src/main/java/webserver/PageRender.java @@ -1,7 +1,12 @@ package webserver; +import db.UserDao; +import model.Article; +import model.Comment; import model.User; +import java.util.List; + public class PageRender { public static String renderHeader(User loginUser) { StringBuilder sb = new StringBuilder(); @@ -11,13 +16,13 @@ public static String renderHeader(User loginUser) { // [사용자 이름] 클릭 시 마이페이지 이동 sb.append("
  • ") .append("") // 여기서 링크 시작 - .append("").append(loginUser.name()).append("님") + .append("").append("안녕하세요, ").append(loginUser.name()).append("님!") .append("") // 링크 끝 .append("
  • "); // [글쓰기] 버튼 sb.append("
  • ") - .append("글쓰기") + .append("글쓰기") .append("
  • "); // [로그아웃] 버튼 @@ -35,4 +40,193 @@ public static String renderHeader(User loginUser) { } return sb.toString(); } + + public static String renderArticleList(List
    articles, UserDao userDao) { + if (articles.isEmpty()) { + return "

    등록된 게시글이 없습니다.

    "; + } + + StringBuilder sb = new StringBuilder(); + for (Article article : articles) { + User writer = userDao.findUserById(article.writer()); + String profileImg = (writer != null && writer.profileImage() != null && !writer.profileImage().isEmpty()) + ? writer.profileImage() + : "/img/basic_profileImage.svg"; + + sb.append("
    "); + + // 작성자 정보 + sb.append("
    "); + sb.append(" "); + sb.append(" "); + sb.append("
    "); + + // 이미지 (imagePath 있을 경우만) + if (article.imagePath() != null && !article.imagePath().isEmpty()) { + sb.append(" "); + } + + // 좋아요, 공유, 북마크 + sb.append("
    "); + sb.append("
      "); + sb.append("
    • "); + sb.append("
    • "); + sb.append("
    "); + sb.append(" "); + sb.append("
    "); + + // 4. 본문 내용 + sb.append("

    ").append(article.contents()).append("

    "); + + sb.append("
    "); + } + + return sb.toString(); + } + + public static String renderProfile(User user) { + StringBuilder sb = new StringBuilder(); + + String profileImage = (user.profileImage() != null && !user.profileImage().isEmpty()) + ? user.profileImage() + : "/img/basic_profileImage.svg"; + + sb.append(""); + + return sb.toString(); + } + + // 최신 게시글 1개 렌더링 + public static String renderLatestArticle(Article article, User writer, int commentCount) { + if (article == null) { + return "

    등록된 게시글이 없습니다.

    "; + } + + StringBuilder sb = new StringBuilder(); + + String profileImage = (writer != null && writer.profileImage() != null && !writer.profileImage().isEmpty()) + ? writer.profileImage() + : "/img/basic_profileImage.svg"; + + String writerName = (writer != null) ? writer.name() : article.writer(); + + sb.append("
    "); + // 작성자 정보 + sb.append("
    ") + .append(" ") + .append(" ") + .append("
    "); + + // 이미지 + if (article.imagePath() != null && !article.imagePath().isEmpty()) { + sb.append(" "); + } + + // 좋아요 카운트 & 댓글 개수 포함 + sb.append("
    ") + .append("
      ") + .append("
    • ") + .append(" ") + .append(" ") + .append(" ") + .append(article.likeCount()) + .append("
    • ") + + .append("
    • ") + .append(commentCount).append("
    • ") + .append("
    ") + .append("
    "); + + // 본문 + sb.append("

    ").append(article.contents()).append("

    "); + sb.append("
    "); + + return sb.toString(); + } + + // 댓글 목록 렌더링 (최대 3개 노출 및 모든 댓글 보기 버튼) + public static String renderComments(List comments, UserDao userDao) { + if (comments == null || comments.isEmpty()) { + return "
  • 아직 댓글이 없습니다.

  • "; + } + + StringBuilder sb = new StringBuilder(); + int totalCount = comments.size(); + + for (int i=0; i= 3) ? "comment__item--hidden" : ""; + String hiddenStyle = (i >= 3) ? "style=\"display: none;\"" : ""; + + sb.append("
  • ") + .append("
    ") + .append(" ") + .append("

    ").append(commenterName).append("

    ") + .append("
    ") + .append("

    ").append(c.text()).append("

    ") + .append("
  • "); + } + + // 3개를 초과할 경우에만 '모든 댓글 보기' 버튼 추가 + if (totalCount > 3) { + sb.append("
  • ") + .append(" ") + .append("
  • "); + } + + return sb.toString(); + } + + // 하단 네비게이션 렌더링 (이전 글 / 댓글 작성 / 다음 글) + public static String renderPostNav(Long prevId, Long nextId, Long currentArticleId) { + StringBuilder sb = new StringBuilder(); + sb.append(""); + + return sb.toString(); + } } diff --git a/src/main/java/webserver/RequestHandler.java b/src/main/java/webserver/RequestHandler.java index 2b3ad89af..819565db5 100644 --- a/src/main/java/webserver/RequestHandler.java +++ b/src/main/java/webserver/RequestHandler.java @@ -4,9 +4,11 @@ import java.net.Socket; import db.Database; +import db.UserDao; import model.User; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import webserver.config.Config; import webserver.handler.Handler; import webserver.handler.RouteGuide; @@ -15,12 +17,12 @@ public class RequestHandler implements Runnable { private Socket connection; private final RouteGuide routeGuide; - private final Database database; + private final UserDao userDao; - public RequestHandler(Socket connectionSocket, RouteGuide routeGuide, Database database) { + public RequestHandler(Socket connectionSocket, RouteGuide routeGuide, UserDao userDao) { this.connection = connectionSocket; this.routeGuide = routeGuide; - this.database = database; + this.userDao = userDao; } public void run() { @@ -36,7 +38,7 @@ public void run() { // 유저 정보 추출 String sessionId = request.getCookie("sid"); - User loginUser = SessionManager.getLoginUser(sessionId, database); + User loginUser = SessionManager.getLoginUser(sessionId, userDao); String path = request.getPath(); if (path == null) return; @@ -48,6 +50,17 @@ public void run() { return; } + if (path.startsWith("/uploads/")) { + String decodedPath = java.net.URLDecoder.decode(path, "UTF-8"); + String fileName = decodedPath.substring("/uploads/".length()); + File file = new File(Config.EXTERNAL_UPLOAD_PATH, fileName); + + if (file.exists()) { + response.fileResponseFromExternal(file); + return; + } + } + // 경로에 맞는 핸들러 있는지 확인 Handler handler = routeGuide.findHandler(path); if (handler != null) { @@ -55,11 +68,11 @@ public void run() { handler.process(request, response); } else { // 없으면 정적 파일 서빙 - response.fileResponse(path, loginUser); + response.fileResponse(path, loginUser, null); } } catch (IOException e) { logger.error(e.getMessage()); } } -} +} \ No newline at end of file diff --git a/src/main/java/webserver/SecurityInterceptor.java b/src/main/java/webserver/SecurityInterceptor.java index a1727916f..148923df8 100644 --- a/src/main/java/webserver/SecurityInterceptor.java +++ b/src/main/java/webserver/SecurityInterceptor.java @@ -6,7 +6,7 @@ public class SecurityInterceptor { // 권한을 제한할 경로 - private static final List restrictedPaths = List.of("/mypage", "/user/logout"); + private static final List restrictedPaths = List.of("/mypage", "/user/logout", "/article/write", "/comment"); public static boolean preHandler(String path, User loginUser) { if (restrictedPaths.contains(path)) { diff --git a/src/main/java/webserver/SessionManager.java b/src/main/java/webserver/SessionManager.java index 2a58bb89b..5d272f42b 100644 --- a/src/main/java/webserver/SessionManager.java +++ b/src/main/java/webserver/SessionManager.java @@ -3,6 +3,7 @@ import db.Database; import db.SessionDatabase; import db.SessionEntry; +import db.UserDao; import model.User; import java.time.Duration; @@ -18,7 +19,7 @@ public static String createSession(User user) { return sessionId; } - public static User getSessionUser(String sessionId, Database database) { + public static User getSessionUser(String sessionId, UserDao userDao) { SessionEntry entry = SessionDatabase.find(sessionId); if (entry == null) return null; @@ -28,10 +29,10 @@ public static User getSessionUser(String sessionId, Database database) { } entry.updateLastAccessedTime(); - return database.findUserById(entry.getUserId()); + return userDao.findUserById(entry.getUserId()); } - public static User getLoginUser(String sessionId, Database database) { + public static User getLoginUser(String sessionId, UserDao userDao) { if (sessionId == null) { return null; } @@ -42,7 +43,7 @@ public static User getLoginUser(String sessionId, Database database) { } String userId = entry.getUserId(); - return database.findUserById(userId); + return userDao.findUserById(userId); } public static boolean isExpired(SessionEntry entry) { @@ -60,4 +61,4 @@ public static User getUserBySessionId(String sessionId, Database database) { return database.findUserById(entry.getUserId()); } -} +} \ No newline at end of file diff --git a/src/main/java/webserver/WebServer.java b/src/main/java/webserver/WebServer.java index 439fc5c07..5c4246190 100644 --- a/src/main/java/webserver/WebServer.java +++ b/src/main/java/webserver/WebServer.java @@ -9,6 +9,7 @@ import db.Database; import db.SessionDatabase; +import db.UserDao; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import webserver.config.AppConfig; @@ -32,7 +33,14 @@ public static void main(String args[]) throws Exception { port = Integer.parseInt(args[0]); } - Database database = AppConfig.getDatabase(); + try { + db.ConnectionManager.getConnection().close(); + logger.info("Database and Tables initialized successfully."); + } catch (Exception e) { + logger.error("Database initialization failed: {}", e.getMessage()); + } + + UserDao userDao = AppConfig.getUserDao(); RouteGuide routeGuide = new RouteGuide(AppConfig.getRouteMappings()); // [백그라운드 작업] 만료된 세션 청소 @@ -45,7 +53,7 @@ public static void main(String args[]) throws Exception { // 클라이언트가 연결될때까지 대기한다. Socket connection; while ((connection = listenSocket.accept()) != null) { - executorService.execute(new RequestHandler(connection, routeGuide, database)); + executorService.execute(new RequestHandler(connection, routeGuide, userDao)); } } finally { executorService.shutdown(); @@ -77,4 +85,4 @@ private static void startSessionMaintenance() { logger.info("Session Maintenance Task initialized."); } -} +} \ No newline at end of file diff --git a/src/main/java/webserver/config/AppConfig.java b/src/main/java/webserver/config/AppConfig.java index c401094b2..83ed77603 100644 --- a/src/main/java/webserver/config/AppConfig.java +++ b/src/main/java/webserver/config/AppConfig.java @@ -1,22 +1,34 @@ package webserver.config; +import db.ArticleDao; +import db.CommentDao; import db.Database; +import db.UserDao; +import model.Article; import model.User; import webserver.SessionManager; -import webserver.handler.Handler; -import webserver.handler.LoginRequestHandler; -import webserver.handler.LogoutRequestHandler; -import webserver.handler.UserRequestHandler; +import webserver.handler.*; import java.util.HashMap; import java.util.Map; public class AppConfig { - private static final Database database = new Database(); + private static final UserDao userDao = new UserDao(); + private static final ArticleDao articleDao = new ArticleDao(); + private static final CommentDao commentDao = new CommentDao(); - private static final Handler userHandler = new UserRequestHandler(database); - private static final Handler loginHandler = new LoginRequestHandler(database); - private static final Handler logoutHandler = new LogoutRequestHandler(database); + private static final Handler userHandler = new UserRequestHandler(userDao); + private static final Handler loginHandler = new LoginRequestHandler(userDao); + private static final Handler logoutHandler = new LogoutRequestHandler(userDao); + + private static final Handler articleWriteHandler = new ArticleWriteHandler(articleDao, userDao); + private static final Handler articleIndexHandler = new ArticleIndexHandler(articleDao, userDao, commentDao); + private static final Handler articleLikeHandler = new LikeHandler(articleDao); + private static final Handler commentWriteHandler = new CommentWriteHandler(commentDao); + private static final Handler commentPageHandler = new CommentPageHandler(); + + private static final Handler myPageHandler = new MyPageHandler(userDao); + private static final Handler profileUpdateHandler = new ProfileUpdateHandler(userDao); public static Map getRouteMappings() { Map mappings = new HashMap<>(); @@ -25,24 +37,34 @@ public static Map getRouteMappings() { mappings.put("/user/login", loginHandler); mappings.put("/user/logout", logoutHandler); + mappings.put("/article/write", articleWriteHandler); + mappings.put("/", articleIndexHandler); + mappings.put("/index.html", articleIndexHandler); + mappings.put("/article/index", articleIndexHandler); + mappings.put("/article/like", articleLikeHandler); + mappings.put("/comment/write", commentWriteHandler); + mappings.put("/comment", commentPageHandler); + + mappings.put("/mypage", myPageHandler); + mappings.put("/user/update", profileUpdateHandler); + Map staticPages = Map.of( - "/", Config.DEFAULT_PAGE, "/registration", Config.REGISTRATION_PAGE, "/login", Config.LOGIN_PAGE, - "/mypage", Config.MY_PAGE + "/article/form", Config.ARTICLE_PAGE ); staticPages.forEach((path, filePath) -> mappings.put(path, (request, response) -> { String sessionId = request.getCookie("sid"); - User loginUser = SessionManager.getLoginUser(sessionId, database); - response.fileResponse(filePath, loginUser); + User loginUser = SessionManager.getLoginUser(sessionId, userDao); + response.fileResponse(filePath, loginUser, null); }) ); return mappings; } - public static Database getDatabase() { - return database; + public static UserDao getUserDao() { + return userDao; } } \ No newline at end of file diff --git a/src/main/java/webserver/config/Config.java b/src/main/java/webserver/config/Config.java index e36c4e459..a0fd622b1 100644 --- a/src/main/java/webserver/config/Config.java +++ b/src/main/java/webserver/config/Config.java @@ -7,8 +7,19 @@ public class Config { public static final String LOGIN_PAGE = "/login/index.html"; public static final String MAIN_PAGE = "/main/index.html"; public static final String MY_PAGE = "/mypage/index.html"; + public static final String ARTICLE_PAGE = "/article/index.html"; + public static final String COMMENT_PAGE = "/comment/index.html"; public static final String UTF_8 = "utf-8"; + public static final String defaultProfileImage = "/img/basic_profileImage.svg"; + public static final String CRLF = "\r\n"; public static final String HEADER_DELIMITER = ": "; + + // h2 database + // TODO: .gitignore로 관리 + public static final String EXTERNAL_UPLOAD_PATH = "./was-images"; + public static final String DB_URL = "jdbc:h2:./db/jwp-was;MODE=MySQL;AUTO_SERVER=TRUE"; + public static final String DB_USER = "apple"; + public static final String DB_PW = "1q2w3e4r"; } diff --git a/src/main/java/webserver/config/MimeType.java b/src/main/java/webserver/config/MimeType.java index 45b52d204..da6fc7d8f 100644 --- a/src/main/java/webserver/config/MimeType.java +++ b/src/main/java/webserver/config/MimeType.java @@ -9,6 +9,7 @@ public enum MimeType { ICO("ico", "image/x-icon"), PNG("png", "image/png"), JPG("jpg", "image/jpeg"), + JPEG("jpeg", "image/jpeg"), SVG("svg", "image/svg+xml"), // 지원하지 않는 경우 다운로드 시도하거나 텍스트 DEFAULT("", "application/octet-stream"); diff --git a/src/main/java/webserver/handler/ArticleIndexHandler.java b/src/main/java/webserver/handler/ArticleIndexHandler.java new file mode 100644 index 000000000..31e18efdc --- /dev/null +++ b/src/main/java/webserver/handler/ArticleIndexHandler.java @@ -0,0 +1,86 @@ +package webserver.handler; + +import db.ArticleDao; +import db.CommentDao; +import db.UserDao; +import model.Article; +import model.Comment; +import model.User; +import org.h2.mvstore.Page; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import webserver.*; +import webserver.config.AppConfig; +import webserver.config.Config; +import webserver.config.HttpStatus; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ArticleIndexHandler implements Handler { + private static final Logger logger = LoggerFactory.getLogger(ArticleIndexHandler.class); + + private final ArticleDao articleDao; + private final UserDao userDao; + private final CommentDao commentDao; + + public ArticleIndexHandler(ArticleDao articleDao, UserDao userDao, CommentDao commentDao) { + this.articleDao = articleDao; + this.userDao = userDao; + this.commentDao = commentDao; + } + + @Override + public void process(HttpRequest request, HttpResponse response) { + String sessionId = request.getCookie("sid"); + User loginUser = SessionManager.getLoginUser(sessionId, AppConfig.getUserDao()); + + try { + String idParam = request.getParameter("id"); + Article targetArticle; + + if (idParam != null && !idParam.isEmpty()) { + targetArticle = articleDao.findById(Long.parseLong(idParam)); + } else { + targetArticle = articleDao.selectLatest(); + } + + Map model = new HashMap<>(); + model.put("header_items", PageRender.renderHeader(loginUser)); + + if (targetArticle != null) { + User writer = userDao.findUserById(targetArticle.writer()); + List comments = commentDao.findAllByArticleId(targetArticle.id()); + + model.put("posts_list", PageRender.renderLatestArticle(targetArticle, writer, comments.size())); + model.put("comment_list", PageRender.renderComments(comments, userDao)); + + Long prevId = articleDao.findPreviousId(targetArticle.id()); + Long nextId = articleDao.findNextId(targetArticle.id()); + model.put("post_nav", PageRender.renderPostNav(prevId, nextId, targetArticle.id())); + + } else { + model.put("posts_list", "

    등록된 게시글이 없습니다.

    "); + model.put("comment_list", ""); + model.put("post_nav", ""); + } + + File file = new File(Config.STATIC_RESOURCE_PATH + "/index.html"); + String content = new String(Files.readAllBytes(file.toPath()), Config.UTF_8); + String renderedHtml = TemplateEngine.render(content, model); + + response.sendHtmlContent(renderedHtml); + + } catch (IOException e) { + logger.error("Index rendering error: ", e); + response.sendError(HttpStatus.INTERNAL_SERVER_ERROR); + } catch (NumberFormatException e) { + logger.error("Invalid ID format: ", e); + response.sendRedirect(Config.DEFAULT_PAGE); + } + } +} diff --git a/src/main/java/webserver/handler/ArticleWriteHandler.java b/src/main/java/webserver/handler/ArticleWriteHandler.java new file mode 100644 index 000000000..067918240 --- /dev/null +++ b/src/main/java/webserver/handler/ArticleWriteHandler.java @@ -0,0 +1,95 @@ +package webserver.handler; + +import db.ArticleDao; +import db.UserDao; +import model.Article; +import model.MultipartPart; +import model.User; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import webserver.HttpRequest; +import webserver.HttpResponse; +import webserver.SessionManager; +import webserver.config.Config; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.UUID; + +/** + * 게시글 작성 요청을 처리하는 핸들러 클래스 + * 사용자가 입력한 게시글 데이터와 업로드된 이미지를 저장 + */ +public class ArticleWriteHandler implements Handler { + private static final Logger logger = LoggerFactory.getLogger(ArticleWriteHandler.class); + + private final UserDao userDao; + private final ArticleDao articleDao; + + public ArticleWriteHandler(ArticleDao articleDao, UserDao userDao) { + this.articleDao = articleDao; + this.userDao = userDao; + } + + /** + * 게시글 작성 요청을 처리하여 DB에 저장하고 메인 페이지로 리다이렉트 + * * @param request 클라이언트의 HTTP 요청 정보 객체 + * @param response 서버의 HTTP 응답 제어 객체 + */ + @Override + public void process(HttpRequest request, HttpResponse response) { + String sessionId = request.getCookie("sid"); + User loginUser = SessionManager.getLoginUser(sessionId, userDao); + + if (loginUser == null) { + response.sendRedirect("/login"); + return; + } + + String title = request.getParameter("title"); + String contents = request.getParameter("contents"); + String writer = loginUser.userId(); + String imagePath = null; + + for (MultipartPart part : request.getMultipartParts()) { + if (part.isFile() && "image".equals(part.name()) && part.data().length > 0) { + imagePath = saveUploadedFile(part); + } + } + + // 이미지 첨부 여부 검증 + if (imagePath == null || imagePath.isEmpty()) { + logger.warn("Article write failed: Image is missing."); + response.addHeader("Set-Cookie", "article_error=no_image; Path=/; Max-Age=5"); + response.sendRedirect(Config.ARTICLE_PAGE); + return; + } + + Article article = new Article(writer, title, contents, imagePath); + + articleDao.insert(article); + + logger.debug("Saved Article"); + response.sendRedirect(Config.DEFAULT_PAGE); + } + + private String saveUploadedFile(MultipartPart part) { + File dir = new File(Config.EXTERNAL_UPLOAD_PATH); + if (!dir.exists()) { + dir.mkdirs(); // 폴더 없으면 생성 + } + + String fileName = UUID.randomUUID().toString() + "_" + part.fileName(); + File file = new File(dir, fileName); + + try (FileOutputStream fos = new FileOutputStream(file)) { + fos.write(part.data()); + logger.debug("File saved successfully: {}", file.getAbsolutePath()); + return "/uploads/" + fileName; + } catch (IOException e) { + logger.debug("File save error: {}", e.getMessage()); + return null; + } + } +} diff --git a/src/main/java/webserver/handler/CommentPageHandler.java b/src/main/java/webserver/handler/CommentPageHandler.java new file mode 100644 index 000000000..679df3000 --- /dev/null +++ b/src/main/java/webserver/handler/CommentPageHandler.java @@ -0,0 +1,27 @@ +package webserver.handler; + +import model.User; +import webserver.HttpRequest; +import webserver.HttpResponse; +import webserver.SessionManager; +import webserver.config.AppConfig; +import webserver.config.Config; + +import java.util.HashMap; +import java.util.Map; + +public class CommentPageHandler implements Handler { + + @Override + public void process(HttpRequest request, HttpResponse response) { + String articleId = request.getParameter("articleId"); + + Map model = new HashMap<>(); + model.put("articleId", articleId); + + String sessionId = request.getCookie("sid"); + User loginUser = SessionManager.getLoginUser(sessionId, AppConfig.getUserDao()); + + response.fileResponse(Config.COMMENT_PAGE, loginUser, model); + } +} diff --git a/src/main/java/webserver/handler/CommentWriteHandler.java b/src/main/java/webserver/handler/CommentWriteHandler.java new file mode 100644 index 000000000..ae05f85d2 --- /dev/null +++ b/src/main/java/webserver/handler/CommentWriteHandler.java @@ -0,0 +1,46 @@ +package webserver.handler; + +import db.CommentDao; +import model.Comment; +import model.User; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import webserver.HttpRequest; +import webserver.HttpResponse; +import webserver.SessionManager; +import webserver.config.AppConfig; +import webserver.config.Config; + +public class CommentWriteHandler implements Handler{ + private static final Logger logger = LoggerFactory.getLogger(CommentWriteHandler.class); + + private final CommentDao commentDao; + + public CommentWriteHandler(CommentDao commentDao) { + this.commentDao = commentDao; + } + + @Override + public void process(HttpRequest request, HttpResponse response) { + String sessionId = request.getCookie("sid"); + User loginUser = SessionManager.getLoginUser(sessionId, AppConfig.getUserDao()); + + String contents = request.getParameter("contents"); + String articleIdStr = request.getParameter("articleId"); + + if (articleIdStr == null || articleIdStr.isEmpty()) { + logger.error("Failed to send articleId"); + response.sendRedirect(Config.DEFAULT_PAGE); + return; + } + + try { + Long articleId = Long.parseLong(articleIdStr); + commentDao.insert(new Comment(articleId, loginUser.userId(), contents)); + } catch (NumberFormatException e) { + logger.error("Not correct format to articleId: {}", articleIdStr); + } + + response.sendRedirect("/article/index?id=" + articleIdStr); + } +} diff --git a/src/main/java/webserver/handler/LikeHandler.java b/src/main/java/webserver/handler/LikeHandler.java new file mode 100644 index 000000000..5807819f1 --- /dev/null +++ b/src/main/java/webserver/handler/LikeHandler.java @@ -0,0 +1,27 @@ +package webserver.handler; + +import db.ArticleDao; +import webserver.HttpRequest; +import webserver.HttpResponse; +import webserver.config.Config; + +public class LikeHandler implements Handler{ + private final ArticleDao articleDao; + + public LikeHandler(ArticleDao articleDao) { + this.articleDao = articleDao; + } + + @Override + public void process(HttpRequest request, HttpResponse response) { + String idParam = request.getParameter("id"); + if (idParam != null) { + Long articleId = Long.parseLong(idParam); + articleDao.updateLikeCount(articleId); + + response.sendRedirect("/article/index?id=" + articleId); + } else { + response.sendRedirect(Config.DEFAULT_PAGE); + } + } +} diff --git a/src/main/java/webserver/handler/LoginRequestHandler.java b/src/main/java/webserver/handler/LoginRequestHandler.java index c6a28b1e3..5164ead89 100644 --- a/src/main/java/webserver/handler/LoginRequestHandler.java +++ b/src/main/java/webserver/handler/LoginRequestHandler.java @@ -1,6 +1,7 @@ package webserver.handler; import db.Database; +import db.UserDao; import model.User; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -13,10 +14,10 @@ public class LoginRequestHandler implements Handler { private static final Logger logger = LoggerFactory.getLogger(LoginRequestHandler.class); - private final Database database; + private final UserDao userDao; - public LoginRequestHandler(Database database) { - this.database = database; + public LoginRequestHandler(UserDao userDao) { + this.userDao = userDao; } @Override @@ -34,13 +35,13 @@ private void login(HttpRequest request, HttpResponse response) { String userId = request.getParameter("userId"); String password = request.getParameter("password"); - User user = database.findUserById(userId); + User user = userDao.findUserById(userId); - // 유저 없는 경우 로그인 실패 + // 유저 없는 경우 회원가입으로 이동 if (user == null) { logger.debug("Login Failed: User ID '{}' not found in Database", userId); // 알림을 위한 커스텀 헤더 - response.addHeader("Set-Cookie", "login_error=true; Path=/; Max-Age=5"); // 5초만 유지 + response.addHeader("Set-Cookie", "login_error=not_found; Path=/; Max-Age=10"); // 5초만 유지 response.sendRedirect(Config.LOGIN_PAGE); return; } diff --git a/src/main/java/webserver/handler/LogoutRequestHandler.java b/src/main/java/webserver/handler/LogoutRequestHandler.java index 7c7d47c68..5403b2bb4 100644 --- a/src/main/java/webserver/handler/LogoutRequestHandler.java +++ b/src/main/java/webserver/handler/LogoutRequestHandler.java @@ -2,6 +2,7 @@ import db.Database; import db.SessionDatabase; +import db.UserDao; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import webserver.HttpRequest; @@ -11,10 +12,10 @@ public class LogoutRequestHandler implements Handler { private static final Logger logger = LoggerFactory.getLogger(LogoutRequestHandler.class); - private final Database database; + private final UserDao userDao; - public LogoutRequestHandler(Database database) { - this.database = database; + public LogoutRequestHandler(UserDao userDao) { + this.userDao = userDao; } @Override @@ -29,4 +30,4 @@ public void process(HttpRequest request, HttpResponse response) { } response.sendRedirect(Config.DEFAULT_PAGE); } -} +} \ No newline at end of file diff --git a/src/main/java/webserver/handler/MyPageHandler.java b/src/main/java/webserver/handler/MyPageHandler.java new file mode 100644 index 000000000..e7cbb80ed --- /dev/null +++ b/src/main/java/webserver/handler/MyPageHandler.java @@ -0,0 +1,40 @@ +package webserver.handler; + +import db.UserDao; +import model.User; +import org.h2.mvstore.Page; +import webserver.HttpRequest; +import webserver.HttpResponse; +import webserver.PageRender; +import webserver.SessionManager; +import webserver.config.Config; + +import java.util.HashMap; +import java.util.Map; + +public class MyPageHandler implements Handler { + + private final UserDao userDao; + + public MyPageHandler (UserDao userDao) { + this.userDao = userDao; + } + + @Override + public void process(HttpRequest request, HttpResponse response) { + String sessionId = request.getCookie("sid"); + User loginUser = SessionManager.getLoginUser(sessionId, userDao); + + if (loginUser == null) { + response.sendRedirect(Config.LOGIN_PAGE); + return; + } + + Map model = new HashMap<>(); + model.put("header_items", PageRender.renderHeader(loginUser)); + model.put("user_profile_image", PageRender.renderProfile(loginUser)); + model.put("user_name", loginUser.name()); + + response.fileResponse(Config.MY_PAGE, loginUser, model); + } +} diff --git a/src/main/java/webserver/handler/ProfileUpdateHandler.java b/src/main/java/webserver/handler/ProfileUpdateHandler.java new file mode 100644 index 000000000..75e86c20e --- /dev/null +++ b/src/main/java/webserver/handler/ProfileUpdateHandler.java @@ -0,0 +1,106 @@ +package webserver.handler; + +import db.UserDao; +import model.MultipartPart; +import model.User; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import webserver.HttpRequest; +import webserver.HttpResponse; +import webserver.SessionManager; +import webserver.config.Config; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.UUID; + +public class ProfileUpdateHandler implements Handler { + private static final Logger logger = LoggerFactory.getLogger(ProfileUpdateHandler.class); + + private final UserDao userDao; + + public ProfileUpdateHandler(UserDao userDao) { + this.userDao = userDao; + } + + @Override + public void process(HttpRequest request, HttpResponse response) { + String sessionId = request.getCookie("sid"); + User loginUser = SessionManager.getLoginUser(sessionId, userDao); + + String newName = request.getParameter("name"); + String newEmail = request.getParameter("email"); + String newPwd = request.getParameter("password"); + String newPwdConfirm = request.getParameter("password_confirm"); + String deleteImageFlag = request.getParameter("delete_image"); + + if (newName == null || newName.trim().length() < 4) { + logger.warn("Update failed: Name must be at least 4 characters."); + response.addHeader("Set-Cookie", "update_error=invalid_name; Path=/; Max-Age=5"); + response.sendRedirect("/mypage"); + return; + } + + String finalPassword = loginUser.password(); + + // 비밀번호 변경 + if (newPwd != null && !newPwd.trim().isEmpty()) { + if (newPwd.trim().length() < 4) { + logger.warn("Update failed: Password must be at least 4 characters."); + response.addHeader("Set-Cookie", "update_error=invalid_pwd; Path=/; Max-Age=5"); + response.sendRedirect("/mypage"); + return; + } + + if (!newPwd.equals(newPwdConfirm)) { + logger.warn("Profile update failed: Password confirmation mismatch for user '{}'", loginUser.userId()); + + response.addHeader("Set-Cookie", "update_error=pwd_mismatch; Path=/; Max-Age=5"); + response.sendRedirect("/mypage"); + return; + } + + finalPassword = newPwd; + logger.debug("Password change requested and validated for user '{}'", loginUser.userId()); + } + + // 프로필 이미지 처리 + String profileImagePath = loginUser.profileImage(); + + // 프로필 이미지 삭제 + if ("true".equals(deleteImageFlag)) { + profileImagePath = "/img/basic_profileImage.svg"; + } + + // 이미지 업로드 + for (MultipartPart part : request.getMultipartParts()) { + if (part.isFile() && "profileImage".equals(part.name()) && part.data().length > 0) { + profileImagePath = saveUploadedFile(part); + } + } + + User updatedUser = new User(loginUser.userId(), finalPassword, newName, newEmail, profileImagePath); + userDao.update(updatedUser); + + logger.debug("Profile updated for user: {}", loginUser.userId()); + response.sendRedirect(Config.DEFAULT_PAGE); + } + + private String saveUploadedFile(MultipartPart part) { + File dir = new File(Config.EXTERNAL_UPLOAD_PATH); + if (!dir.exists()) { + dir.mkdirs(); + } + + String fileName = UUID.randomUUID().toString() + "_" + part.fileName(); + File file = new File(dir, fileName); + + try (FileOutputStream fos = new FileOutputStream(file)) { + fos.write(part.data()); + return "/uploads/" + fileName; + } catch (IOException e) { + return null; + } + } +} diff --git a/src/main/java/webserver/handler/UserRequestHandler.java b/src/main/java/webserver/handler/UserRequestHandler.java index 80dbe9adc..d44df13a9 100644 --- a/src/main/java/webserver/handler/UserRequestHandler.java +++ b/src/main/java/webserver/handler/UserRequestHandler.java @@ -1,6 +1,7 @@ package webserver.handler; import db.Database; +import db.UserDao; import model.User; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -15,10 +16,10 @@ public class UserRequestHandler implements Handler { public static final Logger logger = LoggerFactory.getLogger(UserRequestHandler.class); - private final Database database; + private final UserDao userDao; - public UserRequestHandler(Database database) { - this.database = database; + public UserRequestHandler(UserDao userDao) { + this.userDao = userDao; } @Override @@ -39,17 +40,43 @@ private void register(HttpRequest request, HttpResponse response) { String name = request.getParameter("name"); String email = request.getParameter("email"); + logger.debug("Parsing Check - ID: {}, PW: {}, Name: {}, Email: {}", userId, password, name, email); + // 유효성 검사 if (isAnyEmpty(userId, password, name)) { logger.warn("Registration failed: Missing required parameters."); - response.sendError(HttpStatus.BAD_REQUEST); + response.addHeader("Set-Cookie", "reg_error=empty_field; Path=/"); + response.sendRedirect("/registration"); + return; + } + + // 최소 4글자 이상 검증 + if (!isValidInput(userId) || !isValidInput(name) || !isValidInput(password)) { + response.addHeader("Set-Cookie", "reg_error=invalid_length; Path=/"); + response.sendRedirect(Config.REGISTRATION_PAGE); + return; + } + + // 아이디 중복 검증 + if (userDao.existsByUserId(userId)) { + response.addHeader("Set-Cookie", "reg_error=duplicate_id; Path=/"); + response.sendRedirect(Config.REGISTRATION_PAGE); return; } - User user = new User(userId, password, name, email); - database.addUser(user); + // 닉네임 중복 검증 + if (userDao.existsByName(name)) { + response.addHeader("Set-Cookie", "reg_error=duplicate_name; Path=/"); + response.sendRedirect(Config.REGISTRATION_PAGE); + return; + } + + String defaultProfileImage = "/img/basic_profileImage.svg"; + + User user = new User(userId, password, name, email, defaultProfileImage); + userDao.insert(user); logger.debug("Saved User: {}", user); - response.sendRedirect(Config.DEFAULT_PAGE); + response.sendRedirect(Config.LOGIN_PAGE); } private boolean isAnyEmpty(String... values) { @@ -60,4 +87,8 @@ private boolean isAnyEmpty(String... values) { } return false; } + + private boolean isValidInput(String input) { + return input != null && input.trim().length() >= 4; + } } diff --git a/src/main/resources/schema.sql b/src/main/resources/schema.sql new file mode 100644 index 000000000..1ae1d8e82 --- /dev/null +++ b/src/main/resources/schema.sql @@ -0,0 +1,31 @@ +-- 1. 회원 정보를 위한 테이블 +CREATE TABLE IF NOT EXISTS USERS ( + userId VARCHAR(50) PRIMARY KEY, + password VARCHAR(50) NOT NULL, + name VARCHAR(50) NOT NULL, + email VARCHAR(100), + profileImage VARCHAR(255) DEFAULT '/img/basic_profileImage.svg' + ); + +-- 2. 게시글 저장을 위한 테이블 (이미지 경로 및 좋아요 수 추가) +CREATE TABLE IF NOT EXISTS ARTICLE ( + id BIGINT AUTO_INCREMENT PRIMARY KEY, + writer VARCHAR(50) NOT NULL, + title VARCHAR(255), + contents TEXT, + imagePath VARCHAR(255), -- 게시글에 업로드된 이미지 경로 + likeCount INT DEFAULT 0, -- 좋아요 개수 + createdAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + FOREIGN KEY (writer) REFERENCES USERS(userId) ON DELETE CASCADE + ); + +-- 3. 댓글 저장을 위한 테이블 +CREATE TABLE IF NOT EXISTS COMMENTS ( + id BIGINT AUTO_INCREMENT PRIMARY KEY, + articleId BIGINT NOT NULL, -- 어떤 게시글의 댓글인지 + writer VARCHAR(50) NOT NULL, -- 댓글 작성자 ID + text TEXT NOT NULL, -- 댓글 내용 + createdAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + FOREIGN KEY (articleId) REFERENCES ARTICLE(id) ON DELETE CASCADE, + FOREIGN KEY (writer) REFERENCES USERS(userId) ON DELETE CASCADE + ); \ No newline at end of file diff --git a/src/main/resources/static/article/index.html b/src/main/resources/static/article/index.html index 6d2c8eeef..b17f6aaae 100644 --- a/src/main/resources/static/article/index.html +++ b/src/main/resources/static/article/index.html @@ -9,39 +9,66 @@
    - +
      -
    • - 글쓰기 -
    • -
    • - -
    • + {{header_items}}

    게시글 작성

    -
    + +
    +

    제목

    + +

    내용

    +
    +

    이미지 첨부

    + +
    + diff --git a/src/main/resources/static/comment/index.html b/src/main/resources/static/comment/index.html index 35df2b252..9e14b04dd 100644 --- a/src/main/resources/static/comment/index.html +++ b/src/main/resources/static/comment/index.html @@ -9,24 +9,19 @@
    - +
      -
    • - 글쓰기 -
    • -
    • - -
    • + {{header_items}}

    댓글 작성

    -
    + +

    내용