summaryrefslogtreecommitdiff
path: root/app/v2_java
diff options
context:
space:
mode:
Diffstat (limited to 'app/v2_java')
-rw-r--r--app/v2_java/.classpath21
-rw-r--r--app/v2_java/.pmd941
-rw-r--r--app/v2_java/.project36
-rw-r--r--app/v2_java/.settings/.jsdtscope11
-rw-r--r--app/v2_java/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--app/v2_java/.settings/org.eclipse.wst.common.component9
-rw-r--r--app/v2_java/.settings/org.eclipse.wst.common.project.facet.core.xml7
-rw-r--r--app/v2_java/.settings/org.eclipse.wst.jsdt.ui.superType.container1
-rw-r--r--app/v2_java/.settings/org.eclipse.wst.jsdt.ui.superType.name1
-rw-r--r--app/v2_java/WebContent/META-INF/MANIFEST.MF3
-rw-r--r--app/v2_java/WebContent/WEB-INF/web.xml31
-rw-r--r--app/v2_java/WebContent/game.html22
-rw-r--r--app/v2_java/WebContent/index.html10
-rw-r--r--app/v2_java/WebContent/login.html20
-rw-r--r--app/v2_java/WebContent/user.html28
-rw-r--r--app/v2_java/src/org/usi2011/Database.java73
-rw-r--r--app/v2_java/src/org/usi2011/Question.java67
-rw-r--r--app/v2_java/src/org/usi2011/User.java56
18 files changed, 1344 insertions, 0 deletions
diff --git a/app/v2_java/.classpath b/app/v2_java/.classpath
new file mode 100644
index 0000000..7eda24b
--- /dev/null
+++ b/app/v2_java/.classpath
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0_17">
+ <attributes>
+ <attribute name="owner.project.facets" value="jst.java"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
+ <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
+ <classpathentry kind="lib" path="E:/maven2/repository/javaee/javaee-api/5/javaee-api-5.jar">
+ <attributes>
+ <attribute name="maven.groupId" value="javaee"/>
+ <attribute name="maven.artifactId" value="javaee-api"/>
+ <attribute name="maven.version" value="5"/>
+ <attribute name="maven.scope" value="provided"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry exported="true" kind="lib" path="E:/download/hsqldb.jar"/>
+ <classpathentry kind="output" path="build/classes"/>
+</classpath>
diff --git a/app/v2_java/.pmd b/app/v2_java/.pmd
new file mode 100644
index 0000000..726c68f
--- /dev/null
+++ b/app/v2_java/.pmd
@@ -0,0 +1,941 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<pmd>
+ <useProjectRuleSet>false</useProjectRuleSet>
+ <ruleSetFile>.ruleset</ruleSetFile>
+ <rules>
+ <rule>
+ <name>AvoidDecimalLiteralsInBigDecimalConstructor</name>
+ <ruleset>Basic Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AvoidMultipleUnaryOperators</name>
+ <ruleset>Basic Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AvoidThreadGroup</name>
+ <ruleset>Basic Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AvoidUsingHardCodedIP</name>
+ <ruleset>Basic Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AvoidUsingOctalValues</name>
+ <ruleset>Basic Rules</ruleset>
+ </rule>
+ <rule>
+ <name>BigIntegerInstantiation</name>
+ <ruleset>Basic Rules</ruleset>
+ </rule>
+ <rule>
+ <name>BooleanInstantiation</name>
+ <ruleset>Basic Rules</ruleset>
+ </rule>
+ <rule>
+ <name>BrokenNullCheck</name>
+ <ruleset>Basic Rules</ruleset>
+ </rule>
+ <rule>
+ <name>CheckResultSet</name>
+ <ruleset>Basic Rules</ruleset>
+ </rule>
+ <rule>
+ <name>ClassCastExceptionWithToArray</name>
+ <ruleset>Basic Rules</ruleset>
+ </rule>
+ <rule>
+ <name>CollapsibleIfStatements</name>
+ <ruleset>Basic Rules</ruleset>
+ </rule>
+ <rule>
+ <name>DoubleCheckedLocking</name>
+ <ruleset>Basic Rules</ruleset>
+ </rule>
+ <rule>
+ <name>EmptyCatchBlock</name>
+ <ruleset>Basic Rules</ruleset>
+ </rule>
+ <rule>
+ <name>EmptyFinallyBlock</name>
+ <ruleset>Basic Rules</ruleset>
+ </rule>
+ <rule>
+ <name>EmptyIfStmt</name>
+ <ruleset>Basic Rules</ruleset>
+ </rule>
+ <rule>
+ <name>EmptyInitializer</name>
+ <ruleset>Basic Rules</ruleset>
+ </rule>
+ <rule>
+ <name>EmptyStatementNotInLoop</name>
+ <ruleset>Basic Rules</ruleset>
+ </rule>
+ <rule>
+ <name>EmptyStaticInitializer</name>
+ <ruleset>Basic Rules</ruleset>
+ </rule>
+ <rule>
+ <name>EmptySwitchStatements</name>
+ <ruleset>Basic Rules</ruleset>
+ </rule>
+ <rule>
+ <name>EmptySynchronizedBlock</name>
+ <ruleset>Basic Rules</ruleset>
+ </rule>
+ <rule>
+ <name>EmptyTryBlock</name>
+ <ruleset>Basic Rules</ruleset>
+ </rule>
+ <rule>
+ <name>EmptyWhileStmt</name>
+ <ruleset>Basic Rules</ruleset>
+ </rule>
+ <rule>
+ <name>ForLoopShouldBeWhileLoop</name>
+ <ruleset>Basic Rules</ruleset>
+ </rule>
+ <rule>
+ <name>JumbledIncrementer</name>
+ <ruleset>Basic Rules</ruleset>
+ </rule>
+ <rule>
+ <name>MisplacedNullCheck</name>
+ <ruleset>Basic Rules</ruleset>
+ </rule>
+ <rule>
+ <name>OverrideBothEqualsAndHashcode</name>
+ <ruleset>Basic Rules</ruleset>
+ </rule>
+ <rule>
+ <name>ReturnFromFinallyBlock</name>
+ <ruleset>Basic Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UnconditionalIfStatement</name>
+ <ruleset>Basic Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UnnecessaryConversionTemporary</name>
+ <ruleset>Basic Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UnnecessaryFinalModifier</name>
+ <ruleset>Basic Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UnnecessaryReturn</name>
+ <ruleset>Basic Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UnusedNullCheckInEquals</name>
+ <ruleset>Basic Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UselessOperationOnImmutable</name>
+ <ruleset>Basic Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UselessOverridingMethod</name>
+ <ruleset>Basic Rules</ruleset>
+ </rule>
+ <rule>
+ <name>ForLoopsMustUseBraces</name>
+ <ruleset>Braces Rules</ruleset>
+ </rule>
+ <rule>
+ <name>IfElseStmtsMustUseBraces</name>
+ <ruleset>Braces Rules</ruleset>
+ </rule>
+ <rule>
+ <name>IfStmtsMustUseBraces</name>
+ <ruleset>Braces Rules</ruleset>
+ </rule>
+ <rule>
+ <name>WhileLoopsMustUseBraces</name>
+ <ruleset>Braces Rules</ruleset>
+ </rule>
+ <rule>
+ <name>CloneThrowsCloneNotSupportedException</name>
+ <ruleset>Clone Implementation Rules</ruleset>
+ </rule>
+ <rule>
+ <name>ProperCloneImplementation</name>
+ <ruleset>Clone Implementation Rules</ruleset>
+ </rule>
+ <rule>
+ <name>CyclomaticComplexity</name>
+ <ruleset>Code Size Rules</ruleset>
+ </rule>
+ <rule>
+ <name>ExcessiveClassLength</name>
+ <ruleset>Code Size Rules</ruleset>
+ </rule>
+ <rule>
+ <name>ExcessiveMethodLength</name>
+ <ruleset>Code Size Rules</ruleset>
+ </rule>
+ <rule>
+ <name>ExcessiveParameterList</name>
+ <ruleset>Code Size Rules</ruleset>
+ </rule>
+ <rule>
+ <name>ExcessivePublicCount</name>
+ <ruleset>Code Size Rules</ruleset>
+ </rule>
+ <rule>
+ <name>NcssConstructorCount</name>
+ <ruleset>Code Size Rules</ruleset>
+ </rule>
+ <rule>
+ <name>NcssMethodCount</name>
+ <ruleset>Code Size Rules</ruleset>
+ </rule>
+ <rule>
+ <name>NcssTypeCount</name>
+ <ruleset>Code Size Rules</ruleset>
+ </rule>
+ <rule>
+ <name>NPathComplexity</name>
+ <ruleset>Code Size Rules</ruleset>
+ </rule>
+ <rule>
+ <name>TooManyFields</name>
+ <ruleset>Code Size Rules</ruleset>
+ </rule>
+ <rule>
+ <name>TooManyMethods</name>
+ <ruleset>Code Size Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AssignmentInOperand</name>
+ <ruleset>Controversial Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AtLeastOneConstructor</name>
+ <ruleset>Controversial Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AvoidAccessibilityAlteration</name>
+ <ruleset>Controversial Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AvoidFinalLocalVariable</name>
+ <ruleset>Controversial Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AvoidUsingNativeCode</name>
+ <ruleset>Controversial Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AvoidUsingShortType</name>
+ <ruleset>Controversial Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AvoidUsingVolatile</name>
+ <ruleset>Controversial Rules</ruleset>
+ </rule>
+ <rule>
+ <name>BooleanInversion</name>
+ <ruleset>Controversial Rules</ruleset>
+ </rule>
+ <rule>
+ <name>CallSuperInConstructor</name>
+ <ruleset>Controversial Rules</ruleset>
+ </rule>
+ <rule>
+ <name>DataflowAnomalyAnalysis</name>
+ <ruleset>Controversial Rules</ruleset>
+ </rule>
+ <rule>
+ <name>DefaultPackage</name>
+ <ruleset>Controversial Rules</ruleset>
+ </rule>
+ <rule>
+ <name>DoNotCallGarbageCollectionExplicitly</name>
+ <ruleset>Controversial Rules</ruleset>
+ </rule>
+ <rule>
+ <name>DontImportSun</name>
+ <ruleset>Controversial Rules</ruleset>
+ </rule>
+ <rule>
+ <name>NullAssignment</name>
+ <ruleset>Controversial Rules</ruleset>
+ </rule>
+ <rule>
+ <name>OnlyOneReturn</name>
+ <ruleset>Controversial Rules</ruleset>
+ </rule>
+ <rule>
+ <name>SuspiciousOctalEscape</name>
+ <ruleset>Controversial Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UnnecessaryConstructor</name>
+ <ruleset>Controversial Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UnnecessaryParentheses</name>
+ <ruleset>Controversial Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UnusedModifier</name>
+ <ruleset>Controversial Rules</ruleset>
+ </rule>
+ <rule>
+ <name>CouplingBetweenObjects</name>
+ <ruleset>Coupling Rules</ruleset>
+ </rule>
+ <rule>
+ <name>ExcessiveImports</name>
+ <ruleset>Coupling Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AbstractClassWithoutAbstractMethod</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AbstractClassWithoutAnyMethod</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AccessorClassGeneration</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AssignmentToNonFinalStatic</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AvoidConstantsInterface</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AvoidDeeplyNestedIfStmts</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AvoidInstanceofChecksInCatchClause</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AvoidProtectedFieldInFinalClass</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AvoidReassigningParameters</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AvoidSynchronizedAtMethodLevel</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>BadComparison</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>ClassWithOnlyPrivateConstructorsShouldBeFinal</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>CloseResource</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>CompareObjectsWithEquals</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>ConfusingTernary</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>ConstructorCallsOverridableMethod</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>DefaultLabelNotLastInSwitchStmt</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>EmptyMethodInAbstractClassShouldBeAbstract</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>EqualsNull</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>FinalFieldCouldBeStatic</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>IdempotentOperations</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>ImmutableField</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>InstantiationToGetClass</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>MissingBreakInSwitch</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>MissingStaticMethodInNonInstantiatableClass</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>NonCaseLabelInSwitchStatement</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>NonStaticInitializer</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>NonThreadSafeSingleton</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>OptimizableToArrayCall</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>PositionLiteralsFirstInComparisons</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>PreserveStackTrace</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>ReturnEmptyArrayRatherThanNull</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>SimpleDateFormatNeedsLocale</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>SimplifyBooleanExpressions</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>SimplifyBooleanReturns</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>SimplifyConditional</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>SingularField</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>SwitchDensity</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>SwitchStmtsShouldHaveDefault</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>TooFewBranchesForASwitchStatement</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UncommentedEmptyConstructor</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UncommentedEmptyMethod</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UnnecessaryLocalBeforeReturn</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UnsynchronizedStaticDateFormatter</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UseCollectionIsEmpty</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UseLocaleWithCaseConversions</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UseNotifyAllInsteadOfNotify</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UseSingleton</name>
+ <ruleset>Design Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AvoidCallingFinalize</name>
+ <ruleset>Finalizer Rules</ruleset>
+ </rule>
+ <rule>
+ <name>EmptyFinalizer</name>
+ <ruleset>Finalizer Rules</ruleset>
+ </rule>
+ <rule>
+ <name>FinalizeDoesNotCallSuperFinalize</name>
+ <ruleset>Finalizer Rules</ruleset>
+ </rule>
+ <rule>
+ <name>FinalizeOnlyCallsSuperFinalize</name>
+ <ruleset>Finalizer Rules</ruleset>
+ </rule>
+ <rule>
+ <name>FinalizeOverloaded</name>
+ <ruleset>Finalizer Rules</ruleset>
+ </rule>
+ <rule>
+ <name>FinalizeShouldBeProtected</name>
+ <ruleset>Finalizer Rules</ruleset>
+ </rule>
+ <rule>
+ <name>DontImportJavaLang</name>
+ <ruleset>Import Statement Rules</ruleset>
+ </rule>
+ <rule>
+ <name>DuplicateImports</name>
+ <ruleset>Import Statement Rules</ruleset>
+ </rule>
+ <rule>
+ <name>ImportFromSamePackage</name>
+ <ruleset>Import Statement Rules</ruleset>
+ </rule>
+ <rule>
+ <name>TooManyStaticImports</name>
+ <ruleset>Import Statement Rules</ruleset>
+ </rule>
+ <rule>
+ <name>DoNotCallSystemExit</name>
+ <ruleset>J2EE Rules</ruleset>
+ </rule>
+ <rule>
+ <name>DoNotUseThreads</name>
+ <ruleset>J2EE Rules</ruleset>
+ </rule>
+ <rule>
+ <name>LocalHomeNamingConvention</name>
+ <ruleset>J2EE Rules</ruleset>
+ </rule>
+ <rule>
+ <name>LocalInterfaceSessionNamingConvention</name>
+ <ruleset>J2EE Rules</ruleset>
+ </rule>
+ <rule>
+ <name>MDBAndSessionBeanNamingConvention</name>
+ <ruleset>J2EE Rules</ruleset>
+ </rule>
+ <rule>
+ <name>RemoteInterfaceNamingConvention</name>
+ <ruleset>J2EE Rules</ruleset>
+ </rule>
+ <rule>
+ <name>RemoteSessionInterfaceNamingConvention</name>
+ <ruleset>J2EE Rules</ruleset>
+ </rule>
+ <rule>
+ <name>StaticEJBFieldShouldBeFinal</name>
+ <ruleset>J2EE Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UseProperClassLoader</name>
+ <ruleset>J2EE Rules</ruleset>
+ </rule>
+ <rule>
+ <name>ProperLogger</name>
+ <ruleset>Jakarta Commons Logging Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UseCorrectExceptionLogging</name>
+ <ruleset>Jakarta Commons Logging Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AvoidPrintStackTrace</name>
+ <ruleset>Java Logging Rules</ruleset>
+ </rule>
+ <rule>
+ <name>LoggerIsNotStaticFinal</name>
+ <ruleset>Java Logging Rules</ruleset>
+ </rule>
+ <rule>
+ <name>MoreThanOneLogger</name>
+ <ruleset>Java Logging Rules</ruleset>
+ </rule>
+ <rule>
+ <name>SystemPrintln</name>
+ <ruleset>Java Logging Rules</ruleset>
+ </rule>
+ <rule>
+ <name>BeanMembersShouldSerialize</name>
+ <ruleset>JavaBean Rules</ruleset>
+ </rule>
+ <rule>
+ <name>MissingSerialVersionUID</name>
+ <ruleset>JavaBean Rules</ruleset>
+ </rule>
+ <rule>
+ <name>JUnitAssertionsShouldIncludeMessage</name>
+ <ruleset>JUnit Rules</ruleset>
+ </rule>
+ <rule>
+ <name>JUnitSpelling</name>
+ <ruleset>JUnit Rules</ruleset>
+ </rule>
+ <rule>
+ <name>JUnitStaticSuite</name>
+ <ruleset>JUnit Rules</ruleset>
+ </rule>
+ <rule>
+ <name>JUnitTestsShouldIncludeAssert</name>
+ <ruleset>JUnit Rules</ruleset>
+ </rule>
+ <rule>
+ <name>SimplifyBooleanAssertion</name>
+ <ruleset>JUnit Rules</ruleset>
+ </rule>
+ <rule>
+ <name>TestClassWithoutTestCases</name>
+ <ruleset>JUnit Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UnnecessaryBooleanAssertion</name>
+ <ruleset>JUnit Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UseAssertEqualsInsteadOfAssertTrue</name>
+ <ruleset>JUnit Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UseAssertNullInsteadOfAssertTrue</name>
+ <ruleset>JUnit Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UseAssertSameInsteadOfAssertTrue</name>
+ <ruleset>JUnit Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AvoidAssertAsIdentifier</name>
+ <ruleset>Migration Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AvoidEnumAsIdentifier</name>
+ <ruleset>Migration Rules</ruleset>
+ </rule>
+ <rule>
+ <name>ByteInstantiation</name>
+ <ruleset>Migration Rules</ruleset>
+ </rule>
+ <rule>
+ <name>IntegerInstantiation</name>
+ <ruleset>Migration Rules</ruleset>
+ </rule>
+ <rule>
+ <name>JUnit4SuitesShouldUseSuiteAnnotation</name>
+ <ruleset>Migration Rules</ruleset>
+ </rule>
+ <rule>
+ <name>JUnit4TestShouldUseAfterAnnotation</name>
+ <ruleset>Migration Rules</ruleset>
+ </rule>
+ <rule>
+ <name>JUnit4TestShouldUseBeforeAnnotation</name>
+ <ruleset>Migration Rules</ruleset>
+ </rule>
+ <rule>
+ <name>JUnit4TestShouldUseTestAnnotation</name>
+ <ruleset>Migration Rules</ruleset>
+ </rule>
+ <rule>
+ <name>JUnitUseExpected</name>
+ <ruleset>Migration Rules</ruleset>
+ </rule>
+ <rule>
+ <name>LongInstantiation</name>
+ <ruleset>Migration Rules</ruleset>
+ </rule>
+ <rule>
+ <name>ReplaceEnumerationWithIterator</name>
+ <ruleset>Migration Rules</ruleset>
+ </rule>
+ <rule>
+ <name>ReplaceHashtableWithMap</name>
+ <ruleset>Migration Rules</ruleset>
+ </rule>
+ <rule>
+ <name>ReplaceVectorWithList</name>
+ <ruleset>Migration Rules</ruleset>
+ </rule>
+ <rule>
+ <name>ShortInstantiation</name>
+ <ruleset>Migration Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AbstractNaming</name>
+ <ruleset>Naming Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AvoidDollarSigns</name>
+ <ruleset>Naming Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AvoidFieldNameMatchingMethodName</name>
+ <ruleset>Naming Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AvoidFieldNameMatchingTypeName</name>
+ <ruleset>Naming Rules</ruleset>
+ </rule>
+ <rule>
+ <name>BooleanGetMethodName</name>
+ <ruleset>Naming Rules</ruleset>
+ </rule>
+ <rule>
+ <name>ClassNamingConventions</name>
+ <ruleset>Naming Rules</ruleset>
+ </rule>
+ <rule>
+ <name>LongVariable</name>
+ <ruleset>Naming Rules</ruleset>
+ </rule>
+ <rule>
+ <name>MethodNamingConventions</name>
+ <ruleset>Naming Rules</ruleset>
+ </rule>
+ <rule>
+ <name>MethodWithSameNameAsEnclosingClass</name>
+ <ruleset>Naming Rules</ruleset>
+ </rule>
+ <rule>
+ <name>MisleadingVariableName</name>
+ <ruleset>Naming Rules</ruleset>
+ </rule>
+ <rule>
+ <name>NoPackage</name>
+ <ruleset>Naming Rules</ruleset>
+ </rule>
+ <rule>
+ <name>PackageCase</name>
+ <ruleset>Naming Rules</ruleset>
+ </rule>
+ <rule>
+ <name>ShortMethodName</name>
+ <ruleset>Naming Rules</ruleset>
+ </rule>
+ <rule>
+ <name>ShortVariable</name>
+ <ruleset>Naming Rules</ruleset>
+ </rule>
+ <rule>
+ <name>SuspiciousConstantFieldName</name>
+ <ruleset>Naming Rules</ruleset>
+ </rule>
+ <rule>
+ <name>SuspiciousEqualsMethodName</name>
+ <ruleset>Naming Rules</ruleset>
+ </rule>
+ <rule>
+ <name>SuspiciousHashcodeMethodName</name>
+ <ruleset>Naming Rules</ruleset>
+ </rule>
+ <rule>
+ <name>VariableNamingConventions</name>
+ <ruleset>Naming Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AddEmptyString</name>
+ <ruleset>Optimization Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AvoidArrayLoops</name>
+ <ruleset>Optimization Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AvoidInstantiatingObjectsInLoops</name>
+ <ruleset>Optimization Rules</ruleset>
+ </rule>
+ <rule>
+ <name>LocalVariableCouldBeFinal</name>
+ <ruleset>Optimization Rules</ruleset>
+ </rule>
+ <rule>
+ <name>MethodArgumentCouldBeFinal</name>
+ <ruleset>Optimization Rules</ruleset>
+ </rule>
+ <rule>
+ <name>SimplifyStartsWith</name>
+ <ruleset>Optimization Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UnnecessaryWrapperObjectCreation</name>
+ <ruleset>Optimization Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UseArrayListInsteadOfVector</name>
+ <ruleset>Optimization Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UseArraysAsList</name>
+ <ruleset>Optimization Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UseStringBufferForStringAppends</name>
+ <ruleset>Optimization Rules</ruleset>
+ </rule>
+ <rule>
+ <name>ArrayIsStoredDirectly</name>
+ <ruleset>Security Code Guidelines</ruleset>
+ </rule>
+ <rule>
+ <name>MethodReturnsInternalArray</name>
+ <ruleset>Security Code Guidelines</ruleset>
+ </rule>
+ <rule>
+ <name>AvoidCatchingNPE</name>
+ <ruleset>Strict Exception Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AvoidCatchingThrowable</name>
+ <ruleset>Strict Exception Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AvoidRethrowingException</name>
+ <ruleset>Strict Exception Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AvoidThrowingNewInstanceOfSameException</name>
+ <ruleset>Strict Exception Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AvoidThrowingNullPointerException</name>
+ <ruleset>Strict Exception Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AvoidThrowingRawExceptionTypes</name>
+ <ruleset>Strict Exception Rules</ruleset>
+ </rule>
+ <rule>
+ <name>DoNotExtendJavaLangError</name>
+ <ruleset>Strict Exception Rules</ruleset>
+ </rule>
+ <rule>
+ <name>DoNotThrowExceptionInFinally</name>
+ <ruleset>Strict Exception Rules</ruleset>
+ </rule>
+ <rule>
+ <name>ExceptionAsFlowControl</name>
+ <ruleset>Strict Exception Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AppendCharacterWithChar</name>
+ <ruleset>String and StringBuffer Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AvoidDuplicateLiterals</name>
+ <ruleset>String and StringBuffer Rules</ruleset>
+ </rule>
+ <rule>
+ <name>AvoidStringBufferField</name>
+ <ruleset>String and StringBuffer Rules</ruleset>
+ </rule>
+ <rule>
+ <name>ConsecutiveLiteralAppends</name>
+ <ruleset>String and StringBuffer Rules</ruleset>
+ </rule>
+ <rule>
+ <name>InefficientEmptyStringCheck</name>
+ <ruleset>String and StringBuffer Rules</ruleset>
+ </rule>
+ <rule>
+ <name>InefficientStringBuffering</name>
+ <ruleset>String and StringBuffer Rules</ruleset>
+ </rule>
+ <rule>
+ <name>InsufficientStringBufferDeclaration</name>
+ <ruleset>String and StringBuffer Rules</ruleset>
+ </rule>
+ <rule>
+ <name>StringBufferInstantiationWithChar</name>
+ <ruleset>String and StringBuffer Rules</ruleset>
+ </rule>
+ <rule>
+ <name>StringInstantiation</name>
+ <ruleset>String and StringBuffer Rules</ruleset>
+ </rule>
+ <rule>
+ <name>StringToString</name>
+ <ruleset>String and StringBuffer Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UnnecessaryCaseChange</name>
+ <ruleset>String and StringBuffer Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UseEqualsToCompareStrings</name>
+ <ruleset>String and StringBuffer Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UseIndexOfChar</name>
+ <ruleset>String and StringBuffer Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UselessStringValueOf</name>
+ <ruleset>String and StringBuffer Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UseStringBufferLength</name>
+ <ruleset>String and StringBuffer Rules</ruleset>
+ </rule>
+ <rule>
+ <name>CloneMethodMustImplementCloneable</name>
+ <ruleset>Type Resolution Rules</ruleset>
+ </rule>
+ <rule>
+ <name>LooseCoupling</name>
+ <ruleset>Type Resolution Rules</ruleset>
+ </rule>
+ <rule>
+ <name>SignatureDeclareThrowsException</name>
+ <ruleset>Type Resolution Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UnusedImports</name>
+ <ruleset>Type Resolution Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UnusedFormalParameter</name>
+ <ruleset>Unused Code Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UnusedLocalVariable</name>
+ <ruleset>Unused Code Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UnusedPrivateField</name>
+ <ruleset>Unused Code Rules</ruleset>
+ </rule>
+ <rule>
+ <name>UnusedPrivateMethod</name>
+ <ruleset>Unused Code Rules</ruleset>
+ </rule>
+ </rules>
+ <includeDerivedFiles>false</includeDerivedFiles>
+ <violationsAsErrors>true</violationsAsErrors>
+</pmd>
diff --git a/app/v2_java/.project b/app/v2_java/.project
new file mode 100644
index 0000000..a096e18
--- /dev/null
+++ b/app/v2_java/.project
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>usi2011</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.common.project.facet.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
+ <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
+ </natures>
+</projectDescription>
diff --git a/app/v2_java/.settings/.jsdtscope b/app/v2_java/.settings/.jsdtscope
new file mode 100644
index 0000000..f40dd98
--- /dev/null
+++ b/app/v2_java/.settings/.jsdtscope
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
+ <attributes>
+ <attribute name="hide" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
+ <classpathentry kind="output" path=""/>
+</classpath>
diff --git a/app/v2_java/.settings/org.eclipse.jdt.core.prefs b/app/v2_java/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..68097b4
--- /dev/null
+++ b/app/v2_java/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+#Sat Jan 22 14:50:35 CET 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/app/v2_java/.settings/org.eclipse.wst.common.component b/app/v2_java/.settings/org.eclipse.wst.common.component
new file mode 100644
index 0000000..f7b9782
--- /dev/null
+++ b/app/v2_java/.settings/org.eclipse.wst.common.component
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-modules id="moduleCoreId" project-version="1.5.0">
+ <wb-module deploy-name="usi2011">
+ <wb-resource deploy-path="/" source-path="/WebContent"/>
+ <wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
+ <property name="context-root" value="usi2011"/>
+ <property name="java-output-path" value="/usi2011/build/classes"/>
+ </wb-module>
+</project-modules>
diff --git a/app/v2_java/.settings/org.eclipse.wst.common.project.facet.core.xml b/app/v2_java/.settings/org.eclipse.wst.common.project.facet.core.xml
new file mode 100644
index 0000000..2f33901
--- /dev/null
+++ b/app/v2_java/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faceted-project>
+ <fixed facet="jst.java"/>
+ <fixed facet="jst.web"/>
+ <installed facet="jst.java" version="5.0"/>
+ <installed facet="jst.web" version="2.4"/>
+</faceted-project>
diff --git a/app/v2_java/.settings/org.eclipse.wst.jsdt.ui.superType.container b/app/v2_java/.settings/org.eclipse.wst.jsdt.ui.superType.container
new file mode 100644
index 0000000..3bd5d0a
--- /dev/null
+++ b/app/v2_java/.settings/org.eclipse.wst.jsdt.ui.superType.container
@@ -0,0 +1 @@
+org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file
diff --git a/app/v2_java/.settings/org.eclipse.wst.jsdt.ui.superType.name b/app/v2_java/.settings/org.eclipse.wst.jsdt.ui.superType.name
new file mode 100644
index 0000000..05bd71b
--- /dev/null
+++ b/app/v2_java/.settings/org.eclipse.wst.jsdt.ui.superType.name
@@ -0,0 +1 @@
+Window \ No newline at end of file
diff --git a/app/v2_java/WebContent/META-INF/MANIFEST.MF b/app/v2_java/WebContent/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..5e94951
--- /dev/null
+++ b/app/v2_java/WebContent/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
diff --git a/app/v2_java/WebContent/WEB-INF/web.xml b/app/v2_java/WebContent/WEB-INF/web.xml
new file mode 100644
index 0000000..1ee7e79
--- /dev/null
+++ b/app/v2_java/WebContent/WEB-INF/web.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app id="WebApp_ID" version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+ <display-name>usi2011</display-name>
+ <servlet>
+ <description>
+ </description>
+ <display-name>Question</display-name>
+ <servlet-name>Question</servlet-name>
+ <servlet-class>org.usi2011.Question</servlet-class>
+ </servlet>
+ <servlet>
+ <description>
+ </description>
+ <display-name>User</display-name>
+ <servlet-name>User</servlet-name>
+ <servlet-class>org.usi2011.User</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>Question</servlet-name>
+ <url-pattern>/api/question/*</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>User</servlet-name>
+ <url-pattern>/api/user/</url-pattern>
+ </servlet-mapping>
+ <welcome-file-list>
+ <welcome-file>index.html</welcome-file>
+ </welcome-file-list>
+</web-app>
diff --git a/app/v2_java/WebContent/game.html b/app/v2_java/WebContent/game.html
new file mode 100644
index 0000000..f53b9ad
--- /dev/null
+++ b/app/v2_java/WebContent/game.html
@@ -0,0 +1,22 @@
+<html>
+<head>
+</head>
+
+<body>
+<form method="POST" action="./api/game">
+ <div class="form_line">
+ <label name="authentication_key">authentication_key</label>
+ <input type="text" name="authentication_key" value="azertyuiop" />
+ </div>
+ <div class="form_line">
+ <label name="parameters">parameters</label>
+ <textarea rows="10" cols="80" name="parameters">
+{ "longpollingduration" : "60", "nbusersthreshold" : "2", "questiontimeframe" : "10", "nbquestions" : "20", "flushusertable" : "true" }
+ </textarea>
+ </div>
+ <div class="form_line">
+ <input type="submit" />
+ </div>
+</form>
+</body>
+</html>
diff --git a/app/v2_java/WebContent/index.html b/app/v2_java/WebContent/index.html
new file mode 100644
index 0000000..46b3200
--- /dev/null
+++ b/app/v2_java/WebContent/index.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Insert title here</title>
+</head>
+<body>
+dsfsdfsdfsdfsfsdfs
+</body>
+</html> \ No newline at end of file
diff --git a/app/v2_java/WebContent/login.html b/app/v2_java/WebContent/login.html
new file mode 100644
index 0000000..a24ea4b
--- /dev/null
+++ b/app/v2_java/WebContent/login.html
@@ -0,0 +1,20 @@
+<html>
+<head>
+</head>
+
+<body>
+<form method="POST" action="./api/login">
+ <div class="form_line">
+ <label name="mail">mail</label>
+ <input type="text" name="mail"></input>
+ </div>
+ <div class="form_line">
+ <label name="password">password</label>
+ <input type="text" name="password"></input>
+ </div>
+ <div class="form_line">
+ <input type="submit" />
+ </div>
+</form>
+</body>
+</html>
diff --git a/app/v2_java/WebContent/user.html b/app/v2_java/WebContent/user.html
new file mode 100644
index 0000000..e1be8e5
--- /dev/null
+++ b/app/v2_java/WebContent/user.html
@@ -0,0 +1,28 @@
+<html>
+<head>
+</head>
+
+<body>
+<form method="POST" action="./api/user/">
+ <div class="form_line">
+ <label name="firstname">firstname</label>
+ <input type="text" name="firstname"></input>
+ </div>
+ <div class="form_line">
+ <label name="lastname">lastname</label>
+ <input type="text" name="lastname"></input>
+ </div>
+ <div class="form_line">
+ <label name="mail">mail</label>
+ <input type="text" name="mail"></input>
+ </div>
+ <div class="form_line">
+ <label name="password">password</label>
+ <input type="text" name="password"></input>
+ </div>
+ <div class="form_line">
+ <input type="submit" />
+ </div>
+</form>
+</body>
+</html>
diff --git a/app/v2_java/src/org/usi2011/Database.java b/app/v2_java/src/org/usi2011/Database.java
new file mode 100644
index 0000000..6ebb63a
--- /dev/null
+++ b/app/v2_java/src/org/usi2011/Database.java
@@ -0,0 +1,73 @@
+package org.usi2011;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+/**
+ * @author XKHM6852
+ *
+ */
+public final class Database {
+
+ private static Connection connection;
+
+ /** */
+ public static Connection getConnection() {
+ if (connection == null) {
+ createDatabase();
+ }
+ return connection;
+ }
+
+ private static void createDatabase() {
+ try {
+ connection = DriverManager.getConnection("jdbc:hsqldb:mem:aname",
+ "sa", "");
+ String query = "DROP TABLE game; CREATE TABLE game ( "
+ + " id INT NOT NULL PRIMARY KEY, "
+ + " longpollingduration INT NOT NULL, "
+ + " nbusersthreshold INT NOT NULL,"
+ + " questiontimeframe INT NOT NULL,"
+ + " nbquestions INT NOT NULL" + ");";
+
+ Statement statement = connection.createStatement();
+ ResultSet resultset = statement.executeQuery(query);
+ connection.commit();
+ createUser();
+
+ } catch (SQLException e) {
+
+ System.out.println("SQL Exception " + e.getMessage());
+ }
+ }
+
+ private static void createUser() {
+ /*
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `firstname` varchar(255) COLLATE utf8_bin NOT NULL,
+ `lastname` varchar(255) COLLATE utf8_bin NOT NULL,
+ `mail` varchar(255) COLLATE utf8_bin NOT NULL,
+ `password` varchar(255) COLLATE utf8_bin NOT NULL,
+ */
+ try {
+ String query = "DROP TABLE user; CREATE TABLE user ( "
+ + " id INT GENERATED BY DEFAULT AS IDENTITY, "
+ + " firstname VARCHAR NOT NULL, "
+ + " lastname VARCHAR NOT NULL,"
+ + " mail VARCHAR NOT NULL,"
+ + " password VARCHAR NOT NULL" + ");";
+
+ Statement statement = connection.createStatement();
+ ResultSet resultset = statement.executeQuery(query);
+ connection.commit();
+
+ } catch (SQLException e) {
+
+ System.out.println("SQL Exception " + e.getMessage());
+ }
+ }
+
+}
diff --git a/app/v2_java/src/org/usi2011/Question.java b/app/v2_java/src/org/usi2011/Question.java
new file mode 100644
index 0000000..0c391d3
--- /dev/null
+++ b/app/v2_java/src/org/usi2011/Question.java
@@ -0,0 +1,67 @@
+package org.usi2011;
+
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import javax.servlet.ServletException;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Servlet implementation class question
+ */
+public class Question extends HttpServlet {
+ private static final long serialVersionUID = 1L;
+ private Connection connection;
+ /**
+ * Default constructor.
+ */
+ public Question() {
+ super();
+ connection = Database.getConnection();
+ }
+
+ /**
+ * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
+ * response)
+ */
+ protected void doGet(HttpServletRequest request,
+ HttpServletResponse response) throws ServletException, IOException {
+ ServletOutputStream out = response.getOutputStream();
+
+ try {
+ String query = "INSERT INTO game VALUES (1, 2, 3, 4, 5)";
+ Statement statement = connection.createStatement();
+ ResultSet resultset = statement.executeQuery(query);
+ query = "SELECT * FROM game";
+ statement = connection.createStatement();
+ resultset = statement.executeQuery(query);
+ while (resultset.next()) {
+ out.println(resultset.getString(1));
+ }
+ } catch (SQLException e) {
+ response.sendError(400);
+ }
+
+
+ out.println("hello world");
+ out.println(request.getRequestURI());
+
+ }
+
+ /**
+ * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
+ * response)
+ */
+ protected void doPost(HttpServletRequest request,
+ HttpServletResponse response) throws ServletException, IOException {
+ // TODO Auto-generated method stub
+ }
+
+}
diff --git a/app/v2_java/src/org/usi2011/User.java b/app/v2_java/src/org/usi2011/User.java
new file mode 100644
index 0000000..091b4eb
--- /dev/null
+++ b/app/v2_java/src/org/usi2011/User.java
@@ -0,0 +1,56 @@
+package org.usi2011;
+
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Map;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Servlet implementation class User
+ */
+public class User extends HttpServlet {
+ private static final long serialVersionUID = 1L;
+ private Connection connection;
+ /**
+ * @see HttpServlet#HttpServlet()
+ */
+ public User() {
+ super();
+ connection = Database.getConnection();
+ }
+
+ /**
+ * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
+ */
+ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ try {
+ String firstname = request.getParameter("firstname");
+ String lastname = request.getParameter("lastname");
+ String mail = request.getParameter("mail");
+ String password = request.getParameter("password");
+
+ System.out.println(firstname);
+ System.out.println(lastname);
+ System.out.println(mail);
+ System.out.println(password);
+
+ String query = "INSERT INTO game(firstname, lastname, mail) VALUES ('"+firstname+"', '"+lastname+"', '"+mail+"', '"+password+"')";
+ Statement statement = connection.createStatement();
+ ResultSet resultset = statement.executeQuery(query);
+
+ response.setStatus(response.SC_CREATED);
+
+ } catch (SQLException e) {
+ System.out.println(e.getMessage());
+ response.sendError(400);
+ }
+ }
+
+}