Removed files not in gitignore
This commit is contained in:
parent
aa5873963d
commit
73ef29e2df
14
.buildpath
14
.buildpath
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<buildpath>
|
<buildpath>
|
||||||
<buildpathentry kind="con" path="org.eclipse.vjet.eclipse.core.BROWSER_CONTAINER/Browser SDK"/>
|
<buildpathentry kind="con" path="org.eclipse.vjet.eclipse.core.BROWSER_CONTAINER/Browser SDK"/>
|
||||||
<buildpathentry kind="con" path="org.eclipse.vjet.eclipse.core.JSNATIVE_CONTAINER/JS Native Types"/>
|
<buildpathentry kind="con" path="org.eclipse.vjet.eclipse.core.JSNATIVE_CONTAINER/JS Native Types"/>
|
||||||
<buildpathentry kind="con" path="org.eclipse.dltk.mod.launching.INTERPRETER_CONTAINER"/>
|
<buildpathentry kind="con" path="org.eclipse.dltk.mod.launching.INTERPRETER_CONTAINER"/>
|
||||||
<buildpathentry kind="src" path="src"/>
|
<buildpathentry kind="src" path="src"/>
|
||||||
</buildpath>
|
</buildpath>
|
||||||
|
|
42
.classpath
42
.classpath
|
@ -1,21 +1,21 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" output="target/classes" path="src">
|
<classpathentry kind="src" output="target/classes" path="src">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="src" path="main/resources"/>
|
<classpathentry kind="src" path="main/resources"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
58
.project
58
.project
|
@ -1,29 +1,29 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<projectDescription>
|
<projectDescription>
|
||||||
<name>ChatServer</name>
|
<name>ChatServer</name>
|
||||||
<comment></comment>
|
<comment></comment>
|
||||||
<projects>
|
<projects>
|
||||||
</projects>
|
</projects>
|
||||||
<buildSpec>
|
<buildSpec>
|
||||||
<buildCommand>
|
<buildCommand>
|
||||||
<name>org.eclipse.vjet.eclipse.core.builder</name>
|
<name>org.eclipse.vjet.eclipse.core.builder</name>
|
||||||
<arguments>
|
<arguments>
|
||||||
</arguments>
|
</arguments>
|
||||||
</buildCommand>
|
</buildCommand>
|
||||||
<buildCommand>
|
<buildCommand>
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
<arguments>
|
<arguments>
|
||||||
</arguments>
|
</arguments>
|
||||||
</buildCommand>
|
</buildCommand>
|
||||||
<buildCommand>
|
<buildCommand>
|
||||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||||
<arguments>
|
<arguments>
|
||||||
</arguments>
|
</arguments>
|
||||||
</buildCommand>
|
</buildCommand>
|
||||||
</buildSpec>
|
</buildSpec>
|
||||||
<natures>
|
<natures>
|
||||||
<nature>org.eclipse.vjet.core.nature</nature>
|
<nature>org.eclipse.vjet.core.nature</nature>
|
||||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
</natures>
|
</natures>
|
||||||
</projectDescription>
|
</projectDescription>
|
||||||
|
|
|
@ -1,106 +1,106 @@
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
|
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
|
||||||
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
|
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
|
||||||
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
|
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
|
||||||
org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
|
org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
|
||||||
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
|
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
|
||||||
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
|
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
|
||||||
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
|
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
|
||||||
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
|
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
|
||||||
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
|
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||||
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
|
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.deadCode=warning
|
org.eclipse.jdt.core.compiler.problem.deadCode=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.deprecation=warning
|
org.eclipse.jdt.core.compiler.problem.deprecation=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
|
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
|
||||||
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
|
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
|
||||||
org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore
|
org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
|
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
|
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
|
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
|
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
|
||||||
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
|
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
|
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
|
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=ignore
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
|
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
|
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
|
||||||
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
|
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
|
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
|
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
|
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
|
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
|
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
|
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
|
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
|
||||||
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
|
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
|
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
|
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
|
||||||
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
|
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
|
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
|
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
|
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
|
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
|
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
|
org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
|
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
|
||||||
org.eclipse.jdt.core.compiler.problem.nullReference=warning
|
org.eclipse.jdt.core.compiler.problem.nullReference=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
|
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
|
||||||
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
|
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
|
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
|
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
|
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
|
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
|
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
|
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
|
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
|
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
|
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
|
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
|
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
|
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
|
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
|
||||||
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
|
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
|
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
|
||||||
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
|
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
|
||||||
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
|
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
|
||||||
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
|
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
|
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
|
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
|
||||||
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
|
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
|
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
|
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
|
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
|
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
|
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
|
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
|
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
|
org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
|
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
|
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
|
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
|
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
|
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
|
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
|
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
|
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
|
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||||
org.eclipse.jdt.core.compiler.source=1.8
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
initialized_project_from_v4classpath=true
|
initialized_project_from_v4classpath=true
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
log4j.rootLogger=debug, stdout, R
|
log4j.rootLogger=debug, stdout, R
|
||||||
|
|
||||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||||
|
|
||||||
# Pattern to output the caller's file name and line number.
|
# Pattern to output the caller's file name and line number.
|
||||||
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
|
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
|
||||||
|
|
||||||
log4j.appender.R=org.apache.log4j.RollingFileAppender
|
log4j.appender.R=org.apache.log4j.RollingFileAppender
|
||||||
log4j.appender.R.File=example.log
|
log4j.appender.R.File=example.log
|
||||||
|
|
||||||
log4j.appender.R.MaxFileSize=100KB
|
log4j.appender.R.MaxFileSize=100KB
|
||||||
# Keep one backup file
|
# Keep one backup file
|
||||||
log4j.appender.R.MaxBackupIndex=1
|
log4j.appender.R.MaxBackupIndex=1
|
||||||
|
|
||||||
log4j.appender.R.layout=org.apache.log4j.PatternLayout
|
log4j.appender.R.layout=org.apache.log4j.PatternLayout
|
||||||
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
|
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
|
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
|
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
|
||||||
version="2.0">
|
version="2.0">
|
||||||
<persistence-unit name="ChatServerPU">
|
<persistence-unit name="ChatServerPU">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" />
|
<property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" />
|
||||||
<property name="javax.persistence.jdbc.url" value="jdbc:derby:memory:chatserver;create=true" /><property
|
<property name="javax.persistence.jdbc.url" value="jdbc:derby:memory:chatserver;create=true" /><property
|
||||||
name="hibernate.hbm2ddl.auto" value="update"/>
|
name="hibernate.hbm2ddl.auto" value="update"/>
|
||||||
</properties>
|
</properties>
|
||||||
</persistence-unit>
|
</persistence-unit>
|
||||||
</persistence>
|
</persistence>
|
|
@ -1,10 +0,0 @@
|
||||||
<component name="InspectionProjectProfileManager">
|
|
||||||
<profile version="1.0">
|
|
||||||
<option name="myName" value="Project Default" />
|
|
||||||
<inspection_tool class="SpellCheckingInspection" enabled="true" level="TYPO" enabled_by_default="true">
|
|
||||||
<option name="processCode" value="false" />
|
|
||||||
<option name="processLiterals" value="false" />
|
|
||||||
<option name="processComments" value="true" />
|
|
||||||
</inspection_tool>
|
|
||||||
</profile>
|
|
||||||
</component>
|
|
|
@ -1,7 +0,0 @@
|
||||||
<component name="InspectionProjectProfileManager">
|
|
||||||
<settings>
|
|
||||||
<option name="PROJECT_PROFILE" value="Project Default" />
|
|
||||||
<option name="USE_PROJECT_PROFILE" value="true" />
|
|
||||||
<version value="1.0" />
|
|
||||||
</settings>
|
|
||||||
</component>
|
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/pages.iml" filepath="$PROJECT_DIR$/.idea/pages.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="WEB_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager">
|
|
||||||
<content url="file://$MODULE_DIR$" />
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -1,566 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ChangeListManager">
|
|
||||||
<list default="true" id="588ba1ca-220a-4913-8e8c-5657fa1c845f" name="Default" comment="">
|
|
||||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
|
|
||||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/css/style.css" afterPath="$PROJECT_DIR$/css/style.css" />
|
|
||||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/index.html" afterPath="$PROJECT_DIR$/index.html" />
|
|
||||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/login.js" afterPath="$PROJECT_DIR$/js/login.js" />
|
|
||||||
</list>
|
|
||||||
<ignored path="pages.iws" />
|
|
||||||
<ignored path=".idea/workspace.xml" />
|
|
||||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
|
||||||
<option name="TRACKING_ENABLED" value="true" />
|
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
||||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
||||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
||||||
</component>
|
|
||||||
<component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
|
|
||||||
<component name="CreatePatchCommitExecutor">
|
|
||||||
<option name="PATCH_PATH" value="" />
|
|
||||||
</component>
|
|
||||||
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
|
|
||||||
<component name="FavoritesManager">
|
|
||||||
<favorites_list name="pages" />
|
|
||||||
</component>
|
|
||||||
<component name="FileEditorManager">
|
|
||||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
|
||||||
<file leaf-file-name="index.html" pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/index.html">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="1043">
|
|
||||||
<caret line="82" column="30" selection-start-line="82" selection-start-column="30" selection-end-line="82" selection-end-column="30" />
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file leaf-file-name="jquery-3.1.0.js" pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/js/jquery-3.1.0.js">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="0">
|
|
||||||
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file leaf-file-name="login.js" pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/js/login.js">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="153">
|
|
||||||
<caret line="11" column="13" selection-start-line="11" selection-start-column="13" selection-end-line="11" selection-end-column="13" />
|
|
||||||
<folding>
|
|
||||||
<element signature="n#!!doc;n#login#0" expanded="false" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file leaf-file-name="utils.js" pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/js/utils.js">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="187">
|
|
||||||
<caret line="13" column="0" selection-start-line="13" selection-start-column="0" selection-end-line="13" selection-end-column="0" />
|
|
||||||
<folding>
|
|
||||||
<element signature="n#!!doc;n#getFormData#0" expanded="false" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file leaf-file-name="style.css" pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/css/style.css">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="91">
|
|
||||||
<caret line="19" column="24" selection-start-line="19" selection-start-column="24" selection-end-line="19" selection-end-column="24" />
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file leaf-file-name="register.js" pinned="false" current-in-tab="true">
|
|
||||||
<entry file="file://$PROJECT_DIR$/js/register.js">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="255">
|
|
||||||
<caret line="17" column="0" selection-start-line="17" selection-start-column="0" selection-end-line="17" selection-end-column="0" />
|
|
||||||
<folding>
|
|
||||||
<element signature="n#!!doc;n#register#0" expanded="false" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file leaf-file-name="notfound.html" pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/notfound.html">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="0">
|
|
||||||
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file leaf-file-name="message.js" pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/js/message.js">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="68">
|
|
||||||
<caret line="4" column="0" selection-start-line="4" selection-start-column="0" selection-end-line="4" selection-end-column="0" />
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
</leaf>
|
|
||||||
</component>
|
|
||||||
<component name="FileTemplateManagerImpl">
|
|
||||||
<option name="RECENT_TEMPLATES">
|
|
||||||
<list>
|
|
||||||
<option value="JavaScript File" />
|
|
||||||
</list>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
<component name="Git.Settings">
|
|
||||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
|
|
||||||
</component>
|
|
||||||
<component name="IdeDocumentHistory">
|
|
||||||
<option name="CHANGED_PATHS">
|
|
||||||
<list>
|
|
||||||
<option value="$PROJECT_DIR$/userbox.js" />
|
|
||||||
<option value="$PROJECT_DIR$/userbox.html" />
|
|
||||||
<option value="$PROJECT_DIR$/js/userbox.js" />
|
|
||||||
<option value="$PROJECT_DIR$/js/message.js" />
|
|
||||||
<option value="$PROJECT_DIR$/register.html" />
|
|
||||||
<option value="$PROJECT_DIR$/js/utils.js" />
|
|
||||||
<option value="$PROJECT_DIR$/js/register.js" />
|
|
||||||
<option value="$PROJECT_DIR$/js/login.js" />
|
|
||||||
<option value="$PROJECT_DIR$/css/style.css" />
|
|
||||||
<option value="$PROJECT_DIR$/index.html" />
|
|
||||||
</list>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
<component name="JsBuildToolGruntFileManager" detection-done="true" />
|
|
||||||
<component name="JsBuildToolPackageJson" detection-done="true" />
|
|
||||||
<component name="JsGulpfileManager">
|
|
||||||
<detection-done>true</detection-done>
|
|
||||||
</component>
|
|
||||||
<component name="ProjectFrameBounds">
|
|
||||||
<option name="x" value="-8" />
|
|
||||||
<option name="y" value="-8" />
|
|
||||||
<option name="width" value="1936" />
|
|
||||||
<option name="height" value="1056" />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectInspectionProfilesVisibleTreeState">
|
|
||||||
<entry key="Project Default">
|
|
||||||
<profile-state>
|
|
||||||
<expanded-state>
|
|
||||||
<State>
|
|
||||||
<id />
|
|
||||||
</State>
|
|
||||||
<State>
|
|
||||||
<id>Spelling</id>
|
|
||||||
</State>
|
|
||||||
</expanded-state>
|
|
||||||
<selected-state>
|
|
||||||
<State>
|
|
||||||
<id>SpellCheckingInspection</id>
|
|
||||||
</State>
|
|
||||||
</selected-state>
|
|
||||||
</profile-state>
|
|
||||||
</entry>
|
|
||||||
</component>
|
|
||||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true">
|
|
||||||
<OptionsSetting value="true" id="Add" />
|
|
||||||
<OptionsSetting value="true" id="Remove" />
|
|
||||||
<OptionsSetting value="true" id="Checkout" />
|
|
||||||
<OptionsSetting value="true" id="Update" />
|
|
||||||
<OptionsSetting value="true" id="Status" />
|
|
||||||
<OptionsSetting value="true" id="Edit" />
|
|
||||||
<ConfirmationsSetting value="0" id="Add" />
|
|
||||||
<ConfirmationsSetting value="0" id="Remove" />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectView">
|
|
||||||
<navigator currentView="ProjectPane" proportions="" version="1">
|
|
||||||
<flattenPackages />
|
|
||||||
<showMembers />
|
|
||||||
<showModules />
|
|
||||||
<showLibraryContents />
|
|
||||||
<hideEmptyPackages />
|
|
||||||
<abbreviatePackageNames />
|
|
||||||
<autoscrollToSource />
|
|
||||||
<autoscrollFromSource />
|
|
||||||
<sortByType />
|
|
||||||
<manualOrder />
|
|
||||||
<foldersAlwaysOnTop value="true" />
|
|
||||||
</navigator>
|
|
||||||
<panes>
|
|
||||||
<pane id="Scope" />
|
|
||||||
<pane id="ProjectPane">
|
|
||||||
<subPane>
|
|
||||||
<PATH>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="pages" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
</PATH>
|
|
||||||
<PATH>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="pages" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="pages" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
</PATH>
|
|
||||||
<PATH>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="pages" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="pages" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="js" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
</PATH>
|
|
||||||
<PATH>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="pages" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="pages" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="css" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
</PATH>
|
|
||||||
</subPane>
|
|
||||||
</pane>
|
|
||||||
<pane id="Scratches" />
|
|
||||||
</panes>
|
|
||||||
</component>
|
|
||||||
<component name="PropertiesComponent">
|
|
||||||
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
|
||||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
|
||||||
<property name="HbShouldOpenHtmlAsHb" value="" />
|
|
||||||
<property name="settings.editor.selected.configurable" value="preferences.toDoOptions" />
|
|
||||||
<property name="settings.editor.splitter.proportion" value="0.2" />
|
|
||||||
<property name="FileHistory.git4idea.history.GitHistoryProvider_flatWidth0" value="72" />
|
|
||||||
<property name="FileHistory.git4idea.history.GitHistoryProvider_flatOrder0" value="0" />
|
|
||||||
<property name="FileHistory.git4idea.history.GitHistoryProvider_flatWidth1" value="72" />
|
|
||||||
<property name="FileHistory.git4idea.history.GitHistoryProvider_flatOrder1" value="1" />
|
|
||||||
<property name="FileHistory.git4idea.history.GitHistoryProvider_flatWidth2" value="72" />
|
|
||||||
<property name="FileHistory.git4idea.history.GitHistoryProvider_flatOrder2" value="2" />
|
|
||||||
<property name="FileHistory.git4idea.history.GitHistoryProvider_flatWidth3" value="709" />
|
|
||||||
<property name="FileHistory.git4idea.history.GitHistoryProvider_flatOrder3" value="3" />
|
|
||||||
<property name="FileHistory.git4idea.history.GitHistoryProvider_treeWidth0" value="73" />
|
|
||||||
<property name="FileHistory.git4idea.history.GitHistoryProvider_treeOrder0" value="0" />
|
|
||||||
<property name="FileHistory.git4idea.history.GitHistoryProvider_treeWidth1" value="62" />
|
|
||||||
<property name="FileHistory.git4idea.history.GitHistoryProvider_treeOrder1" value="1" />
|
|
||||||
<property name="FileHistory.git4idea.history.GitHistoryProvider_treeWidth2" value="68" />
|
|
||||||
<property name="FileHistory.git4idea.history.GitHistoryProvider_treeOrder2" value="2" />
|
|
||||||
<property name="FileHistory.git4idea.history.GitHistoryProvider_treeWidth3" value="722" />
|
|
||||||
<property name="FileHistory.git4idea.history.GitHistoryProvider_treeOrder3" value="3" />
|
|
||||||
</component>
|
|
||||||
<component name="RecentsManager">
|
|
||||||
<key name="MoveFile.RECENT_KEYS">
|
|
||||||
<recent name="C:\Users\Norbert_Szatmari\workspace\chatserver\pages\js" />
|
|
||||||
</key>
|
|
||||||
</component>
|
|
||||||
<component name="RunManager" selected="JavaScript Debug.index.html">
|
|
||||||
<configuration default="false" name="message.js" type="NodeJSConfigurationType" factoryName="Node.js" temporary="true" path-to-node="project" path-to-js-file="message.js" working-dir="$PROJECT_DIR$/js">
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
<configuration default="false" name="index.html" type="JavascriptDebugType" factoryName="JavaScript Debug" temporary="true" nameIsGenerated="true" uri="http://localhost:63342/pages/index.html">
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
<configuration default="true" type="DartCommandLineRunConfigurationType" factoryName="Dart Command Line Application">
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
<configuration default="true" type="DartTestRunConfigurationType" factoryName="Dart Test">
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
<configuration default="true" type="JavaScriptTestRunnerKarma" factoryName="Karma">
|
|
||||||
<config-file value="" />
|
|
||||||
<node-interpreter value="project" />
|
|
||||||
<envs />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
<configuration default="true" type="JavascriptDebugType" factoryName="JavaScript Debug">
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
<configuration default="true" type="NodeJSConfigurationType" factoryName="Node.js" path-to-node="project" working-dir="">
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
<configuration default="true" type="cucumber.js" factoryName="Cucumber.js">
|
|
||||||
<option name="cucumberJsArguments" value="" />
|
|
||||||
<option name="executablePath" />
|
|
||||||
<option name="filePath" />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
<configuration default="true" type="js.build_tools.gulp" factoryName="Gulp.js">
|
|
||||||
<node-interpreter>project</node-interpreter>
|
|
||||||
<node-options />
|
|
||||||
<gulpfile />
|
|
||||||
<tasks />
|
|
||||||
<arguments />
|
|
||||||
<envs />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
<configuration default="true" type="js.build_tools.npm" factoryName="npm">
|
|
||||||
<command value="run-script" />
|
|
||||||
<scripts />
|
|
||||||
<node-interpreter value="project" />
|
|
||||||
<envs />
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
<configuration default="true" type="mocha-javascript-test-runner" factoryName="Mocha">
|
|
||||||
<node-interpreter>project</node-interpreter>
|
|
||||||
<node-options />
|
|
||||||
<working-directory />
|
|
||||||
<pass-parent-env>true</pass-parent-env>
|
|
||||||
<envs />
|
|
||||||
<ui>bdd</ui>
|
|
||||||
<extra-mocha-options />
|
|
||||||
<test-kind>DIRECTORY</test-kind>
|
|
||||||
<test-directory />
|
|
||||||
<recursive>false</recursive>
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
<list size="2">
|
|
||||||
<item index="0" class="java.lang.String" itemvalue="Node.js.message.js" />
|
|
||||||
<item index="1" class="java.lang.String" itemvalue="JavaScript Debug.index.html" />
|
|
||||||
</list>
|
|
||||||
<recent_temporary>
|
|
||||||
<list size="2">
|
|
||||||
<item index="0" class="java.lang.String" itemvalue="JavaScript Debug.index.html" />
|
|
||||||
<item index="1" class="java.lang.String" itemvalue="Node.js.message.js" />
|
|
||||||
</list>
|
|
||||||
</recent_temporary>
|
|
||||||
</component>
|
|
||||||
<component name="ShelveChangesManager" show_recycled="false">
|
|
||||||
<option name="remove_strategy" value="false" />
|
|
||||||
</component>
|
|
||||||
<component name="SpellCheckerSettings" BundledDictionaries="1" BundledDictionary0="english.dic" Folders="0" Dictionaries="0" />
|
|
||||||
<component name="SvnConfiguration">
|
|
||||||
<configuration />
|
|
||||||
</component>
|
|
||||||
<component name="TaskManager">
|
|
||||||
<task active="true" id="Default" summary="Default task">
|
|
||||||
<changelist id="588ba1ca-220a-4913-8e8c-5657fa1c845f" name="Default" comment="" />
|
|
||||||
<created>1469522327377</created>
|
|
||||||
<option name="number" value="Default" />
|
|
||||||
<option name="presentableId" value="Default" />
|
|
||||||
<updated>1469522327377</updated>
|
|
||||||
<workItem from="1469522328775" duration="6392000" />
|
|
||||||
<workItem from="1469535953166" duration="2597000" />
|
|
||||||
<workItem from="1469602650261" duration="15397000" />
|
|
||||||
</task>
|
|
||||||
<servers />
|
|
||||||
</component>
|
|
||||||
<component name="TimeTrackingManager">
|
|
||||||
<option name="totallyTimeSpent" value="24386000" />
|
|
||||||
</component>
|
|
||||||
<component name="ToolWindowManager">
|
|
||||||
<frame x="-8" y="-8" width="1936" height="1056" extended-state="6" />
|
|
||||||
<editor active="true" />
|
|
||||||
<layout>
|
|
||||||
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.18020834" sideWeight="0.5" order="1" side_tool="false" content_ui="combo" />
|
|
||||||
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
|
|
||||||
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32911393" sideWeight="0.50416666" order="0" side_tool="true" content_ui="tabs" />
|
|
||||||
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32911393" sideWeight="0.49583334" order="4" side_tool="false" content_ui="tabs" />
|
|
||||||
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32911393" sideWeight="0.49583334" order="1" side_tool="false" content_ui="tabs" />
|
|
||||||
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
|
|
||||||
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
|
||||||
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
|
||||||
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="true" content_ui="tabs" />
|
|
||||||
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
|
||||||
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
|
||||||
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
|
||||||
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
|
||||||
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
|
|
||||||
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
|
|
||||||
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
|
||||||
</layout>
|
|
||||||
</component>
|
|
||||||
<component name="Vcs.Log.UiProperties">
|
|
||||||
<option name="RECENTLY_FILTERED_USER_GROUPS">
|
|
||||||
<collection />
|
|
||||||
</option>
|
|
||||||
<option name="RECENTLY_FILTERED_BRANCH_GROUPS">
|
|
||||||
<collection />
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
<component name="VcsContentAnnotationSettings">
|
|
||||||
<option name="myLimit" value="2678400000" />
|
|
||||||
</component>
|
|
||||||
<component name="XDebuggerManager">
|
|
||||||
<breakpoint-manager />
|
|
||||||
<watches-manager />
|
|
||||||
</component>
|
|
||||||
<component name="editorHistoryManager">
|
|
||||||
<entry file="file://$PROJECT_DIR$/index.html">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="255">
|
|
||||||
<caret line="15" column="59" selection-start-line="15" selection-start-column="59" selection-end-line="15" selection-end-column="59" />
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/js/login.js">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="34">
|
|
||||||
<caret line="4" column="26" selection-start-line="4" selection-start-column="26" selection-end-line="4" selection-end-column="26" />
|
|
||||||
<folding>
|
|
||||||
<element signature="n#!!doc;n#login#0" expanded="false" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/register.html">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="272">
|
|
||||||
<caret line="16" column="55" selection-start-line="16" selection-start-column="55" selection-end-line="16" selection-end-column="55" />
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/notfound.html">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="0">
|
|
||||||
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/js/message.js">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="0">
|
|
||||||
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/index.html">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="0">
|
|
||||||
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/js/userbox.js" />
|
|
||||||
<entry file="file://$PROJECT_DIR$/register.html">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="272">
|
|
||||||
<caret line="16" column="55" selection-start-line="16" selection-start-column="55" selection-end-line="16" selection-end-column="55" />
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/notfound.html">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="0">
|
|
||||||
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/js/message.js">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="68">
|
|
||||||
<caret line="4" column="0" selection-start-line="4" selection-start-column="0" selection-end-line="4" selection-end-column="0" />
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/userbox.html" />
|
|
||||||
<entry file="file://$PROJECT_DIR$/js/userbox.js" />
|
|
||||||
<entry file="file://$PROJECT_DIR$/js/jquery-3.1.0.js">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="0">
|
|
||||||
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/js/message.js">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="68">
|
|
||||||
<caret line="4" column="0" selection-start-line="4" selection-start-column="0" selection-end-line="4" selection-end-column="0" />
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/register.html">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="68">
|
|
||||||
<caret line="4" column="27" selection-start-line="4" selection-start-column="27" selection-end-line="4" selection-end-column="27" />
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/js/utils.js">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="187">
|
|
||||||
<caret line="13" column="0" selection-start-line="13" selection-start-column="0" selection-end-line="13" selection-end-column="0" />
|
|
||||||
<folding>
|
|
||||||
<element signature="n#!!doc;n#getFormData#0" expanded="false" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/notfound.html">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="0">
|
|
||||||
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/css/style.css">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="91">
|
|
||||||
<caret line="19" column="24" selection-start-line="19" selection-start-column="24" selection-end-line="19" selection-end-column="24" />
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/index.html">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="1043">
|
|
||||||
<caret line="82" column="30" selection-start-line="82" selection-start-column="30" selection-end-line="82" selection-end-column="30" />
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/js/login.js">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="153">
|
|
||||||
<caret line="11" column="13" selection-start-line="11" selection-start-column="13" selection-end-line="11" selection-end-column="13" />
|
|
||||||
<folding>
|
|
||||||
<element signature="n#!!doc;n#login#0" expanded="false" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/js/register.js">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="255">
|
|
||||||
<caret line="17" column="0" selection-start-line="17" selection-start-column="0" selection-end-line="17" selection-end-column="0" />
|
|
||||||
<folding>
|
|
||||||
<element signature="n#!!doc;n#register#0" expanded="false" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -1,44 +1,44 @@
|
||||||
body {
|
body {
|
||||||
background-color: #EEE;
|
background-color: #EEE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#errormsg, #successmsg {
|
#errormsg, #successmsg {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#errormsg {
|
#errormsg {
|
||||||
background-color: #8c0000;
|
background-color: #8c0000;
|
||||||
border-color: #ff0000;
|
border-color: #ff0000;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
border-width: 2px;
|
border-width: 2px;
|
||||||
color: #ff0000;
|
color: #ff0000;
|
||||||
}
|
}
|
||||||
|
|
||||||
#successmsg {
|
#successmsg {
|
||||||
background-color: #188c00;
|
background-color: #188c00;
|
||||||
border-color: #00ff00;
|
border-color: #00ff00;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
border-width: 2px;
|
border-width: 2px;
|
||||||
color: #00ff00;
|
color: #00ff00;
|
||||||
}
|
}
|
||||||
|
|
||||||
#sidebar {
|
#sidebar {
|
||||||
float: right;
|
float: right;
|
||||||
width: 300px;
|
width: 300px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#loginregisterbox {
|
#loginregisterbox {
|
||||||
margin: auto;
|
margin: auto;
|
||||||
width: 300px;
|
width: 300px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#usercontent {
|
#usercontent {
|
||||||
margin: auto;
|
margin: auto;
|
||||||
width: 75%;
|
width: 75%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#msginput {
|
#msginput {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
172
pages/index.html
172
pages/index.html
|
@ -1,86 +1,86 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<head>
|
<head>
|
||||||
<title>ChatServer</title>
|
<title>ChatServer</title>
|
||||||
<script src="js/jquery-3.1.0.js"></script>
|
<script src="js/jquery-3.1.0.js"></script>
|
||||||
<script src="js/utils.js"></script>
|
<script src="js/utils.js"></script>
|
||||||
<script src="js/message.js"></script>
|
<script src="js/message.js"></script>
|
||||||
<script src="js/login.js"></script>
|
<script src="js/login.js"></script>
|
||||||
<script src="js/register.js"></script>
|
<script src="js/register.js"></script>
|
||||||
<link rel="stylesheet" href="css/style.css"/>
|
<link rel="stylesheet" href="css/style.css"/>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="errormsg">
|
<div id="errormsg">
|
||||||
</div>
|
</div>
|
||||||
<div id="sidebar">
|
<div id="sidebar">
|
||||||
<div id="userbox">
|
<div id="userbox">
|
||||||
Logged in as
|
Logged in as
|
||||||
<username/>
|
<username/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="loginregisterbox">
|
<div id="loginregisterbox">
|
||||||
<div id="loginbox">
|
<div id="loginbox">
|
||||||
<h2>Login</h2>
|
<h2>Login</h2>
|
||||||
<form>
|
<form>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>E-mail:</td>
|
<td>E-mail:</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="email" name="email">
|
<input type="email" name="email">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Password:</td>
|
<td>Password:</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="password" name="pass">
|
<input type="password" name="pass">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<input type="button" value="Login" onclick="login(this.form)">
|
<input type="button" value="Login" onclick="login(this.form)">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div id="registerbox">
|
<div id="registerbox">
|
||||||
<h2>Register</h2>
|
<h2>Register</h2>
|
||||||
<form>
|
<form>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Name:</td>
|
<td>Name:</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" name="name"/>
|
<input type="text" name="name"/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>E-mail:</td>
|
<td>E-mail:</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="email" name="email"/>
|
<input type="email" name="email"/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Password</td>
|
<td>Password</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="password" name="pass"/>
|
<input type="password" name="pass"/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Password confirm</td>
|
<td>Password confirm</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="password" name="pass2"/>
|
<input type="password" name="pass2"/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<input type="button" value="Register" onclick="register(this.form)"/>
|
<input type="button" value="Register" onclick="register(this.form)"/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="usercontent">
|
<div id="usercontent">
|
||||||
<div id="channelmessages"></div>
|
<div id="channelmessages"></div>
|
||||||
<textarea id="msginput"></textarea>
|
<textarea id="msginput"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
/**
|
/**
|
||||||
* Created by Norbi on 2016-07-26.
|
* Created by Norbi on 2016-07-26.
|
||||||
*/
|
*/
|
||||||
function login(form) { //TODO: Detect Enter
|
function login(form) { //TODO: Detect Enter
|
||||||
var json = JSON.stringify(getFormData($(form)));
|
var json = JSON.stringify(getFormData($(form)));
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/login", data: json, method: "POST", success: function (result) {
|
url: "/login", data: json, method: "POST", success: function (result) {
|
||||||
if (result != "Success") {
|
if (result != "Success") {
|
||||||
var errormsg = document.getElementById("errormsg");
|
var errormsg = document.getElementById("errormsg");
|
||||||
errormsg.innerHTML = result;
|
errormsg.innerHTML = result;
|
||||||
errormsg.style = "display: block";
|
errormsg.style = "display: block";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
location.reload(true);
|
location.reload(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
$('#msginput').keypress(function(e) {
|
$('#msginput').keypress(function(e) {
|
||||||
if (e.which == '\r'.charCodeAt(0))
|
if (e.which == '\r'.charCodeAt(0))
|
||||||
document.write(document.getElementById("msginput").value);
|
document.write(document.getElementById("msginput").value);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
/**
|
/**
|
||||||
* Created by Norbi on 2016-07-27.
|
* Created by Norbi on 2016-07-27.
|
||||||
*/
|
*/
|
||||||
function register(form) {
|
function register(form) {
|
||||||
var json = JSON.stringify(getFormData($(form)));
|
var json = JSON.stringify(getFormData($(form)));
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/register", data: json, method: "POST", success: function (result) {
|
url: "/register", data: json, method: "POST", success: function (result) {
|
||||||
if (result != "Success") {
|
if (result != "Success") {
|
||||||
var errormsg = document.getElementById("errormsg");
|
var errormsg = document.getElementById("errormsg");
|
||||||
errormsg.innerHTML = result;
|
errormsg.innerHTML = result;
|
||||||
errormsg.style = "display: block";
|
errormsg.style = "display: block";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
location.reload(true);
|
location.reload(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
/**
|
/**
|
||||||
* Created by Norbi on 2016-07-27.
|
* Created by Norbi on 2016-07-27.
|
||||||
*/
|
*/
|
||||||
function getFormData($form) {
|
function getFormData($form) {
|
||||||
var unindexed_array = $form.serializeArray();
|
var unindexed_array = $form.serializeArray();
|
||||||
var indexed_array = {};
|
var indexed_array = {};
|
||||||
|
|
||||||
$.map(unindexed_array, function (n, i) {
|
$.map(unindexed_array, function (n, i) {
|
||||||
indexed_array[n['name']] = n['value'];
|
indexed_array[n['name']] = n['value'];
|
||||||
});
|
});
|
||||||
|
|
||||||
return indexed_array;
|
return indexed_array;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<h1>404 Not found</h1>
|
<h1>404 Not found</h1>
|
||||||
<p>The requested page cannot be found.</p>
|
<p>The requested page cannot be found.</p>
|
||||||
</html>
|
</html>
|
||||||
|
|
154
pom.xml
154
pom.xml
|
@ -1,78 +1,78 @@
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>ChatServer</groupId>
|
<groupId>ChatServer</groupId>
|
||||||
<artifactId>ChatServer</artifactId>
|
<artifactId>ChatServer</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
<build>
|
<build>
|
||||||
<sourceDirectory>src</sourceDirectory>
|
<sourceDirectory>src</sourceDirectory>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.5.1</version>
|
<version>3.5.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.8</source>
|
<source>1.8</source>
|
||||||
<target>1.8</target>
|
<target>1.8</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.derby</groupId>
|
<groupId>org.apache.derby</groupId>
|
||||||
<artifactId>derby</artifactId>
|
<artifactId>derby</artifactId>
|
||||||
<version>10.12.1.1</version>
|
<version>10.12.1.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.derby</groupId>
|
<groupId>org.apache.derby</groupId>
|
||||||
<artifactId>derbyclient</artifactId>
|
<artifactId>derbyclient</artifactId>
|
||||||
<version>10.12.1.1</version>
|
<version>10.12.1.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core -->
|
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.hibernate</groupId>
|
<groupId>org.hibernate</groupId>
|
||||||
<artifactId>hibernate-core</artifactId>
|
<artifactId>hibernate-core</artifactId>
|
||||||
<version>5.2.1.Final</version>
|
<version>5.2.1.Final</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
|
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-io</groupId>
|
<groupId>commons-io</groupId>
|
||||||
<artifactId>commons-io</artifactId>
|
<artifactId>commons-io</artifactId>
|
||||||
<version>2.5</version>
|
<version>2.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.reflections</groupId>
|
<groupId>org.reflections</groupId>
|
||||||
<artifactId>reflections</artifactId>
|
<artifactId>reflections</artifactId>
|
||||||
<version>0.9.10</version>
|
<version>0.9.10</version>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<!-- jsoup HTML parser library @ http://jsoup.org/ -->
|
<!-- jsoup HTML parser library @ http://jsoup.org/ -->
|
||||||
<groupId>org.jsoup</groupId>
|
<groupId>org.jsoup</groupId>
|
||||||
<artifactId>jsoup</artifactId>
|
<artifactId>jsoup</artifactId>
|
||||||
<version>1.9.2</version>
|
<version>1.9.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->
|
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
<artifactId>log4j-core</artifactId>
|
<artifactId>log4j-core</artifactId>
|
||||||
<version>2.6.2</version>
|
<version>2.6.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api -->
|
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
<artifactId>log4j-api</artifactId>
|
<artifactId>log4j-api</artifactId>
|
||||||
<version>2.6.2</version>
|
<version>2.6.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- https://mvnrepository.com/artifact/org.json/json -->
|
<!-- https://mvnrepository.com/artifact/org.json/json -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.json</groupId>
|
<groupId>org.json</groupId>
|
||||||
<artifactId>json</artifactId>
|
<artifactId>json</artifactId>
|
||||||
<version>20160212</version>
|
<version>20160212</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
</properties>
|
</properties>
|
||||||
</project>
|
</project>
|
|
@ -1,178 +1,178 @@
|
||||||
package io.github.norbipeti.chat.server;
|
package io.github.norbipeti.chat.server;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.time.Period;
|
import java.time.Period;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.jsoup.Jsoup;
|
import org.jsoup.Jsoup;
|
||||||
import org.jsoup.nodes.Document;
|
import org.jsoup.nodes.Document;
|
||||||
|
|
||||||
import com.sun.net.httpserver.HttpExchange;
|
import com.sun.net.httpserver.HttpExchange;
|
||||||
|
|
||||||
import io.github.norbipeti.chat.server.db.DataProvider;
|
import io.github.norbipeti.chat.server.db.DataProvider;
|
||||||
import io.github.norbipeti.chat.server.db.domain.User;
|
import io.github.norbipeti.chat.server.db.domain.User;
|
||||||
import io.github.norbipeti.chat.server.page.Page;
|
import io.github.norbipeti.chat.server.page.Page;
|
||||||
|
|
||||||
public class IOHelper {
|
public class IOHelper {
|
||||||
public static void SendResponse(int code, String content, HttpExchange exchange) throws IOException {
|
public static void SendResponse(int code, String content, HttpExchange exchange) throws IOException {
|
||||||
exchange.sendResponseHeaders(code, content.length());
|
exchange.sendResponseHeaders(code, content.length());
|
||||||
IOUtils.write(content, exchange.getResponseBody(), StandardCharsets.UTF_8);
|
IOUtils.write(content, exchange.getResponseBody(), StandardCharsets.UTF_8);
|
||||||
exchange.getResponseBody().close();
|
exchange.getResponseBody().close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean SendPage(int code, Page page, HttpExchange exchange) throws IOException {
|
public static boolean SendPage(int code, Page page, HttpExchange exchange) throws IOException {
|
||||||
String content = GetPage(page, exchange);
|
String content = GetPage(page, exchange);
|
||||||
SendResponse(code, content, exchange);
|
SendResponse(code, content, exchange);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String GetPage(Page page, HttpExchange exchange) throws IOException {
|
public static String GetPage(Page page, HttpExchange exchange) throws IOException {
|
||||||
File file = new File(page.GetHTMLPath());
|
File file = new File(page.GetHTMLPath());
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
SendResponse(501,
|
SendResponse(501,
|
||||||
"<h1>501 Not Implemented</h1><p>The page \"" + page.GetName() + "\" cannot be found on disk.</h1>",
|
"<h1>501 Not Implemented</h1><p>The page \"" + page.GetName() + "\" cannot be found on disk.</h1>",
|
||||||
exchange);
|
exchange);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return ReadFile(file);
|
return ReadFile(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String ReadFile(File file) throws FileNotFoundException, IOException {
|
public static String ReadFile(File file) throws FileNotFoundException, IOException {
|
||||||
FileInputStream inputStream = new FileInputStream(file);
|
FileInputStream inputStream = new FileInputStream(file);
|
||||||
String content = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
|
String content = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static HashMap<String, String> GetPOST(HttpExchange exchange) throws IOException {
|
public static HashMap<String, String> GetPOST(HttpExchange exchange) throws IOException {
|
||||||
if (exchange.getRequestBody().available() == 0)
|
if (exchange.getRequestBody().available() == 0)
|
||||||
return new HashMap<>();
|
return new HashMap<>();
|
||||||
try {
|
try {
|
||||||
String[] content = IOUtils.toString(exchange.getRequestBody(), StandardCharsets.ISO_8859_1).split("\\&");
|
String[] content = IOUtils.toString(exchange.getRequestBody(), StandardCharsets.ISO_8859_1).split("\\&");
|
||||||
HashMap<String, String> vars = new HashMap<>();
|
HashMap<String, String> vars = new HashMap<>();
|
||||||
for (String var : content) {
|
for (String var : content) {
|
||||||
String[] spl = var.split("\\=");
|
String[] spl = var.split("\\=");
|
||||||
if (spl.length == 1)
|
if (spl.length == 1)
|
||||||
vars.put(spl[0], "");
|
vars.put(spl[0], "");
|
||||||
else
|
else
|
||||||
vars.put(spl[0], spl[1]);
|
vars.put(spl[0], spl[1]);
|
||||||
}
|
}
|
||||||
return vars;
|
return vars;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return new HashMap<>();
|
return new HashMap<>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JSONObject GetPOSTJSON(HttpExchange exchange) throws IOException {
|
public static JSONObject GetPOSTJSON(HttpExchange exchange) throws IOException {
|
||||||
if (exchange.getRequestBody().available() == 0)
|
if (exchange.getRequestBody().available() == 0)
|
||||||
return null;
|
return null;
|
||||||
try {
|
try {
|
||||||
String content = IOUtils.toString(exchange.getRequestBody(), StandardCharsets.ISO_8859_1);
|
String content = IOUtils.toString(exchange.getRequestBody(), StandardCharsets.ISO_8859_1);
|
||||||
JSONObject obj = new JSONObject(content);
|
JSONObject obj = new JSONObject(content);
|
||||||
return obj;
|
return obj;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean SendModifiedPage(int code, Page page, Function<Document, Document> modifyfunc,
|
public static boolean SendModifiedPage(int code, Page page, Function<Document, Document> modifyfunc,
|
||||||
HttpExchange exchange) throws IOException {
|
HttpExchange exchange) throws IOException {
|
||||||
String content = GetPage(page, exchange);
|
String content = GetPage(page, exchange);
|
||||||
if (content == null)
|
if (content == null)
|
||||||
return false;
|
return false;
|
||||||
Document doc = Jsoup.parse(content);
|
Document doc = Jsoup.parse(content);
|
||||||
doc = modifyfunc.apply(doc);
|
doc = modifyfunc.apply(doc);
|
||||||
SendResponse(200, doc.html(), exchange);
|
SendResponse(200, doc.html(), exchange);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void LoginUser(HttpExchange exchange, User user, DataProvider provider) {
|
public static void LoginUser(HttpExchange exchange, User user, DataProvider provider) {
|
||||||
provider.SetValues(() -> user.setSessionid(UUID.randomUUID()));
|
provider.SetValues(() -> user.setSessionid(UUID.randomUUID()));
|
||||||
System.out.println("Logging in user: " + user);
|
System.out.println("Logging in user: " + user);
|
||||||
ZonedDateTime expiretime = ZonedDateTime.now(ZoneId.of("GMT")).plus(Period.of(2, 0, 0));
|
ZonedDateTime expiretime = ZonedDateTime.now(ZoneId.of("GMT")).plus(Period.of(2, 0, 0));
|
||||||
exchange.getResponseHeaders().add("Set-Cookie",
|
exchange.getResponseHeaders().add("Set-Cookie",
|
||||||
"user_id=" + user.getId() + "; expires=" + expiretime.format(DateTimeFormatter.RFC_1123_DATE_TIME));
|
"user_id=" + user.getId() + "; expires=" + expiretime.format(DateTimeFormatter.RFC_1123_DATE_TIME));
|
||||||
exchange.getResponseHeaders().add("Set-Cookie",
|
exchange.getResponseHeaders().add("Set-Cookie",
|
||||||
"session_id=" + user.getSessionid() + "; expires=" + expiretime);
|
"session_id=" + user.getSessionid() + "; expires=" + expiretime);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void LogoutUser(HttpExchange exchange, User user) {
|
public static void LogoutUser(HttpExchange exchange, User user) {
|
||||||
user.setSessionid(new UUID(0, 0));
|
user.setSessionid(new UUID(0, 0));
|
||||||
SendLogoutHeaders(exchange);
|
SendLogoutHeaders(exchange);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void SendLogoutHeaders(HttpExchange exchange) {
|
private static void SendLogoutHeaders(HttpExchange exchange) {
|
||||||
String expiretime = "Sat, 19 Mar 2016 23:33:00 GMT";
|
String expiretime = "Sat, 19 Mar 2016 23:33:00 GMT";
|
||||||
exchange.getResponseHeaders().add("Set-Cookie", "user_id=del; expires=" + expiretime);
|
exchange.getResponseHeaders().add("Set-Cookie", "user_id=del; expires=" + expiretime);
|
||||||
exchange.getResponseHeaders().add("Set-Cookie", "session_id=del; expires=" + expiretime);
|
exchange.getResponseHeaders().add("Set-Cookie", "session_id=del; expires=" + expiretime);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Redirect(String url, HttpExchange exchange) throws IOException {
|
public static void Redirect(String url, HttpExchange exchange) throws IOException {
|
||||||
exchange.getResponseHeaders().add("Location", url);
|
exchange.getResponseHeaders().add("Location", url);
|
||||||
IOHelper.SendResponse(303, "<a href=\"" + url + "\">If you can see this, click here to continue</a>", exchange);
|
IOHelper.SendResponse(303, "<a href=\"" + url + "\">If you can see this, click here to continue</a>", exchange);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HashMap<String, String> GetCookies(HttpExchange exchange) {
|
public static HashMap<String, String> GetCookies(HttpExchange exchange) {
|
||||||
if (!exchange.getRequestHeaders().containsKey("Cookie"))
|
if (!exchange.getRequestHeaders().containsKey("Cookie"))
|
||||||
return new HashMap<>();
|
return new HashMap<>();
|
||||||
HashMap<String, String> map = new HashMap<>();
|
HashMap<String, String> map = new HashMap<>();
|
||||||
for (String cheader : exchange.getRequestHeaders().get("Cookie")) {
|
for (String cheader : exchange.getRequestHeaders().get("Cookie")) {
|
||||||
String[] spl = cheader.split("\\;\\s*");
|
String[] spl = cheader.split("\\;\\s*");
|
||||||
for (String s : spl) {
|
for (String s : spl) {
|
||||||
String[] kv = s.split("\\=");
|
String[] kv = s.split("\\=");
|
||||||
if (kv.length < 2)
|
if (kv.length < 2)
|
||||||
continue;
|
continue;
|
||||||
map.put(kv[0], kv[1]);
|
map.put(kv[0], kv[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get logged in user. It may also send logout headers if the cookies are
|
* Get logged in user. It may also send logout headers if the cookies are
|
||||||
* invalid.
|
* invalid.
|
||||||
*
|
*
|
||||||
* @param exchange
|
* @param exchange
|
||||||
* @return The logged in user or null if not logged in.
|
* @return The logged in user or null if not logged in.
|
||||||
*/
|
*/
|
||||||
public static User GetLoggedInUser(HttpExchange exchange) {
|
public static User GetLoggedInUser(HttpExchange exchange) {
|
||||||
HashMap<String, String> cookies = GetCookies(exchange);
|
HashMap<String, String> cookies = GetCookies(exchange);
|
||||||
System.out.println("Cookies: " + cookies);
|
System.out.println("Cookies: " + cookies);
|
||||||
if (!cookies.containsKey("user_id") || !cookies.containsKey("session_id"))
|
if (!cookies.containsKey("user_id") || !cookies.containsKey("session_id"))
|
||||||
return null;
|
return null;
|
||||||
System.out.println("Cookies found");
|
System.out.println("Cookies found");
|
||||||
try (DataProvider provider = new DataProvider()) {
|
try (DataProvider provider = new DataProvider()) {
|
||||||
User user = provider.getUser(Long.parseLong(cookies.get("user_id")));
|
User user = provider.getUser(Long.parseLong(cookies.get("user_id")));
|
||||||
System.out.println("User: " + user);
|
System.out.println("User: " + user);
|
||||||
System.out.println("session_id: " + cookies.get("session_id"));
|
System.out.println("session_id: " + cookies.get("session_id"));
|
||||||
if (user != null)
|
if (user != null)
|
||||||
System.out.println("Equals: " + UUID.fromString(cookies.get("session_id")).equals(user.getSessionid()));
|
System.out.println("Equals: " + UUID.fromString(cookies.get("session_id")).equals(user.getSessionid()));
|
||||||
if (user != null && cookies.get("session_id") != null
|
if (user != null && cookies.get("session_id") != null
|
||||||
&& UUID.fromString(cookies.get("session_id")).equals(user.getSessionid()))
|
&& UUID.fromString(cookies.get("session_id")).equals(user.getSessionid()))
|
||||||
return user;
|
return user;
|
||||||
else
|
else
|
||||||
SendLogoutHeaders(exchange);
|
SendLogoutHeaders(exchange);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SendResponse(int code, Function<Document, Document> action, HttpExchange exchange)
|
public static void SendResponse(int code, Function<Document, Document> action, HttpExchange exchange)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
Document doc = new Document("");
|
Document doc = new Document("");
|
||||||
doc = action.apply(doc);
|
doc = action.apply(doc);
|
||||||
SendResponse(200, doc.html(), exchange);
|
SendResponse(200, doc.html(), exchange);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,109 +1,109 @@
|
||||||
package io.github.norbipeti.chat.server;
|
package io.github.norbipeti.chat.server;
|
||||||
|
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.logging.log4j.Level;
|
import org.apache.logging.log4j.Level;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.core.LoggerContext;
|
import org.apache.logging.log4j.core.LoggerContext;
|
||||||
import org.apache.logging.log4j.core.config.Configuration;
|
import org.apache.logging.log4j.core.config.Configuration;
|
||||||
import org.apache.logging.log4j.core.config.LoggerConfig;
|
import org.apache.logging.log4j.core.config.LoggerConfig;
|
||||||
import org.reflections.Reflections;
|
import org.reflections.Reflections;
|
||||||
import org.reflections.scanners.SubTypesScanner;
|
import org.reflections.scanners.SubTypesScanner;
|
||||||
import org.reflections.util.ClasspathHelper;
|
import org.reflections.util.ClasspathHelper;
|
||||||
import org.reflections.util.ConfigurationBuilder;
|
import org.reflections.util.ConfigurationBuilder;
|
||||||
|
|
||||||
import com.sun.net.httpserver.HttpServer;
|
import com.sun.net.httpserver.HttpServer;
|
||||||
import io.github.norbipeti.chat.server.db.*;
|
import io.github.norbipeti.chat.server.db.*;
|
||||||
import io.github.norbipeti.chat.server.db.domain.*;
|
import io.github.norbipeti.chat.server.db.domain.*;
|
||||||
import io.github.norbipeti.chat.server.page.*;
|
import io.github.norbipeti.chat.server.page.*;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
// public static final HashMap<String, Page> Pages = new HashMap<String,
|
// public static final HashMap<String, Page> Pages = new HashMap<String,
|
||||||
// Page>();
|
// Page>();
|
||||||
|
|
||||||
public static void main(String[] args) { // http://stackoverflow.com/questions/9266632/access-restriction-is-not-accessible-due-to-restriction-on-required-library/10642163#10642163
|
public static void main(String[] args) { // http://stackoverflow.com/questions/9266632/access-restriction-is-not-accessible-due-to-restriction-on-required-library/10642163#10642163
|
||||||
try { // rt.jar Javadoc:
|
try { // rt.jar Javadoc:
|
||||||
// https://docs.oracle.com/javase/8/docs/jre/api/net/httpserver/spec/
|
// https://docs.oracle.com/javase/8/docs/jre/api/net/httpserver/spec/
|
||||||
// https://docs.oracle.com/javase/8/docs/api/
|
// https://docs.oracle.com/javase/8/docs/api/
|
||||||
System.out.println(System.getProperty("java.class.path")); // TODO:
|
System.out.println(System.getProperty("java.class.path")); // TODO:
|
||||||
// log4j
|
// log4j
|
||||||
LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
|
LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
|
||||||
Configuration config = ctx.getConfiguration();
|
Configuration config = ctx.getConfiguration();
|
||||||
LoggerConfig loggerConfig = config.getLoggerConfig(LogManager.ROOT_LOGGER_NAME);
|
LoggerConfig loggerConfig = config.getLoggerConfig(LogManager.ROOT_LOGGER_NAME);
|
||||||
loggerConfig.setLevel(Level.WARN);
|
loggerConfig.setLevel(Level.WARN);
|
||||||
ctx.updateLoggers(); // This causes all Loggers to refetch
|
ctx.updateLoggers(); // This causes all Loggers to refetch
|
||||||
// information from their LoggerConfig.
|
// information from their LoggerConfig.
|
||||||
System.out.println("Loading database...");
|
System.out.println("Loading database...");
|
||||||
try (DataProvider provider = new DataProvider()) {
|
try (DataProvider provider = new DataProvider()) {
|
||||||
User user = new User();
|
User user = new User();
|
||||||
user.setName("asd");
|
user.setName("asd");
|
||||||
user.setEmail("test@test.com");
|
user.setEmail("test@test.com");
|
||||||
User user2 = new User();
|
User user2 = new User();
|
||||||
user2.setName("Teszt");
|
user2.setName("Teszt");
|
||||||
user2.setEmail("test2@test.com");
|
user2.setEmail("test2@test.com");
|
||||||
user2.getContacts().add(user);
|
user2.getContacts().add(user);
|
||||||
provider.addUser(user);
|
provider.addUser(user);
|
||||||
List<User> users = provider.getUsers();
|
List<User> users = provider.getUsers();
|
||||||
user = users.get(0);
|
user = users.get(0);
|
||||||
user.getContacts().add(user2);
|
user.getContacts().add(user2);
|
||||||
provider.addUser(user2);
|
provider.addUser(user2);
|
||||||
users = provider.getUsers();
|
users = provider.getUsers();
|
||||||
user2 = users.get(1);
|
user2 = users.get(1);
|
||||||
System.out.println(users);
|
System.out.println(users);
|
||||||
System.out.println("1st's contact: " + user.getContacts().get(0));
|
System.out.println("1st's contact: " + user.getContacts().get(0));
|
||||||
System.out.println("2nd's contact: " + user2.getContacts().get(0));
|
System.out.println("2nd's contact: " + user2.getContacts().get(0));
|
||||||
Conversation convo = new Conversation();
|
Conversation convo = new Conversation();
|
||||||
convo.getUsers().add(user);
|
convo.getUsers().add(user);
|
||||||
convo.getUsers().add(user2);
|
convo.getUsers().add(user2);
|
||||||
Message msg = new Message();
|
Message msg = new Message();
|
||||||
msg.setSender(user);
|
msg.setSender(user);
|
||||||
msg.setTime(new Date());
|
msg.setTime(new Date());
|
||||||
msg.setMessage("Teszt 1");
|
msg.setMessage("Teszt 1");
|
||||||
convo.getMesssages().add(msg);
|
convo.getMesssages().add(msg);
|
||||||
Message msg2 = new Message();
|
Message msg2 = new Message();
|
||||||
msg2.setSender(user2);
|
msg2.setSender(user2);
|
||||||
msg2.setTime(new Date());
|
msg2.setTime(new Date());
|
||||||
msg2.setMessage("Teszt 2");
|
msg2.setMessage("Teszt 2");
|
||||||
convo.getMesssages().add(msg2);
|
convo.getMesssages().add(msg2);
|
||||||
provider.addConversation(convo);
|
provider.addConversation(convo);
|
||||||
}
|
}
|
||||||
System.out.println("Starting webserver...");
|
System.out.println("Starting webserver...");
|
||||||
HttpServer server = HttpServer.create(new InetSocketAddress(InetAddress.getLocalHost(), 8080), 10);
|
HttpServer server = HttpServer.create(new InetSocketAddress(InetAddress.getLocalHost(), 8080), 10);
|
||||||
Reflections rf = new Reflections(
|
Reflections rf = new Reflections(
|
||||||
new ConfigurationBuilder().setUrls(ClasspathHelper.forClassLoader(Page.class.getClassLoader()))
|
new ConfigurationBuilder().setUrls(ClasspathHelper.forClassLoader(Page.class.getClassLoader()))
|
||||||
.addClassLoader(Page.class.getClassLoader()).addScanners(new SubTypesScanner())
|
.addClassLoader(Page.class.getClassLoader()).addScanners(new SubTypesScanner())
|
||||||
.filterInputsBy((String pkg) -> pkg.contains("io.github.norbipeti.chat.server.page")));
|
.filterInputsBy((String pkg) -> pkg.contains("io.github.norbipeti.chat.server.page")));
|
||||||
Set<Class<? extends Page>> pages = rf.getSubTypesOf(Page.class);
|
Set<Class<? extends Page>> pages = rf.getSubTypesOf(Page.class);
|
||||||
for (Class<? extends Page> page : pages) {
|
for (Class<? extends Page> page : pages) {
|
||||||
try {
|
try {
|
||||||
if (Modifier.isAbstract(page.getModifiers()))
|
if (Modifier.isAbstract(page.getModifiers()))
|
||||||
continue;
|
continue;
|
||||||
Page p = page.newInstance();
|
Page p = page.newInstance();
|
||||||
addPage(server, p);
|
addPage(server, p);
|
||||||
} catch (InstantiationException e) {
|
} catch (InstantiationException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
server.start();
|
server.start();
|
||||||
System.out.println("Ready... Press Enter to stop.");
|
System.out.println("Ready... Press Enter to stop.");
|
||||||
System.in.read();
|
System.in.read();
|
||||||
System.out.println("Stopping...");
|
System.out.println("Stopping...");
|
||||||
server.stop(1);
|
server.stop(1);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
System.out.println("Stopped");
|
System.out.println("Stopped");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addPage(HttpServer server, Page page) {
|
private static void addPage(HttpServer server, Page page) {
|
||||||
server.createContext("/" + page.GetName(), page);
|
server.createContext("/" + page.GetName(), page);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,87 +1,87 @@
|
||||||
package io.github.norbipeti.chat.server.db;
|
package io.github.norbipeti.chat.server.db;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.EntityManagerFactory;
|
import javax.persistence.EntityManagerFactory;
|
||||||
import javax.persistence.Persistence;
|
import javax.persistence.Persistence;
|
||||||
import javax.persistence.TypedQuery;
|
import javax.persistence.TypedQuery;
|
||||||
|
|
||||||
import io.github.norbipeti.chat.server.db.domain.*;
|
import io.github.norbipeti.chat.server.db.domain.*;
|
||||||
|
|
||||||
public class DataProvider implements AutoCloseable {
|
public class DataProvider implements AutoCloseable {
|
||||||
private EntityManagerFactory emf;
|
private EntityManagerFactory emf;
|
||||||
|
|
||||||
public DataProvider() {
|
public DataProvider() {
|
||||||
emf = Persistence.createEntityManagerFactory("ChatServerPU");
|
emf = Persistence.createEntityManagerFactory("ChatServerPU");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addUser(User user) {
|
public void addUser(User user) {
|
||||||
save(user);
|
save(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addConversation(Conversation convo) {
|
public void addConversation(Conversation convo) {
|
||||||
save(convo);
|
save(convo);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void save(Object object) {
|
private void save(Object object) {
|
||||||
EntityManager em = emf.createEntityManager();
|
EntityManager em = emf.createEntityManager();
|
||||||
em.getTransaction().begin();
|
em.getTransaction().begin();
|
||||||
em.persist(object);
|
em.persist(object);
|
||||||
em.getTransaction().commit();
|
em.getTransaction().commit();
|
||||||
em.close();
|
em.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<User> getUsers() {
|
public List<User> getUsers() {
|
||||||
return get(User.class);
|
return get(User.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Message> getMessages() {
|
public List<Message> getMessages() {
|
||||||
return get(Message.class);
|
return get(Message.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Conversation> getConversations() {
|
public List<Conversation> getConversations() {
|
||||||
return get(Conversation.class);
|
return get(Conversation.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T> List<T> get(Class<T> cl) {
|
private <T> List<T> get(Class<T> cl) {
|
||||||
EntityManager em = emf.createEntityManager();
|
EntityManager em = emf.createEntityManager();
|
||||||
TypedQuery<T> query = em.createQuery("SELECT x FROM " + cl.getSimpleName() + " x", cl);
|
TypedQuery<T> query = em.createQuery("SELECT x FROM " + cl.getSimpleName() + " x", cl);
|
||||||
List<T> results = query.getResultList();
|
List<T> results = query.getResultList();
|
||||||
em.close();
|
em.close();
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeUser(User user) {
|
public void removeUser(User user) {
|
||||||
EntityManager em = emf.createEntityManager();
|
EntityManager em = emf.createEntityManager();
|
||||||
em.getTransaction().begin();
|
em.getTransaction().begin();
|
||||||
User managedUser = em.find(User.class, user.getId());
|
User managedUser = em.find(User.class, user.getId());
|
||||||
em.remove(managedUser);
|
em.remove(managedUser);
|
||||||
em.getTransaction().commit();
|
em.getTransaction().commit();
|
||||||
em.close();
|
em.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public User getUser(Long id) {
|
public User getUser(Long id) {
|
||||||
return get(User.class, id);
|
return get(User.class, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T> T get(Class<T> cl, Long id) {
|
private <T> T get(Class<T> cl, Long id) {
|
||||||
EntityManager em = emf.createEntityManager();
|
EntityManager em = emf.createEntityManager();
|
||||||
T result = em.find(cl, id);
|
T result = em.find(cl, id);
|
||||||
em.close();
|
em.close();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetValues(Runnable action) {
|
public void SetValues(Runnable action) {
|
||||||
EntityManager em = emf.createEntityManager();
|
EntityManager em = emf.createEntityManager();
|
||||||
em.getTransaction().begin();
|
em.getTransaction().begin();
|
||||||
action.run();
|
action.run();
|
||||||
em.getTransaction().commit();
|
em.getTransaction().commit();
|
||||||
em.close();
|
em.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
if (emf != null)
|
if (emf != null)
|
||||||
emf.close();
|
emf.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,51 +1,51 @@
|
||||||
package io.github.norbipeti.chat.server.db.domain;
|
package io.github.norbipeti.chat.server.db.domain;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
public class Conversation {
|
public class Conversation {
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
@Column(name = "id", unique = true, nullable = false)
|
@Column(name = "id", unique = true, nullable = false)
|
||||||
private Long id;
|
private Long id;
|
||||||
@ElementCollection(fetch=FetchType.EAGER)
|
@ElementCollection(fetch=FetchType.EAGER)
|
||||||
@OneToMany(cascade = CascadeType.ALL)
|
@OneToMany(cascade = CascadeType.ALL)
|
||||||
private List<Message> messsages;
|
private List<Message> messsages;
|
||||||
@ElementCollection(fetch = FetchType.EAGER)
|
@ElementCollection(fetch = FetchType.EAGER)
|
||||||
@ManyToMany(cascade = CascadeType.ALL)
|
@ManyToMany(cascade = CascadeType.ALL)
|
||||||
private List<User> users;
|
private List<User> users;
|
||||||
@Version
|
@Version
|
||||||
@GeneratedValue
|
@GeneratedValue
|
||||||
private int Version;
|
private int Version;
|
||||||
|
|
||||||
public List<Message> getMesssages() {
|
public List<Message> getMesssages() {
|
||||||
if (messsages == null)
|
if (messsages == null)
|
||||||
messsages = new ArrayList<>();
|
messsages = new ArrayList<>();
|
||||||
return messsages;
|
return messsages;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMesssages(List<Message> messsages) {
|
public void setMesssages(List<Message> messsages) {
|
||||||
this.messsages = messsages;
|
this.messsages = messsages;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<User> getUsers() {
|
public List<User> getUsers() {
|
||||||
if (users == null)
|
if (users == null)
|
||||||
users = new ArrayList<>();
|
users = new ArrayList<>();
|
||||||
return users;
|
return users;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUsers(List<User> users) {
|
public void setUsers(List<User> users) {
|
||||||
this.users = users;
|
this.users = users;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(Long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,62 +1,62 @@
|
||||||
package io.github.norbipeti.chat.server.db.domain;
|
package io.github.norbipeti.chat.server.db.domain;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
public class Message {
|
public class Message {
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
@Column(name = "id", unique = true, nullable = false)
|
@Column(name = "id", unique = true, nullable = false)
|
||||||
private Long id;
|
private Long id;
|
||||||
@ManyToOne(cascade=CascadeType.ALL)
|
@ManyToOne(cascade=CascadeType.ALL)
|
||||||
private User sender;
|
private User sender;
|
||||||
private Date time;
|
private Date time;
|
||||||
private String message;
|
private String message;
|
||||||
@ManyToOne(cascade=CascadeType.ALL)
|
@ManyToOne(cascade=CascadeType.ALL)
|
||||||
private Conversation conversation;
|
private Conversation conversation;
|
||||||
@Version
|
@Version
|
||||||
@GeneratedValue
|
@GeneratedValue
|
||||||
private int Version;
|
private int Version;
|
||||||
|
|
||||||
public User getSender() {
|
public User getSender() {
|
||||||
return sender;
|
return sender;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSender(User sender) {
|
public void setSender(User sender) {
|
||||||
this.sender = sender;
|
this.sender = sender;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getTime() {
|
public Date getTime() {
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTime(Date time) {
|
public void setTime(Date time) {
|
||||||
this.time = time;
|
this.time = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMessage() {
|
public String getMessage() {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMessage(String message) {
|
public void setMessage(String message) {
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Conversation getConversation() {
|
public Conversation getConversation() {
|
||||||
return conversation;
|
return conversation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setConversation(Conversation conversation) {
|
public void setConversation(Conversation conversation) {
|
||||||
this.conversation = conversation;
|
this.conversation = conversation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(Long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,115 +1,115 @@
|
||||||
package io.github.norbipeti.chat.server.db.domain;
|
package io.github.norbipeti.chat.server.db.domain;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "\"User\"")
|
@Table(name = "\"User\"")
|
||||||
public class User {
|
public class User {
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
@Column(name = "id", unique = true, nullable = false)
|
@Column(name = "id", unique = true, nullable = false)
|
||||||
private Long id;
|
private Long id;
|
||||||
private String name;
|
private String name;
|
||||||
private String email;
|
private String email;
|
||||||
private String password;
|
private String password;
|
||||||
@ElementCollection(fetch = FetchType.EAGER)
|
@ElementCollection(fetch = FetchType.EAGER)
|
||||||
private List<User> contacts;
|
private List<User> contacts;
|
||||||
private String salt;
|
private String salt;
|
||||||
@Column(columnDefinition = "CHAR(16) FOR BIT DATA")
|
@Column(columnDefinition = "CHAR(16) FOR BIT DATA")
|
||||||
private UUID sessionid;
|
private UUID sessionid;
|
||||||
@Version
|
@Version
|
||||||
@GeneratedValue
|
@GeneratedValue
|
||||||
private int Version;
|
private int Version;
|
||||||
@ElementCollection(fetch = FetchType.EAGER)
|
@ElementCollection(fetch = FetchType.EAGER)
|
||||||
@ManyToMany(cascade = CascadeType.ALL)
|
@ManyToMany(cascade = CascadeType.ALL)
|
||||||
public List<Conversation> conversations;
|
public List<Conversation> conversations;
|
||||||
|
|
||||||
public List<User> getContacts() {
|
public List<User> getContacts() {
|
||||||
if (contacts == null)
|
if (contacts == null)
|
||||||
contacts = new ArrayList<>();
|
contacts = new ArrayList<>();
|
||||||
return contacts;
|
return contacts;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setContacts(List<User> contacts) {
|
public void setContacts(List<User> contacts) {
|
||||||
this.contacts = contacts;
|
this.contacts = contacts;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEmail() {
|
public String getEmail() {
|
||||||
return email;
|
return email;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
List<String> c = null;
|
List<String> c = null;
|
||||||
if (contacts != null) {
|
if (contacts != null) {
|
||||||
c = new ArrayList<>();
|
c = new ArrayList<>();
|
||||||
for (User u : contacts)
|
for (User u : contacts)
|
||||||
c.add(u.name);
|
c.add(u.name);
|
||||||
}
|
}
|
||||||
return "User [id=" + id + ", name=" + name + ", email=" + email + ", password=" + password + ", contacts=" + c
|
return "User [id=" + id + ", name=" + name + ", email=" + email + ", password=" + password + ", contacts=" + c
|
||||||
+ ", sessionid=" + sessionid + "]"; // TODO: SessionID null
|
+ ", sessionid=" + sessionid + "]"; // TODO: SessionID null
|
||||||
// after getting from db
|
// after getting from db
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEmail(String email) {
|
public void setEmail(String email) {
|
||||||
this.email = email;
|
this.email = email;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPassword() {
|
public String getPassword() {
|
||||||
return password;
|
return password;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPassword(String password) {
|
public void setPassword(String password) {
|
||||||
this.password = password;
|
this.password = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(Long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSalt() {
|
public String getSalt() {
|
||||||
return salt;
|
return salt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSalt(String salt) {
|
public void setSalt(String salt) {
|
||||||
this.salt = salt;
|
this.salt = salt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID getSessionid() {
|
public UUID getSessionid() {
|
||||||
return sessionid;
|
return sessionid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSessionid(UUID sessionid) {
|
public void setSessionid(UUID sessionid) {
|
||||||
this.sessionid = sessionid;
|
this.sessionid = sessionid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Conversation> getConversations() {
|
public List<Conversation> getConversations() {
|
||||||
if (conversations == null)
|
if (conversations == null)
|
||||||
conversations = new ArrayList<>();
|
conversations = new ArrayList<>();
|
||||||
return conversations;
|
return conversations;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setConversations(List<Conversation> conversations) {
|
public void setConversations(List<Conversation> conversations) {
|
||||||
this.conversations = conversations;
|
this.conversations = conversations;
|
||||||
}
|
}
|
||||||
|
|
||||||
public User() {
|
public User() {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,60 +1,60 @@
|
||||||
package io.github.norbipeti.chat.server.page;
|
package io.github.norbipeti.chat.server.page;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.jsoup.nodes.Element;
|
import org.jsoup.nodes.Element;
|
||||||
|
|
||||||
import com.sun.net.httpserver.HttpExchange;
|
import com.sun.net.httpserver.HttpExchange;
|
||||||
import com.sun.net.ssl.internal.ssl.Provider;
|
import com.sun.net.ssl.internal.ssl.Provider;
|
||||||
|
|
||||||
import io.github.norbipeti.chat.server.IOHelper;
|
import io.github.norbipeti.chat.server.IOHelper;
|
||||||
import io.github.norbipeti.chat.server.db.DataProvider;
|
import io.github.norbipeti.chat.server.db.DataProvider;
|
||||||
import io.github.norbipeti.chat.server.db.domain.Conversation;
|
import io.github.norbipeti.chat.server.db.domain.Conversation;
|
||||||
import io.github.norbipeti.chat.server.db.domain.Message;
|
import io.github.norbipeti.chat.server.db.domain.Message;
|
||||||
import io.github.norbipeti.chat.server.db.domain.User;
|
import io.github.norbipeti.chat.server.db.domain.User;
|
||||||
|
|
||||||
public class IndexPage extends Page {
|
public class IndexPage extends Page {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handlePage(HttpExchange exchange) throws IOException {
|
public void handlePage(HttpExchange exchange) throws IOException {
|
||||||
// final User user = IOHelper.GetLoggedInUser(exchange); - TODO
|
// final User user = IOHelper.GetLoggedInUser(exchange); - TODO
|
||||||
final User user = new User();
|
final User user = new User();
|
||||||
user.setEmail("test@test.com");
|
user.setEmail("test@test.com");
|
||||||
user.setName("Norbi");
|
user.setName("Norbi");
|
||||||
user.setId(3L);
|
user.setId(3L);
|
||||||
if (user == null)
|
if (user == null)
|
||||||
IOHelper.SendModifiedPage(200, this, (doc) -> {
|
IOHelper.SendModifiedPage(200, this, (doc) -> {
|
||||||
doc.getElementById("userbox").remove();
|
doc.getElementById("userbox").remove();
|
||||||
doc.getElementById("usercontent").remove();
|
doc.getElementById("usercontent").remove();
|
||||||
return doc;
|
return doc;
|
||||||
}, exchange);
|
}, exchange);
|
||||||
else
|
else
|
||||||
IOHelper.SendModifiedPage(200, this, (doc) -> {
|
IOHelper.SendModifiedPage(200, this, (doc) -> {
|
||||||
doc.getElementById("loginbox").remove();
|
doc.getElementById("loginbox").remove();
|
||||||
doc.getElementById("registerbox").remove();
|
doc.getElementById("registerbox").remove();
|
||||||
Element userbox = doc.getElementById("userbox");
|
Element userbox = doc.getElementById("userbox");
|
||||||
userbox.html(userbox.html().replace("<username />", user.getName()));
|
userbox.html(userbox.html().replace("<username />", user.getName()));
|
||||||
Element channelmessages = doc.getElementById("channelmessages");
|
Element channelmessages = doc.getElementById("channelmessages");
|
||||||
try (DataProvider provider = new DataProvider()) {
|
try (DataProvider provider = new DataProvider()) {
|
||||||
Conversation convo = provider.getConversations().get(0); //TODO
|
Conversation convo = provider.getConversations().get(0); //TODO
|
||||||
for (Message message : convo.getMesssages()) {
|
for (Message message : convo.getMesssages()) {
|
||||||
Element msgelement = channelmessages.appendElement("div");
|
Element msgelement = channelmessages.appendElement("div");
|
||||||
Element header = msgelement.appendElement("p");
|
Element header = msgelement.appendElement("p");
|
||||||
header.text(message.getSender().getName() + " - " + message.getTime());
|
header.text(message.getSender().getName() + " - " + message.getTime());
|
||||||
Element body = msgelement.appendElement("p");
|
Element body = msgelement.appendElement("p");
|
||||||
body.text(message.getMessage());
|
body.text(message.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return doc;
|
return doc;
|
||||||
}, exchange);
|
}, exchange);
|
||||||
} // TODO:
|
} // TODO:
|
||||||
// Validation
|
// Validation
|
||||||
// at
|
// at
|
||||||
// registration
|
// registration
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String GetName() {
|
public String GetName() {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,49 +1,49 @@
|
||||||
package io.github.norbipeti.chat.server.page;
|
package io.github.norbipeti.chat.server.page;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.mindrot.jbcrypt.BCrypt;
|
import org.mindrot.jbcrypt.BCrypt;
|
||||||
|
|
||||||
import com.sun.net.httpserver.HttpExchange;
|
import com.sun.net.httpserver.HttpExchange;
|
||||||
|
|
||||||
import io.github.norbipeti.chat.server.IOHelper;
|
import io.github.norbipeti.chat.server.IOHelper;
|
||||||
import io.github.norbipeti.chat.server.db.DataProvider;
|
import io.github.norbipeti.chat.server.db.DataProvider;
|
||||||
import io.github.norbipeti.chat.server.db.domain.User;
|
import io.github.norbipeti.chat.server.db.domain.User;
|
||||||
|
|
||||||
public class LoginPage extends Page {
|
public class LoginPage extends Page {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handlePage(HttpExchange exchange) throws IOException {
|
public void handlePage(HttpExchange exchange) throws IOException {
|
||||||
JSONObject post = IOHelper.GetPOSTJSON(exchange);
|
JSONObject post = IOHelper.GetPOSTJSON(exchange);
|
||||||
if (post == null || !post.has("email") || !post.has("pass")) {
|
if (post == null || !post.has("email") || !post.has("pass")) {
|
||||||
IOHelper.Redirect("/", exchange);
|
IOHelper.Redirect("/", exchange);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try (DataProvider provider = new DataProvider()) {
|
try (DataProvider provider = new DataProvider()) {
|
||||||
User loginuser = null;
|
User loginuser = null;
|
||||||
for (User user : provider.getUsers()) {
|
for (User user : provider.getUsers()) {
|
||||||
if (user.getEmail().equals(post.get("email"))) {
|
if (user.getEmail().equals(post.get("email"))) {
|
||||||
loginuser = user;
|
loginuser = user;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (loginuser == null || !BCrypt.checkpw(post.getString("pass"), loginuser.getPassword())) {
|
if (loginuser == null || !BCrypt.checkpw(post.getString("pass"), loginuser.getPassword())) {
|
||||||
IOHelper.SendResponse(200, (doc) -> {
|
IOHelper.SendResponse(200, (doc) -> {
|
||||||
doc.appendElement("p").text("The username or password is invalid.");
|
doc.appendElement("p").text("The username or password is invalid.");
|
||||||
return doc;
|
return doc;
|
||||||
}, exchange);
|
}, exchange);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
IOHelper.LoginUser(exchange, loginuser, provider);
|
IOHelper.LoginUser(exchange, loginuser, provider);
|
||||||
IOHelper.SendResponse(200, "Success", exchange);
|
IOHelper.SendResponse(200, "Success", exchange);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String GetName() {
|
public String GetName() {
|
||||||
return "login";
|
return "login";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
package io.github.norbipeti.chat.server.page;
|
package io.github.norbipeti.chat.server.page;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import com.sun.net.httpserver.HttpExchange;
|
import com.sun.net.httpserver.HttpExchange;
|
||||||
|
|
||||||
public class MessageAjaxPage extends Page {
|
public class MessageAjaxPage extends Page {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String GetName() {
|
public String GetName() {
|
||||||
return "message";
|
return "message";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handlePage(HttpExchange exchange) throws IOException {
|
public void handlePage(HttpExchange exchange) throws IOException {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,28 +1,28 @@
|
||||||
package io.github.norbipeti.chat.server.page;
|
package io.github.norbipeti.chat.server.page;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import com.sun.net.httpserver.HttpExchange;
|
import com.sun.net.httpserver.HttpExchange;
|
||||||
|
|
||||||
import io.github.norbipeti.chat.server.IOHelper;
|
import io.github.norbipeti.chat.server.IOHelper;
|
||||||
|
|
||||||
public class NotFoundPage extends Page {
|
public class NotFoundPage extends Page {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String GetName() {
|
public String GetName() {
|
||||||
return "notfound";
|
return "notfound";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handlePage(HttpExchange exchange) throws IOException {
|
public void handlePage(HttpExchange exchange) throws IOException {
|
||||||
IOHelper.SendPage(404, this, exchange);
|
IOHelper.SendPage(404, this, exchange);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NotFoundPage() {
|
public NotFoundPage() {
|
||||||
if (Instance != null)
|
if (Instance != null)
|
||||||
throw new UnsupportedOperationException("There can only be one instance of a page.");
|
throw new UnsupportedOperationException("There can only be one instance of a page.");
|
||||||
Instance = this;
|
Instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static NotFoundPage Instance;
|
public static NotFoundPage Instance;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,55 +1,55 @@
|
||||||
package io.github.norbipeti.chat.server.page;
|
package io.github.norbipeti.chat.server.page;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
import org.apache.commons.io.output.ByteArrayOutputStream;
|
import org.apache.commons.io.output.ByteArrayOutputStream;
|
||||||
|
|
||||||
import com.sun.net.httpserver.*;
|
import com.sun.net.httpserver.*;
|
||||||
|
|
||||||
import io.github.norbipeti.chat.server.IOHelper;
|
import io.github.norbipeti.chat.server.IOHelper;
|
||||||
import io.github.norbipeti.chat.server.Main;
|
import io.github.norbipeti.chat.server.Main;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add to {@link Main}.Pages
|
* Add to {@link Main}.Pages
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class Page implements HttpHandler {
|
public abstract class Page implements HttpHandler {
|
||||||
public abstract String GetName();
|
public abstract String GetName();
|
||||||
|
|
||||||
public final String GetHTMLPath() {
|
public final String GetHTMLPath() {
|
||||||
if (GetName().length() == 0)
|
if (GetName().length() == 0)
|
||||||
return "pages/index.html";
|
return "pages/index.html";
|
||||||
return new StringBuilder("pages/").append(GetName()).append(".html").toString();
|
return new StringBuilder("pages/").append(GetName()).append(".html").toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handle(HttpExchange exchange) {
|
public void handle(HttpExchange exchange) {
|
||||||
try {
|
try {
|
||||||
if (!getDo404() || exchange.getRequestURI().getPath().equals("/" + GetName()))
|
if (!getDo404() || exchange.getRequestURI().getPath().equals("/" + GetName()))
|
||||||
handlePage(exchange);
|
handlePage(exchange);
|
||||||
else {
|
else {
|
||||||
IOHelper.SendPage(404, NotFoundPage.Instance, exchange);
|
IOHelper.SendPage(404, NotFoundPage.Instance, exchange);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
try {
|
try {
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
PrintStream str = new PrintStream(baos);
|
PrintStream str = new PrintStream(baos);
|
||||||
str.print("<h1>500 Internal Server Error</h1><pre>");
|
str.print("<h1>500 Internal Server Error</h1><pre>");
|
||||||
e.printStackTrace(str);
|
e.printStackTrace(str);
|
||||||
str.print("</pre>");
|
str.print("</pre>");
|
||||||
IOHelper.SendResponse(500, baos.toString(StandardCharsets.ISO_8859_1), exchange);
|
IOHelper.SendResponse(500, baos.toString(StandardCharsets.ISO_8859_1), exchange);
|
||||||
} catch (Exception e1) {
|
} catch (Exception e1) {
|
||||||
e1.printStackTrace();
|
e1.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void handlePage(HttpExchange exchange) throws IOException;
|
public abstract void handlePage(HttpExchange exchange) throws IOException;
|
||||||
|
|
||||||
public boolean getDo404() {
|
public boolean getDo404() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,72 +1,72 @@
|
||||||
package io.github.norbipeti.chat.server.page;
|
package io.github.norbipeti.chat.server.page;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.mindrot.jbcrypt.BCrypt;
|
import org.mindrot.jbcrypt.BCrypt;
|
||||||
|
|
||||||
import com.sun.net.httpserver.HttpExchange;
|
import com.sun.net.httpserver.HttpExchange;
|
||||||
|
|
||||||
import io.github.norbipeti.chat.server.IOHelper;
|
import io.github.norbipeti.chat.server.IOHelper;
|
||||||
import io.github.norbipeti.chat.server.db.DataProvider;
|
import io.github.norbipeti.chat.server.db.DataProvider;
|
||||||
import io.github.norbipeti.chat.server.db.domain.User;
|
import io.github.norbipeti.chat.server.db.domain.User;
|
||||||
|
|
||||||
public class RegisterPage extends Page {
|
public class RegisterPage extends Page {
|
||||||
@Override
|
@Override
|
||||||
public void handlePage(HttpExchange exchange) throws IOException {
|
public void handlePage(HttpExchange exchange) throws IOException {
|
||||||
JSONObject post = IOHelper.GetPOSTJSON(exchange);
|
JSONObject post = IOHelper.GetPOSTJSON(exchange);
|
||||||
if (post != null) {
|
if (post != null) {
|
||||||
String errormsg = CheckValues(post, "name", "email", "pass", "pass2");
|
String errormsg = CheckValues(post, "name", "email", "pass", "pass2");
|
||||||
if (errormsg.length() > 0) {
|
if (errormsg.length() > 0) {
|
||||||
final String msg = errormsg;
|
final String msg = errormsg;
|
||||||
IOHelper.SendResponse(200, (doc) -> doc.html(msg).ownerDocument(), exchange);
|
IOHelper.SendResponse(200, (doc) -> doc.html(msg).ownerDocument(), exchange);
|
||||||
return; // TODO: Use JavaScript too, for error checks
|
return; // TODO: Use JavaScript too, for error checks
|
||||||
}
|
}
|
||||||
try (DataProvider provider = new DataProvider()) {
|
try (DataProvider provider = new DataProvider()) {
|
||||||
for (User user : provider.getUsers()) {
|
for (User user : provider.getUsers()) {
|
||||||
if (post.get("email").equals(user.getEmail())) {
|
if (post.get("email").equals(user.getEmail())) {
|
||||||
errormsg += "<p>An user with this name already exists</p>";
|
errormsg += "<p>An user with this name already exists</p>";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!post.get("pass").equals(post.get("pass2")))
|
if (!post.get("pass").equals(post.get("pass2")))
|
||||||
errormsg += "<p>The passwords don't match</p>";
|
errormsg += "<p>The passwords don't match</p>";
|
||||||
if (errormsg.length() > 0) {
|
if (errormsg.length() > 0) {
|
||||||
final String msg = errormsg;
|
final String msg = errormsg;
|
||||||
IOHelper.SendResponse(200, (doc) -> doc.html(msg).ownerDocument(), exchange);
|
IOHelper.SendResponse(200, (doc) -> doc.html(msg).ownerDocument(), exchange);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
User user = new User();
|
User user = new User();
|
||||||
user.setName(post.getString("name"));
|
user.setName(post.getString("name"));
|
||||||
user.setEmail(post.getString("email"));
|
user.setEmail(post.getString("email"));
|
||||||
user.setSalt(BCrypt.gensalt()); // http://www.mindrot.org/projects/jBCrypt/
|
user.setSalt(BCrypt.gensalt()); // http://www.mindrot.org/projects/jBCrypt/
|
||||||
user.setPassword(BCrypt.hashpw(post.getString("pass"), user.getSalt()));
|
user.setPassword(BCrypt.hashpw(post.getString("pass"), user.getSalt()));
|
||||||
provider.addUser(user);
|
provider.addUser(user);
|
||||||
User managedUser = provider.getUser(user.getId());
|
User managedUser = provider.getUser(user.getId());
|
||||||
IOHelper.LoginUser(exchange, managedUser, provider);
|
IOHelper.LoginUser(exchange, managedUser, provider);
|
||||||
IOHelper.SendResponse(200, "Success", exchange);
|
IOHelper.SendResponse(200, "Success", exchange);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
IOHelper.Redirect("/", exchange);
|
IOHelper.Redirect("/", exchange);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String CheckValues(JSONObject post, String... values) {
|
private String CheckValues(JSONObject post, String... values) {
|
||||||
String errormsg = "";
|
String errormsg = "";
|
||||||
for (String value : values)
|
for (String value : values)
|
||||||
if (!CheckValue(post.getString(value)))
|
if (!CheckValue(post.getString(value)))
|
||||||
errormsg += "<p>" + value + " can't be empty</p>";
|
errormsg += "<p>" + value + " can't be empty</p>";
|
||||||
return errormsg;
|
return errormsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean CheckValue(String val) {
|
private boolean CheckValue(String val) {
|
||||||
return val != null && val.length() > 0;
|
return val != null && val.length() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String GetName() {
|
public String GetName() {
|
||||||
return "register";
|
return "register";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,34 +1,34 @@
|
||||||
package io.github.norbipeti.chat.server.page;
|
package io.github.norbipeti.chat.server.page;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import com.sun.net.httpserver.HttpExchange;
|
import com.sun.net.httpserver.HttpExchange;
|
||||||
|
|
||||||
import io.github.norbipeti.chat.server.IOHelper;
|
import io.github.norbipeti.chat.server.IOHelper;
|
||||||
|
|
||||||
public class ScriptsPage extends Page {
|
public class ScriptsPage extends Page {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getDo404() {
|
public boolean getDo404() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String GetName() {
|
public String GetName() {
|
||||||
return "js/";
|
return "js/";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handlePage(HttpExchange exchange) throws IOException {
|
public void handlePage(HttpExchange exchange) throws IOException {
|
||||||
if (exchange.getRequestURI().getPath().startsWith("/js/")) {
|
if (exchange.getRequestURI().getPath().startsWith("/js/")) {
|
||||||
File jsfile = new File("pages", exchange.getRequestURI().getPath());
|
File jsfile = new File("pages", exchange.getRequestURI().getPath());
|
||||||
if (!jsfile.exists())
|
if (!jsfile.exists())
|
||||||
IOHelper.SendResponse(404, "<h1>JavaScript file not found</h1>", exchange);
|
IOHelper.SendResponse(404, "<h1>JavaScript file not found</h1>", exchange);
|
||||||
else
|
else
|
||||||
IOHelper.SendResponse(200, IOHelper.ReadFile(jsfile), exchange);
|
IOHelper.SendResponse(200, IOHelper.ReadFile(jsfile), exchange);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
System.out.println(exchange.getRequestURI().getPath());
|
System.out.println(exchange.getRequestURI().getPath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,35 +1,35 @@
|
||||||
package io.github.norbipeti.chat.server.page;
|
package io.github.norbipeti.chat.server.page;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import com.sun.net.httpserver.HttpExchange;
|
import com.sun.net.httpserver.HttpExchange;
|
||||||
|
|
||||||
import io.github.norbipeti.chat.server.IOHelper;
|
import io.github.norbipeti.chat.server.IOHelper;
|
||||||
|
|
||||||
public class StylePage extends Page {
|
public class StylePage extends Page {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getDo404() {
|
public boolean getDo404() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String GetName() {
|
public String GetName() {
|
||||||
return "css/";
|
return "css/";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handlePage(HttpExchange exchange) throws IOException {
|
public void handlePage(HttpExchange exchange) throws IOException {
|
||||||
if (exchange.getRequestURI().getPath().startsWith("/css/")) {
|
if (exchange.getRequestURI().getPath().startsWith("/css/")) {
|
||||||
File cssfile = new File("pages", exchange.getRequestURI().getPath());
|
File cssfile = new File("pages", exchange.getRequestURI().getPath());
|
||||||
if (!cssfile.exists())
|
if (!cssfile.exists())
|
||||||
IOHelper.SendResponse(404, "<h1>CSS file not found</h1>", exchange);
|
IOHelper.SendResponse(404, "<h1>CSS file not found</h1>", exchange);
|
||||||
else {
|
else {
|
||||||
exchange.getResponseHeaders().add("Content-Type", "text/css");
|
exchange.getResponseHeaders().add("Content-Type", "text/css");
|
||||||
IOHelper.SendResponse(200, IOHelper.ReadFile(cssfile), exchange);
|
IOHelper.SendResponse(200, IOHelper.ReadFile(cssfile), exchange);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
System.out.println(exchange.getRequestURI().getPath());
|
System.out.println(exchange.getRequestURI().getPath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue