-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
75a2af5
commit 2eb57fc
Showing
39 changed files
with
1,852 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" output="target/classes" path="src/main/java"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="output" path="target/classes"/> | ||
</classpath> |
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,41 @@ | ||
# Windows image file caches | ||
Thumbs.db | ||
ehthumbs.db | ||
|
||
# Folder config file | ||
Desktop.ini | ||
target | ||
report | ||
build | ||
.settings | ||
log | ||
|
||
# Recycle Bin used on file shares | ||
$RECYCLE.BIN/ | ||
|
||
# Windows Installer files | ||
*.cab | ||
*.msi | ||
*.msm | ||
*.msp | ||
|
||
# ========================= | ||
# Operating System Files | ||
# ========================= | ||
|
||
# OSX | ||
# ========================= | ||
|
||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must ends with two \r. | ||
Icon | ||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear on external disk | ||
.Spotlight-V100 | ||
.Trashes |
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,35 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>simple-demo-rest</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>javafx.eclipse.f3editor.builder.F3Builder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.springframework.ide.eclipse.core.springbuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.m2e.core.maven2Builder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.springframework.ide.eclipse.core.springnature</nature> | ||
<nature>org.eclipse.m2e.core.maven2Nature</nature> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
<nature>javafx.eclipse.f3editor.builder.F3Nature</nature> | ||
</natures> | ||
</projectDescription> |
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,14 @@ | ||
@echo off | ||
echo Starting application. Please wait... | ||
|
||
cd .. | ||
|
||
echo %CLASSPATH% | ||
|
||
set CLASSPATH=etc/.;lib/*;~1%;. | ||
|
||
echo %CLASSPATH% | ||
|
||
rem java "%JAVA_OPTS%" -classpath %CLASSPATH% org.simpleframework.demo.ApplicationLauncher etc/spring.xml etc/common.properties etc/local.properties | ||
java "%JAVA_OPTS%" -classpath %CLASSPATH% org.simpleframework.demo.ApplicationLauncher etc/spring.xml etc/common.properties etc/local.properties | ||
|
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,12 @@ | ||
<html> | ||
<head> | ||
<title>Login Page</title> | ||
</head> | ||
<body> | ||
<h1>Please Login</h1> | ||
<form action='/login.html' method='POST'> | ||
<input type='text' name='user'/> | ||
<input type='submit' value='Sign In'/> | ||
</form> | ||
</body> | ||
</html> |
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,35 @@ | ||
<html> | ||
<head> | ||
<title>Chat Room</title> | ||
<script> | ||
function init() { | ||
websocket = new WebSocket("ws://localhost:6060/talk"); | ||
|
||
websocket.onopen = function() { | ||
document.getElementById("output").innerHTML += "<p>Welcome!</p>"; | ||
}; | ||
|
||
websocket.onmessage = function(evt) { | ||
document.getElementById("output").innerHTML += "<p style='color: blue;'>" + evt.data + "</p>"; | ||
}; | ||
|
||
websocket.onerror = function(evt) { | ||
document.getElementById("output").innerHTML += "<p style='color: red;'>" + evt.data + "</p>"; }; | ||
} | ||
|
||
function sendMessage(message) { | ||
document.getElementById("output").innerHTML += "<p>" + message + "</p>"; | ||
websocket.send(message); | ||
} | ||
window.addEventListener("load", init, false); | ||
</script> | ||
</head> | ||
<body> | ||
<h2>Chat Room</h2> | ||
<small>Refresh browser to clear page and resubscribe</small> | ||
<br/> | ||
<br/> | ||
<input onkeypress="if(this.value) {if (window.event.keyCode == 13) { sendMessage(this.value); this.value = null; }}"/> | ||
<div id="output"></div> | ||
</body> | ||
</html> |
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,3 @@ | ||
log4j.configFile=etc/log4j.xml | ||
|
||
server.listenPort=6060 |
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 @@ | ||
context.path=chat |
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,43 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> | ||
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> | ||
<appender class="org.apache.log4j.ConsoleAppender" name="STDOUT"> | ||
<layout class="org.apache.log4j.PatternLayout"> | ||
<param value="%d [%t] %-5p %c{2} - %m%n" name="ConversionPattern" /> | ||
</layout> | ||
</appender> | ||
<appender class="org.apache.log4j.RollingFileAppender" name="R"> | ||
<param value="log/app.log" name="File" /> | ||
<param value="10" name="MaxBackupIndex" /> | ||
<param value="1000KB" name="MaxFileSize" /> | ||
<layout class="org.apache.log4j.PatternLayout"> | ||
<param value="%d [%t] %-5p %c{2} - %m%n" name="ConversionPattern" /> | ||
</layout> | ||
</appender> | ||
<appender class="org.apache.log4j.DailyRollingFileAppender" name="DAILY"> | ||
<param value="'.'yyyy-MM-dd" name="DatePattern" /> | ||
<param value="log/app.log" name="File" /> | ||
<layout class="org.apache.log4j.PatternLayout"> | ||
<param value="%d [%t] %-5p %c{2} - %m%n" name="ConversionPattern" /> | ||
</layout> | ||
</appender> | ||
<appender class="org.apache.log4j.rolling.RollingFileAppender" name="COMPRESS"> | ||
<rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy"> | ||
<param name="ActiveFileName" value="log/app.log" /> | ||
<param name="FileNamePattern" value="log/app.log.%d{yyyy-MM-dd}.gz" /> | ||
</rollingPolicy> | ||
<layout class="org.apache.log4j.PatternLayout"> | ||
<param value="%d [%t] %-5p %c{2} - %m%n" name="ConversionPattern" /> | ||
</layout> | ||
</appender> | ||
<logger name="General"> | ||
<level value="info" /> | ||
</logger> | ||
<logger name="org.simpleframework"> | ||
<level value="info" /> | ||
</logger> | ||
<root> | ||
<level value="info" /> | ||
<appender-ref ref="COMPRESS" /> | ||
</root> | ||
</log4j:configuration> |
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,113 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" | ||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> | ||
|
||
<bean id="LogConfigurer" class="org.simpleframework.demo.log4j.LogConfigurer" init-method="configure"> | ||
<constructor-arg value="${log4j.configFile}" /> | ||
</bean> | ||
|
||
<bean id="ContentTypeResolver" class="org.simpleframework.demo.http.resource.ContentTypeResolver"> | ||
<constructor-arg> | ||
<map> | ||
<entry key=".*.vm" value="text/html" /> | ||
<entry key=".*.html" value="text/html" /> | ||
<entry key=".*.png" value="image/png" /> | ||
<entry key=".*.gif" value="image/gif" /> | ||
<entry key=".*.css" value="text/css" /> | ||
<entry key=".*.js" value="text/javascript" /> | ||
<entry key=".*" value="text/html" /> | ||
</map> | ||
</constructor-arg> | ||
</bean> | ||
|
||
<bean id="FileManager" class="org.simpleframework.demo.io.FileManager"> | ||
<constructor-arg value="data/${context.path}" /> | ||
</bean> | ||
|
||
<bean id="FileResolver" class="org.simpleframework.demo.io.FileResolver"> | ||
<constructor-arg ref="FileManager" /> | ||
<constructor-arg value="index.html" /> | ||
<constructor-arg value="index.html" /> | ||
</bean> | ||
|
||
<bean id="FileSystemResource" class="org.simpleframework.demo.http.resource.FileSystemResource"> | ||
<constructor-arg ref="FileResolver" /> | ||
<constructor-arg ref="ContentTypeResolver" /> | ||
</bean> | ||
|
||
<bean id="NotFoundResource" class="org.simpleframework.demo.http.resource.StringResource"> | ||
<constructor-arg value="Resource could not be found!!" /> | ||
<constructor-arg value="text/plain; charset=UTF-8" /> | ||
<constructor-arg value="UTF-8" /> | ||
<constructor-arg value="NOT_FOUND" /> | ||
</bean> | ||
|
||
<bean id="FoundResource" class="org.simpleframework.demo.http.resource.StringResource"> | ||
<constructor-arg value="Redirecting to /index.html" /> | ||
<constructor-arg value="text/plain; charset=UTF-8" /> | ||
<constructor-arg value="UTF-8" /> | ||
<constructor-arg value="FOUND" /> | ||
</bean> | ||
|
||
<bean id="RedirectResource" class="org.simpleframework.demo.http.resource.RedirectResource"> | ||
<constructor-arg ref="FoundResource" /> | ||
<constructor-arg value="/index.html" /> | ||
</bean> | ||
|
||
<bean id="FailureResource" class="org.simpleframework.demo.http.resource.StringResource"> | ||
<constructor-arg value="An error occured serving a resource!" /> | ||
<constructor-arg value="text/plain; charset=UTF-8" /> | ||
<constructor-arg value="UTF-8" /> | ||
<constructor-arg value="INTERNAL_SERVER_ERROR" /> | ||
</bean> | ||
|
||
<bean id="ChatRoom" class="org.simpleframework.demo.chat.ChatRoom"/> | ||
|
||
<bean id="ChatRoomLogin" class="org.simpleframework.demo.chat.ChatRoomLogin"> | ||
<constructor-arg ref="FileSystemResource" /> | ||
</bean> | ||
|
||
<bean id="ResourceEngine" class="org.simpleframework.demo.http.resource.RegularExpressionEngine"> | ||
<constructor-arg> | ||
<map> | ||
<entry key="/login.html" value-ref="ChatRoomLogin" /> | ||
<entry key=".*favicon.ico" value-ref="NotFoundResource" /> | ||
<entry key=".*.html" value-ref="FileSystemResource" /> | ||
<entry key=".*.png" value-ref="FileSystemResource" /> | ||
<entry key=".*.css" value-ref="FileSystemResource" /> | ||
<entry key=".*.js" value-ref="FileSystemResource" /> | ||
<entry key="/" value-ref="RedirectResource" /> | ||
</map> | ||
</constructor-arg> | ||
<constructor-arg ref="NotFoundResource" /> | ||
</bean> | ||
|
||
<bean id="ResourceContainer" class="org.simpleframework.demo.http.resource.ResourceContainer"> | ||
<constructor-arg ref="ResourceEngine" /> | ||
<constructor-arg ref="FailureResource" /> | ||
</bean> | ||
|
||
<bean id="TraceAnalyzer" class="org.simpleframework.demo.trace.LogAnalyzer" init-method="start"/> | ||
|
||
<bean id="WebContainer" class="org.simpleframework.demo.http.WebContainer"> | ||
<constructor-arg ref="ResourceContainer" /> | ||
<constructor-arg value="Chat/1.0" /> | ||
</bean> | ||
|
||
<bean id="WebSocketRouter" class="org.simpleframework.http.socket.service.DirectRouter"> | ||
<constructor-arg ref="ChatRoom" /> | ||
</bean> | ||
|
||
<bean id="WebSocketContainer" class="org.simpleframework.http.socket.service.RouterContainer"> | ||
<constructor-arg ref="WebContainer" /> | ||
<constructor-arg ref="WebSocketRouter" /> | ||
<constructor-arg value="2" /> | ||
</bean> | ||
|
||
<bean id="WebServer" class="org.simpleframework.demo.http.WebServer" init-method="start"> | ||
<constructor-arg ref="WebSocketContainer" /> | ||
<constructor-arg ref="TraceAnalyzer"/> | ||
<constructor-arg value="${server.listenPort}" /> | ||
</bean> | ||
|
||
</beans> |
Oops, something went wrong.