-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 알림 및 url 변경처리 부분을 담당하는 TextHtmlUtil을 만들어 쉽게 설정할 수 있도록 구현 - java warning 해결 - 가독성이 떨어지는 코드 재배치 및 명확한 변수명으로 변경
- Loading branch information
Showing
38 changed files
with
587 additions
and
638 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 0 additions & 9 deletions
9
board-servlet-jsp/board/WebContent/common/alertAndHrefForm.jsp
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package com.common; | ||
|
||
import java.io.IOException; | ||
import java.io.PrintWriter; | ||
|
||
import javax.servlet.http.HttpServletResponse; | ||
|
||
import com.common.enums.Location; | ||
|
||
public class TextHtmlUtil { | ||
|
||
private TextHtmlUtil() {} | ||
|
||
public static void initReturnTextHtml(final HttpServletResponse response) { | ||
response.setCharacterEncoding("utf-8"); | ||
response.setContentType("text/html"); | ||
} | ||
|
||
public static void setAlertMessage(final PrintWriter printWriter, final String message) { | ||
|
||
final StringBuilder printScriptBuilder = new StringBuilder(); | ||
printScriptBuilder.append("<script>alert(\'") | ||
.append(message) | ||
.append("\')</script>"); | ||
|
||
printWriter.println(printScriptBuilder.toString()); | ||
} | ||
|
||
public static void setLocationHref(final PrintWriter printWriter, final String location) { | ||
|
||
final StringBuilder printScriptBuilder = new StringBuilder(); | ||
printScriptBuilder.append("<script>location.href=\'") | ||
.append(location) | ||
.append("\'</script>"); | ||
|
||
printWriter.println(printScriptBuilder.toString()); | ||
} | ||
|
||
public static void setMessageAndLocation(final PrintWriter printWriter, | ||
final String message, | ||
final String location) { | ||
setAlertMessage(printWriter, message); | ||
setLocationHref(printWriter, location); | ||
} | ||
|
||
public static void setNeedLoginLocation(final PrintWriter printWriter) { | ||
setAlertMessage(printWriter, "로그인이 필요합니다."); | ||
setLocationHref(printWriter, Location.UI_LOGIN_USER.toString()); | ||
} | ||
|
||
public static void autoProcessNeedLoginLocation(final HttpServletResponse response) throws IOException { | ||
initReturnTextHtml(response); | ||
|
||
final PrintWriter printWriter = response.getWriter(); | ||
setNeedLoginLocation(printWriter); | ||
|
||
printWriter.close(); | ||
} | ||
|
||
public static void autoProcessMessageAndLocation(final HttpServletResponse response, | ||
final String message, | ||
final String location) throws IOException { | ||
initReturnTextHtml(response); | ||
|
||
final PrintWriter printWriter = response.getWriter(); | ||
setMessageAndLocation(printWriter, message, location); | ||
|
||
printWriter.close(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
board-servlet-jsp/board/src/com/common/enums/Location.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.common.enums; | ||
|
||
public enum Location { | ||
BOARD_JSP("board.jsp"), | ||
UI_BOARD("/boardUI"), | ||
UI_BOARD_REDIRECT("/board/boardUI"), | ||
|
||
SEARCH_POST("/postSearchServlet"), | ||
|
||
POST_DETAIL_JSP("postDetail.jsp"), | ||
UI_POST_DETAIL("/board/postDetailUI"), | ||
|
||
POST_CREATION_JSP("postCreation.jsp"), | ||
UI_POST_CREATION("/board/postCreationUI"), | ||
|
||
POST_EDITOR_JSP("postEditor.jsp"), | ||
|
||
LOGIN_USER_JSP("loginUser.jsp"), | ||
UI_LOGIN_USER("/board/loginUserUI"), | ||
|
||
MY_PROFILE("myProfile.jsp"), | ||
UI_MY_PROFILE("/board/myProfileUI"), | ||
|
||
MEMBER_REGISTRATION_JSP("memberRegistration.jsp"), | ||
REGISTER_UI("/board/memberRegistrationUI"), | ||
SUCCESS_REGISTER_MEMBER_JSP("registerSuccess.jsp"); | ||
|
||
private final String location; | ||
|
||
Location(final String location) { | ||
this.location = location; | ||
} | ||
|
||
public String toString() { | ||
return location; | ||
} | ||
} |
39 changes: 0 additions & 39 deletions
39
board-servlet-jsp/board/src/com/common/enums/SitePath.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.