commit 23f594c3c5ea54f78cc6b39c59ce217b14f0ec2a Author: pandoli365 Date: Sun May 3 16:13:32 2026 +0900 Prepare public repository diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..3b41682 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +/mvnw text eol=lf +*.cmd text eol=crlf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c4e414f --- /dev/null +++ b/.gitignore @@ -0,0 +1,36 @@ +target/ +.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Local secrets ### +src/main/resources/*/db.properties +!src/main/resources/*/db.properties.example diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..c595b00 --- /dev/null +++ b/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,3 @@ +wrapperVersion=3.3.4 +distributionType=only-script +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.14/apache-maven-3.9.14-bin.zip diff --git a/docs/profile-management-prompt.md b/docs/profile-management-prompt.md new file mode 100644 index 0000000..778cfe2 --- /dev/null +++ b/docs/profile-management-prompt.md @@ -0,0 +1,57 @@ +# Profile Management Prompt + +아래 프롬프트를 AI에게 전달하고, 원하는 작업과 프로파일 이름을 함께 적으면 됩니다. + +## Prompt + +```text +너는 이 Spring Boot Maven 프로젝트의 프로파일 관리 담당자다. + +요청: +- 작업: [추가 또는 삭제] +- 프로파일 이름: [예: dev, live, stage, local] + +프로젝트 규칙: +- Maven 프로파일은 `pom.xml`의 `` 아래에 정의한다. +- 각 Maven 프로파일은 `spring-boot-maven-plugin`의 `{profileName}` 설정으로 같은 이름의 Spring profile을 실행하도록 만든다. +- Spring profile별 설정 파일은 `src/main/resources/{profileName}/application.properties`에 둔다. +- DB 설정 파일은 `src/main/resources/{profileName}/db.properties`에 둔다. +- `{profileName}/application.properties`는 `spring.config.import=classpath:{profileName}/db.properties`를 포함해야 한다. +- 루트 `src/main/resources/application.properties`는 기본 실행 프로파일만 관리한다. 사용자가 기본 프로파일 변경을 요청하지 않았다면 수정하지 않는다. +- `spring-boot-starter-parent`를 다시 추가하지 않는다. 이 프로젝트는 `spring-boot-dependencies` BOM import 방식으로 관리한다. +- `native`, `nativeTest` 프로파일을 추가하지 않는다. + +프로파일 추가 작업: +1. `pom.xml`에 같은 이름의 Maven profile이 이미 있는지 확인한다. +2. 없으면 기존 `dev` 또는 `live` 프로파일 블록과 같은 형식으로 새 profile을 추가한다. +3. `src/main/resources/{profileName}/application.properties`를 만든다. +4. `src/main/resources/{profileName}/db.properties`를 만든다. +5. 새 설정 파일은 기존 `dev` 또는 `live` 설정을 참고하되, 프로파일 이름이 들어가는 값은 `{profileName}`으로 맞춘다. +6. DB 접속 정보처럼 민감하거나 환경마다 달라지는 값은 기존 값을 무작정 복사하지 말고 placeholder 또는 사용자가 제공한 값으로 둔다. + +프로파일 삭제 작업: +1. `pom.xml`의 ``에서 해당 profile 블록만 삭제한다. +2. `src/main/resources/{profileName}` 디렉터리의 설정 파일 삭제 여부를 사용자 요청에서 확인한다. +3. 삭제 대상 프로파일이 루트 `application.properties`의 `spring.profiles.active` 또는 `spring.config.import`에 쓰이고 있으면, 삭제 전에 대체 기본 프로파일을 사용자에게 확인한다. +4. 다른 프로파일이나 공통 설정은 건드리지 않는다. + +검증: +- Maven Wrapper를 사용할 수 있으면 `./mvnw validate`를 실행한다. +- 가능하면 `./mvnw help:all-profiles`로 원하는 프로파일만 표시되는지 확인한다. +- 검증을 실행할 수 없으면 그 이유를 최종 답변에 명확히 적는다. + +최종 답변: +- 변경한 파일 목록을 짧게 요약한다. +- 추가/삭제된 프로파일 이름을 명시한다. +- 실행한 검증 명령과 결과를 적는다. +``` + +## Example + +```text +위 프롬프트를 참고해서 `stage` 프로파일을 추가해줘. +``` + +```text +위 프롬프트를 참고해서 `dev` 프로파일을 삭제해줘. 단, 설정 파일도 함께 삭제해줘. +``` diff --git a/mvnw b/mvnw new file mode 100644 index 0000000..bd8896b --- /dev/null +++ b/mvnw @@ -0,0 +1,295 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.3.4 +# +# Optional ENV vars +# ----------------- +# JAVA_HOME - location of a JDK home dir, required when download maven via java source +# MVNW_REPOURL - repo url base for downloading maven distribution +# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output +# ---------------------------------------------------------------------------- + +set -euf +[ "${MVNW_VERBOSE-}" != debug ] || set -x + +# OS specific support. +native_path() { printf %s\\n "$1"; } +case "$(uname)" in +CYGWIN* | MINGW*) + [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" + native_path() { cygpath --path --windows "$1"; } + ;; +esac + +# set JAVACMD and JAVACCMD +set_java_home() { + # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched + if [ -n "${JAVA_HOME-}" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACCMD="$JAVA_HOME/jre/sh/javac" + else + JAVACMD="$JAVA_HOME/bin/java" + JAVACCMD="$JAVA_HOME/bin/javac" + + if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then + echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 + echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 + return 1 + fi + fi + else + JAVACMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v java + )" || : + JAVACCMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v javac + )" || : + + if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then + echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 + return 1 + fi + fi +} + +# hash string like Java String::hashCode +hash_string() { + str="${1:-}" h=0 + while [ -n "$str" ]; do + char="${str%"${str#?}"}" + h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) + str="${str#?}" + done + printf %x\\n $h +} + +verbose() { :; } +[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } + +die() { + printf %s\\n "$1" >&2 + exit 1 +} + +trim() { + # MWRAPPER-139: + # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. + # Needed for removing poorly interpreted newline sequences when running in more + # exotic environments such as mingw bash on Windows. + printf "%s" "${1}" | tr -d '[:space:]' +} + +scriptDir="$(dirname "$0")" +scriptName="$(basename "$0")" + +# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties +while IFS="=" read -r key value; do + case "${key-}" in + distributionUrl) distributionUrl=$(trim "${value-}") ;; + distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; + esac +done <"$scriptDir/.mvn/wrapper/maven-wrapper.properties" +[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" + +case "${distributionUrl##*/}" in +maven-mvnd-*bin.*) + MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ + case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in + *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; + :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; + :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; + :Linux*x86_64*) distributionPlatform=linux-amd64 ;; + *) + echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 + distributionPlatform=linux-amd64 + ;; + esac + distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" + ;; +maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; +*) MVN_CMD="mvn${scriptName#mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; +esac + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" +distributionUrlName="${distributionUrl##*/}" +distributionUrlNameMain="${distributionUrlName%.*}" +distributionUrlNameMain="${distributionUrlNameMain%-bin}" +MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" +MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" + +exec_maven() { + unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : + exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" +} + +if [ -d "$MAVEN_HOME" ]; then + verbose "found existing MAVEN_HOME at $MAVEN_HOME" + exec_maven "$@" +fi + +case "${distributionUrl-}" in +*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; +*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; +esac + +# prepare tmp dir +if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then + clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } + trap clean HUP INT TERM EXIT +else + die "cannot create temp dir" +fi + +mkdir -p -- "${MAVEN_HOME%/*}" + +# Download and Install Apache Maven +verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +verbose "Downloading from: $distributionUrl" +verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +# select .zip or .tar.gz +if ! command -v unzip >/dev/null; then + distributionUrl="${distributionUrl%.zip}.tar.gz" + distributionUrlName="${distributionUrl##*/}" +fi + +# verbose opt +__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' +[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v + +# normalize http auth +case "${MVNW_PASSWORD:+has-password}" in +'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; +has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; +esac + +if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then + verbose "Found wget ... using wget" + wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" +elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then + verbose "Found curl ... using curl" + curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" +elif set_java_home; then + verbose "Falling back to use Java to download" + javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" + targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" + cat >"$javaSource" <<-END + public class Downloader extends java.net.Authenticator + { + protected java.net.PasswordAuthentication getPasswordAuthentication() + { + return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); + } + public static void main( String[] args ) throws Exception + { + setDefault( new Downloader() ); + java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); + } + } + END + # For Cygwin/MinGW, switch paths to Windows format before running javac and java + verbose " - Compiling Downloader.java ..." + "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" + verbose " - Running Downloader.java ..." + "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" +fi + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +if [ -n "${distributionSha256Sum-}" ]; then + distributionSha256Result=false + if [ "$MVN_CMD" = mvnd.sh ]; then + echo "Checksum validation is not supported for maven-mvnd." >&2 + echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + elif command -v sha256sum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c - >/dev/null 2>&1; then + distributionSha256Result=true + fi + elif command -v shasum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then + distributionSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 + echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + fi + if [ $distributionSha256Result = false ]; then + echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 + echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 + exit 1 + fi +fi + +# unzip and move +if command -v unzip >/dev/null; then + unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" +else + tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" +fi + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +actualDistributionDir="" + +# First try the expected directory name (for regular distributions) +if [ -d "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" ]; then + if [ -f "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/bin/$MVN_CMD" ]; then + actualDistributionDir="$distributionUrlNameMain" + fi +fi + +# If not found, search for any directory with the Maven executable (for snapshots) +if [ -z "$actualDistributionDir" ]; then + # enable globbing to iterate over items + set +f + for dir in "$TMP_DOWNLOAD_DIR"/*; do + if [ -d "$dir" ]; then + if [ -f "$dir/bin/$MVN_CMD" ]; then + actualDistributionDir="$(basename "$dir")" + break + fi + fi + done + set -f +fi + +if [ -z "$actualDistributionDir" ]; then + verbose "Contents of $TMP_DOWNLOAD_DIR:" + verbose "$(ls -la "$TMP_DOWNLOAD_DIR")" + die "Could not find Maven distribution directory in extracted archive" +fi + +verbose "Found extracted Maven distribution directory: $actualDistributionDir" +printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url" +mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" + +clean || : +exec_maven "$@" diff --git a/mvnw.cmd b/mvnw.cmd new file mode 100644 index 0000000..92450f9 --- /dev/null +++ b/mvnw.cmd @@ -0,0 +1,189 @@ +<# : batch portion +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.3.4 +@REM +@REM Optional ENV vars +@REM MVNW_REPOURL - repo url base for downloading maven distribution +@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output +@REM ---------------------------------------------------------------------------- + +@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) +@SET __MVNW_CMD__= +@SET __MVNW_ERROR__= +@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% +@SET PSModulePath= +@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( + IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) +) +@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% +@SET __MVNW_PSMODULEP_SAVE= +@SET __MVNW_ARG0_NAME__= +@SET MVNW_USERNAME= +@SET MVNW_PASSWORD= +@IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*) +@echo Cannot start maven from wrapper >&2 && exit /b 1 +@GOTO :EOF +: end batch / begin powershell #> + +$ErrorActionPreference = "Stop" +if ($env:MVNW_VERBOSE -eq "true") { + $VerbosePreference = "Continue" +} + +# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties +$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl +if (!$distributionUrl) { + Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" +} + +switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { + "maven-mvnd-*" { + $USE_MVND = $true + $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" + $MVN_CMD = "mvnd.cmd" + break + } + default { + $USE_MVND = $false + $MVN_CMD = $script -replace '^mvnw','mvn' + break + } +} + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +if ($env:MVNW_REPOURL) { + $MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" } + $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')" +} +$distributionUrlName = $distributionUrl -replace '^.*/','' +$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' + +$MAVEN_M2_PATH = "$HOME/.m2" +if ($env:MAVEN_USER_HOME) { + $MAVEN_M2_PATH = "$env:MAVEN_USER_HOME" +} + +if (-not (Test-Path -Path $MAVEN_M2_PATH)) { + New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null +} + +$MAVEN_WRAPPER_DISTS = $null +if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) { + $MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists" +} else { + $MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists" +} + +$MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain" +$MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' +$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" + +if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { + Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" + Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" + exit $? +} + +if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { + Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" +} + +# prepare tmp dir +$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile +$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" +$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null +trap { + if ($TMP_DOWNLOAD_DIR.Exists) { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } + } +} + +New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null + +# Download and Install Apache Maven +Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +Write-Verbose "Downloading from: $distributionUrl" +Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +$webclient = New-Object System.Net.WebClient +if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { + $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) +} +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum +if ($distributionSha256Sum) { + if ($USE_MVND) { + Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." + } + Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash + if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { + Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." + } +} + +# unzip and move +Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +$actualDistributionDir = "" + +# First try the expected directory name (for regular distributions) +$expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain" +$expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD" +if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) { + $actualDistributionDir = $distributionUrlNameMain +} + +# If not found, search for any directory with the Maven executable (for snapshots) +if (!$actualDistributionDir) { + Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object { + $testPath = Join-Path $_.FullName "bin/$MVN_CMD" + if (Test-Path -Path $testPath -PathType Leaf) { + $actualDistributionDir = $_.Name + } + } +} + +if (!$actualDistributionDir) { + Write-Error "Could not find Maven distribution directory in extracted archive" +} + +Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir" +Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null +try { + Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null +} catch { + if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { + Write-Error "fail to move MAVEN_HOME" + } +} finally { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } +} + +Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..826cd78 --- /dev/null +++ b/pom.xml @@ -0,0 +1,237 @@ + + + 4.0.0 + com.pandoli365 + bibimbap + 0.0.1-SNAPSHOT + war + bibimbap + bibimbap + + + + + + + + + + + + + + + 21 + ${java.version} + UTF-8 + UTF-8 + 3.5.14-SNAPSHOT + 1.18.44 + 3.4.1 + 3.14.1 + 3.1.4 + 3.5.5 + 3.1.4 + 3.3.1 + 3.5.5 + 3.4.0 + + + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} + pom + import + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.apache.tomcat.embed + tomcat-embed-jasper + + + + org.projectlombok + lombok + true + + + org.springframework.boot + spring-boot-starter-tomcat + provided + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + + org.apache.maven.plugins + maven-clean-plugin + ${maven-clean-plugin.version} + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + + org.apache.maven.plugins + maven-deploy-plugin + ${maven-deploy-plugin.version} + + + org.apache.maven.plugins + maven-failsafe-plugin + ${maven-failsafe-plugin.version} + + + org.apache.maven.plugins + maven-install-plugin + ${maven-install-plugin.version} + + + org.apache.maven.plugins + maven-resources-plugin + ${maven-resources-plugin.version} + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + org.apache.maven.plugins + maven-war-plugin + ${maven-war-plugin.version} + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot.version} + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + default-compile + compile + + compile + + + + + org.projectlombok + lombok + ${lombok.version} + + + + + + default-testCompile + test-compile + + testCompile + + + + + org.projectlombok + lombok + ${lombok.version} + + + + + + + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + false + + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + false + + + + + + + dev + + + + org.springframework.boot + spring-boot-maven-plugin + + + dev + + + + + + + + live + + + + org.springframework.boot + spring-boot-maven-plugin + + + live + + + + + + + + + diff --git a/src/main/java/com/pandoli365/bibimbap/BibimbapApplication.java b/src/main/java/com/pandoli365/bibimbap/BibimbapApplication.java new file mode 100644 index 0000000..de67094 --- /dev/null +++ b/src/main/java/com/pandoli365/bibimbap/BibimbapApplication.java @@ -0,0 +1,13 @@ +package com.pandoli365.bibimbap; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class BibimbapApplication { + + public static void main(String[] args) { + SpringApplication.run(BibimbapApplication.class, args); + } + +} diff --git a/src/main/java/com/pandoli365/bibimbap/ServletInitializer.java b/src/main/java/com/pandoli365/bibimbap/ServletInitializer.java new file mode 100644 index 0000000..1332410 --- /dev/null +++ b/src/main/java/com/pandoli365/bibimbap/ServletInitializer.java @@ -0,0 +1,13 @@ +package com.pandoli365.bibimbap; + +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; + +public class ServletInitializer extends SpringBootServletInitializer { + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + return application.sources(BibimbapApplication.class); + } + +} diff --git a/src/main/java/com/pandoli365/bibimbap/abstracts/ErrorResult.java b/src/main/java/com/pandoli365/bibimbap/abstracts/ErrorResult.java new file mode 100644 index 0000000..6363d6c --- /dev/null +++ b/src/main/java/com/pandoli365/bibimbap/abstracts/ErrorResult.java @@ -0,0 +1,7 @@ +package com.pandoli365.bibimbap.abstracts; + +public class ErrorResult extends Result{ + public ErrorResult(int status) { + super(status); + } +} \ No newline at end of file diff --git a/src/main/java/com/pandoli365/bibimbap/abstracts/Request.java b/src/main/java/com/pandoli365/bibimbap/abstracts/Request.java new file mode 100644 index 0000000..091e41f --- /dev/null +++ b/src/main/java/com/pandoli365/bibimbap/abstracts/Request.java @@ -0,0 +1,7 @@ +package com.pandoli365.bibimbap.abstracts; + +public abstract class Request { + public boolean IsReceivedAllField() { + return true; + } +} \ No newline at end of file diff --git a/src/main/java/com/pandoli365/bibimbap/abstracts/Result.java b/src/main/java/com/pandoli365/bibimbap/abstracts/Result.java new file mode 100644 index 0000000..4b9f588 --- /dev/null +++ b/src/main/java/com/pandoli365/bibimbap/abstracts/Result.java @@ -0,0 +1,27 @@ +package com.pandoli365.bibimbap.abstracts; + +public abstract class Result { + public int status; + public String message; + + public Result() {} + public Result(int status) { + this.status = status; + switch (status) + { + case 200: + this.message = "Success"; return; + case 400: + this.message = "Invalid Request"; return; + case 401: + this.message = "세션 만료"; return; + case 1000: + this.message = "NULL USERS"; return; + default: + System.out.println("잘못된 status 케이스"); + this.message = ""; + return; + } + } + +} \ No newline at end of file diff --git a/src/main/java/com/pandoli365/bibimbap/abstracts/Service.java b/src/main/java/com/pandoli365/bibimbap/abstracts/Service.java new file mode 100644 index 0000000..ff97cfe --- /dev/null +++ b/src/main/java/com/pandoli365/bibimbap/abstracts/Service.java @@ -0,0 +1,18 @@ +package com.pandoli365.bibimbap.abstracts; + +import jakarta.servlet.http.HttpSession; + +public abstract class Service { + + public boolean is_login = false; + + public abstract Res StartService(HttpSession session, Req request); + + public Res ChackService(HttpSession session, Req request){ + if (is_login && session.getAttribute("id") == null) + return (Res) new ErrorResult(401); + if(request != null && !request.IsReceivedAllField()) + return (Res) new ErrorResult(401); + return StartService(session, request); + } +} diff --git a/src/main/java/com/pandoli365/bibimbap/controller/WebMvcController.java b/src/main/java/com/pandoli365/bibimbap/controller/WebMvcController.java new file mode 100644 index 0000000..241df06 --- /dev/null +++ b/src/main/java/com/pandoli365/bibimbap/controller/WebMvcController.java @@ -0,0 +1,68 @@ +package com.pandoli365.bibimbap.controller; + +import jakarta.servlet.RequestDispatcher; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpSession; +import org.springframework.boot.web.servlet.error.ErrorController; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +import java.util.Arrays; + +//이곳에서는 뷰만 제어 +@Controller +public class WebMvcController implements WebMvcConfigurer, ErrorController { + + @RequestMapping("/error") + public ModelAndView errorView(HttpServletRequest request) { + ModelAndView mv = new ModelAndView("/errer"); + Object status = request.getAttribute(RequestDispatcher.ERROR_STATUS_CODE); + if (status != null) { + mv.addObject("statusCode", status); + } + return mv; + } + + @RequestMapping("/{pageName}") + public ModelAndView mainView(@PathVariable("pageName") String pageName, + @RequestParam(required = false) String id, + HttpSession session, + HttpServletRequest request) { + ModelAndView mv = new ModelAndView(); +// if (!ALLOWED_PAGES.contains(keyword)) { +// return new ModelAndView("redirect:/main"); +// } + switch (pageName) { + case "error": + mv.setViewName("/errer"); + Object status = request.getAttribute(RequestDispatcher.ERROR_STATUS_CODE); + if (status != null) { + mv.addObject("statusCode", status); + } + break; + default: + mv.setViewName("/index"); + break; + } + + return mv; + } + + /// 접속기기 모바일 확인 함수 + private boolean isMobileDevice(HttpServletRequest request) { + String userAgent = request.getHeader("User-Agent"); + if (userAgent == null) { + return false; // User-Agent가 없는 경우 기본값은 false + } + + // 모바일 User-Agent 리스트 (대표적인 기기들) + String[] mobileKeywords = {"Android", "iPhone", "iPad", "iPod", "Windows Phone", "Mobile", "Opera Mini", "BlackBerry"}; + + // User-Agent 문자열이 모바일 기기를 포함하는지 검사 + return Arrays.stream(mobileKeywords).anyMatch(userAgent::contains); + } +} diff --git a/src/main/java/com/pandoli365/bibimbap/controller/api/GameController.java b/src/main/java/com/pandoli365/bibimbap/controller/api/GameController.java new file mode 100644 index 0000000..98757a0 --- /dev/null +++ b/src/main/java/com/pandoli365/bibimbap/controller/api/GameController.java @@ -0,0 +1,34 @@ +package com.pandoli365.bibimbap.controller.api; + +import com.pandoli365.bibimbap.game.GameCatalog; +import org.springframework.context.annotation.Configuration; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; + +@Configuration +public class GameController { + + + public static String webglUrlForGame(int gameId) { + return "/webgl/game-" + gameId + "/index.html"; + } + @GetMapping("/game/{id}") + public String gameDetail(@PathVariable("id") int id, Model model) { + if (!GameCatalog.isValidId(id)) { + return "redirect:/"; + } + int idx = GameCatalog.toIndex(id); + model.addAttribute("gameId", id); + model.addAttribute("gameName", GameCatalog.NAMES[idx]); + model.addAttribute("creator", GameCatalog.CREATORS[idx]); + model.addAttribute("likeCount", GameCatalog.LIKE_COUNTS[idx]); + model.addAttribute("likeCountFormatted", String.format("%,d", GameCatalog.LIKE_COUNTS[idx])); + model.addAttribute("creatorNote", GameCatalog.CREATOR_NOTES[idx]); + model.addAttribute("gitUrl", GameCatalog.GIT_URLS[idx]); + /* 데모: 공통 플레이스홀더. 실제 빌드는 static/webgl/game-{id}/ 에 두고 아래 한 줄을 webglUrlForGame(id) 로 바꾸면 됩니다. */ + model.addAttribute("webglUrl", "/webgl/placeholder/index.html"); + model.addAttribute("webglDeployPath", webglUrlForGame(id)); + return "game-detail"; + } +} diff --git a/src/main/java/com/pandoli365/bibimbap/game/GameCatalog.java b/src/main/java/com/pandoli365/bibimbap/game/GameCatalog.java new file mode 100644 index 0000000..c3dd4a2 --- /dev/null +++ b/src/main/java/com/pandoli365/bibimbap/game/GameCatalog.java @@ -0,0 +1,91 @@ +package com.pandoli365.bibimbap.game; + +/** + * 데모용 게임 메타데이터. DB 연동 시 저장소로 대체하면 됩니다. + */ +public final class GameCatalog { + + private GameCatalog() { + } + + public static final int COUNT = 20; + + public static final String[] NAMES = { + "별빛 정원", "던전 카페", "픽셀 레이서", "구름 위를 걷다", + "마지막 타임라인", "요리하는 용", "네온 시티", "작은 숲의 집", + "역전 재판인", "달무리 탐정", "코드 러너", "바다 노래", + "시간 상자", "불꽃 학원", "조용한 우주", "종이 비행기", + "거울 미로", "손끝 RPG", "노을 역", "꿈의 도서관" + }; + + public static final String[] CREATORS = { + "Studio Luna", "김민재", "PixelCat", "이하늘", + "Team Horizon", "별작업실", "NEON LAB", "숲그림", + "Court Games", "달무리", "dev.han", "wave.sound", + "BoxSoft", "학원제작소", "COSMOS", "PaperFly", + "mirror.inc", "손끝게임즈", "노을팀", "책벌레" + }; + + public static final int[] LIKE_COUNTS = { + 1284, 56, 8921, 234, + 1205, 445, 678, 9012, + 3400, 12, 567, 89, + 4456, 223, 7777, 156, + 990, 34, 2100, 888 + }; + + /** 제작자 한마디 (상세 페이지 하단) */ + public static final String[] CREATOR_NOTES = { + "밤하늘을 걸으며 힐링하고 싶어서 만들었습니다. 플레이 해 주셔서 감사합니다.", + "카페 던전은 사랑입니다. 버그 제보는 Git 이슈로 부탁드려요.", + "속도감 있는 레이싱! 컨트롤은 WASD, 모바일은 추후 지원 예정이에요.", + "구름 위를 걷는 기분을 WebGL로 담아봤습니다.", + "스토리에 집중했습니다. 엔딩까지 플레이해 주세요.", + "요리 도트에 진심입니다. 레시피 아이디어 환영합니다.", + "네온 사인이 마음에 드셨다면 별 하나 부탁드려요.", + "작은 집에서 시작하는 하루. 소소한 상호작용을 즐겨 주세요.", + "반전 스토리, 스포일러는 삼가 주세요!", + "추리는 끝이 없어요. 힌트는 커뮤니티에 올려 두었습니다.", + "코딩하듯 플레이하는 러너. PR도 환영합니다.", + "바다 소리를 들으며 플레이해 보세요. 이어폰 추천!", + "시간 루프가 헷갈리면 메모를 추천합니다.", + "학원물이지만 가볍게 즐겨 주세요.", + "우주는 넓고 할 일은 많습니다. 업데이트 예정이에요.", + "종이비행기처럼 가볍게 날아가 보세요.", + "거울 방향이 헷갈릴 수 있어요. 인내심을…", + "손끝으로 즐기는 턴제 RPG입니다.", + "노을이 지는 역에서 만나요.", + "책 속 세계로 오신 걸 환영합니다." + }; + + public static final String[] GIT_URLS = { + "https://github.com/example/starlight-garden", + "https://github.com/example/dungeon-cafe", + "https://github.com/example/pixel-racer", + "https://github.com/example/cloud-walk", + "https://github.com/example/last-timeline", + "https://github.com/example/cooking-dragon", + "https://github.com/example/neon-city", + "https://github.com/example/small-forest", + "https://github.com/example/court-game", + "https://github.com/example/moon-detective", + "https://github.com/example/code-runner", + "https://github.com/example/sea-song", + "https://github.com/example/time-box", + "https://github.com/example/flame-school", + "https://github.com/example/quiet-space", + "https://github.com/example/paper-plane", + "https://github.com/example/mirror-maze", + "https://github.com/example/fingertip-rpg", + "https://github.com/example/sunset-station", + "https://github.com/example/dream-library" + }; + + public static boolean isValidId(int id) { + return id >= 1 && id <= COUNT; + } + + public static int toIndex(int id) { + return id - 1; + } +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 0000000..eba4df6 --- /dev/null +++ b/src/main/resources/application.properties @@ -0,0 +1,7 @@ +spring.application.name=bibimbap + +spring.mvc.view.prefix=/WEB-INF/views/ +spring.mvc.view.suffix=.jsp + +spring.profiles.active=dev +spring.config.import=optional:classpath:dev/application.properties diff --git a/src/main/resources/dev/application.properties b/src/main/resources/dev/application.properties new file mode 100644 index 0000000..f6a375e --- /dev/null +++ b/src/main/resources/dev/application.properties @@ -0,0 +1,23 @@ +spring.profiles.active=dev +spring.application.name=bibimbap + +# ViewResolver +spring.mvc.view.prefix=/WEB-INF/views/ +spring.mvc.view.suffix=.jsp + +# common +spring.config.import=classpath:dev/db.properties + +# IP +server.address=0.0.0.0 + +# encoding +server.servlet.encoding.force-response=true + +# file upload Max Size +spring.servlet.multipart.max-file-size=100MB +spring.servlet.multipart.max-request-size=100MB + +# log +mybatis.configuration.log-impl=org.apache.ibatis.logging.slf4j.Slf4jImpl +logging.level.org.apache.ibatis=TRACE diff --git a/src/main/resources/dev/db.properties.example b/src/main/resources/dev/db.properties.example new file mode 100644 index 0000000..3abb21f --- /dev/null +++ b/src/main/resources/dev/db.properties.example @@ -0,0 +1,4 @@ +spring.datasource.driver-class-name=org.postgresql.Driver +spring.datasource.url=jdbc:postgresql://localhost:5432/bibimbap?currentSchema=dev +spring.datasource.username=your_username +spring.datasource.password=your_password diff --git a/src/main/resources/live/application.properties b/src/main/resources/live/application.properties new file mode 100644 index 0000000..6c6c0f0 --- /dev/null +++ b/src/main/resources/live/application.properties @@ -0,0 +1,23 @@ +spring.profiles.active=live +spring.application.name=bibimbap + +# ViewResolver +spring.mvc.view.prefix=/WEB-INF/views/ +spring.mvc.view.suffix=.jsp + +# common +spring.config.import=classpath:live/db.properties + +# IP +server.address=0.0.0.0 + +# encoding +server.servlet.encoding.force-response=true + +# file upload Max Size +spring.servlet.multipart.max-file-size=100MB +spring.servlet.multipart.max-request-size=100MB + +# log +mybatis.configuration.log-impl=org.apache.ibatis.logging.slf4j.Slf4jImpl +logging.level.org.apache.ibatis=TRACE diff --git a/src/main/resources/live/db.properties.example b/src/main/resources/live/db.properties.example new file mode 100644 index 0000000..6492ced --- /dev/null +++ b/src/main/resources/live/db.properties.example @@ -0,0 +1,4 @@ +spring.datasource.driver-class-name=org.postgresql.Driver +spring.datasource.url=jdbc:postgresql://localhost:5432/bibimbap?currentSchema=live +spring.datasource.username=your_username +spring.datasource.password=your_password diff --git a/src/main/webapp/WEB-INF/views/errer.jsp b/src/main/webapp/WEB-INF/views/errer.jsp new file mode 100644 index 0000000..40718d4 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/errer.jsp @@ -0,0 +1,231 @@ +<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" language="java" isErrorPage="true" %> +<%! + private String htmlEscape(Object value) { + if (value == null) { + return ""; + } + return String.valueOf(value) + .replace("&", "&") + .replace("<", "<") + .replace(">", ">") + .replace("\"", """) + .replace("'", "'"); + } +%> + + + + + + + 오류가 발생했습니다 | bibimbap + + + + + <% + String ctx = request.getContextPath(); + Object statusCode = request.getAttribute("jakarta.servlet.error.status_code"); + Object requestUri = request.getAttribute("jakarta.servlet.error.request_uri"); + Object message = request.getAttribute("jakarta.servlet.error.message"); + if (message == null || String.valueOf(message).isBlank()) { + message = exception != null ? exception.getMessage() : null; + } + %> +
+
+ +

+ <% if (statusCode != null) { %> + ERROR <%= statusCode %> + <% } else { %> + ERROR + <% } %> +

+

페이지를 불러오지 못했습니다

+

+ 요청을 처리하는 중 문제가 발생했습니다. 잠시 후 다시 시도하거나 홈으로 돌아가 다른 메뉴를 이용해 주세요. +

+ <% if (requestUri != null || message != null) { %> +
+ <% if (requestUri != null) { %> +
요청 경로: <%= htmlEscape(requestUri) %>
+ <% } %> + <% if (message != null) { %> +
메시지: <%= htmlEscape(message) %>
+ <% } %> +
+ <% } %> + +
+
+ + + diff --git a/src/main/webapp/WEB-INF/views/footer.jsp b/src/main/webapp/WEB-INF/views/footer.jsp new file mode 100644 index 0000000..868dc66 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/footer.jsp @@ -0,0 +1,93 @@ +<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %> + + diff --git a/src/main/webapp/WEB-INF/views/game-detail.jsp b/src/main/webapp/WEB-INF/views/game-detail.jsp new file mode 100644 index 0000000..ae85c29 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/game-detail.jsp @@ -0,0 +1,900 @@ +<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %> + + + + + + + ${gameName} — bibimbap + + + + +
+ + + 목록으로 + + +
+

${gameName}

+
+
+
+ + 번호 +
+ #${gameId} +
+
+
+ + 제작자 +
+ ${creator} +
+ +
+
+ +
+
+ +

플레이

+ WebGL +
+
+
+ +
+
+

실제 Unity WebGL 빌드는 리소스 폴더에 두세요. 예: static${webglDeployPath}
+ 준비되면 GameController에서 webglUrl을 해당 경로(webglUrlForGame(id))로 바꾸면 됩니다.

+
+ +
+
+
+ +
+

제작자의 한마디

+

이 게임을 만들며 전하고 싶었던 이야기예요.

+
+
+
${creatorNote}
+ +
+ +
+
+ +
+

덧글

+

플레이 소감이나 버그 제보를 남겨 주세요.

+
+
+
+
+ + +
+ 최대 1,000자 + +
+
+
+ +
    +
    +
    +
    + + + + + diff --git a/src/main/webapp/WEB-INF/views/header.jsp b/src/main/webapp/WEB-INF/views/header.jsp new file mode 100644 index 0000000..ece1ca1 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/header.jsp @@ -0,0 +1,173 @@ +<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %> + + + + diff --git a/src/main/webapp/WEB-INF/views/index.jsp b/src/main/webapp/WEB-INF/views/index.jsp new file mode 100644 index 0000000..cca345c --- /dev/null +++ b/src/main/webapp/WEB-INF/views/index.jsp @@ -0,0 +1,535 @@ +<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" language="java" %> +<%@ page import="com.pandoli365.bibimbap.game.GameCatalog" %> + + + + + + + bibimbap + + + + +
    +
    + + +
    + +
    + <%-- 카드 데이터: GameCatalog (DB 연동 시 교체) --%> + <% + String ctx = request.getContextPath(); + for (int i = 0; i < GameCatalog.COUNT; i++) { + int displayIndex = i + 1; + /* 썸네일 URL — DB 연동 시 null·빈 문자열이면 로고 폴백 */ + String thumbUrl = null; // 예: list.get(i).getThumbnailUrl() + boolean hasImage = thumbUrl != null && !thumbUrl.isBlank(); + %> + +
    + + <% if (hasImage) { %> + + <% } else { %> + + <% } %> +
    +
    +

    <%= GameCatalog.NAMES[i] %>

    +

    <%= GameCatalog.CREATORS[i] %>

    + +
    +
    + <% + } + %> +
    +
    + + + + diff --git a/src/main/webapp/WEB-INF/views/theme-init.jsp b/src/main/webapp/WEB-INF/views/theme-init.jsp new file mode 100644 index 0000000..259dc4b --- /dev/null +++ b/src/main/webapp/WEB-INF/views/theme-init.jsp @@ -0,0 +1,13 @@ +<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %> + diff --git a/src/main/webapp/images/logo.png b/src/main/webapp/images/logo.png new file mode 100644 index 0000000..348470c Binary files /dev/null and b/src/main/webapp/images/logo.png differ diff --git a/src/test/java/com/pandoli365/bibimbap/BibimbapApplicationTests.java b/src/test/java/com/pandoli365/bibimbap/BibimbapApplicationTests.java new file mode 100644 index 0000000..d6e198d --- /dev/null +++ b/src/test/java/com/pandoli365/bibimbap/BibimbapApplicationTests.java @@ -0,0 +1,13 @@ +package com.pandoli365.bibimbap; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class BibimbapApplicationTests { + + @Test + void contextLoads() { + } + +}