Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Franz Reischl
tomcat-miniREST
Commits
ba603bab
Commit
ba603bab
authored
Jun 01, 2019
by
Michael Schimpelsberger
Browse files
Konfiguration server für programmierstart teil 2;
TCP db sollte jetzt funktionieren
parent
f2e4104e
Changes
4
Hide whitespace changes
Inline
Side-by-side
.settings/org.eclipse.wst.common.component
View file @
ba603bab
<?xml version="1.0" encoding="UTF-8"?>
<project-modules
id=
"moduleCoreId"
project-version=
"1.5.0"
>
<wb-module
deploy-name=
"at.jku.ce"
>
<wb-resource
deploy-path=
"/"
source-path=
"/target/m2e-wtp/web-resources"
/>
<wb-resource
deploy-path=
"/"
source-path=
"/src/main/webapp"
tag=
"defaultRootSource"
/>
<wb-resource
deploy-path=
"/WEB-INF/classes"
source-path=
"/src/main/java"
/>
<wb-resource
deploy-path=
"/WEB-INF/classes"
source-path=
"/src/main/resources"
/>
<property
name=
"context-root"
value=
"at.jku.ce"
/>
<property
name=
"java-output-path"
value=
"/at.jku.ce/target/classes"
/>
</wb-module>
</project-modules>
pom.xml
View file @
ba603bab
...
...
@@ -75,22 +75,12 @@
<artifactId>
activation
</artifactId>
<version>
1.1
</version>
</dependency>
<dependency>
<groupId>
com.sun.xml.bind
</groupId>
<artifactId>
jaxb-core
</artifactId>
<version>
2.2.8-b01
</version>
</dependency>
<dependency>
<groupId>
com.sun.xml.bind
</groupId>
<artifactId>
jaxb-impl
</artifactId>
<version>
2.2-promoted-b65
</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.h2database/h2 -->
<dependency>
<groupId>
com.h2database
</groupId>
<artifactId>
h2
</artifactId>
<version>
1.4.197
</version>
<scope>
test
</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.tomcat/tomcat -->
<!-- https://mvnrepository.com/artifact/javax.servlet/servlet-api -->
...
...
src/main/java/university/at/jku/ce/dao/h2dao/DaoParam.java
View file @
ba603bab
...
...
@@ -8,10 +8,11 @@ import java.nio.file.Paths;
public
class
DaoParam
{
protected
static
final
String
DRIVER
=
"org.h2.Driver"
;
protected
static
final
String
USER
=
"sa"
;
protected
static
final
String
PASSWORD
=
""
;
protected
static
final
String
JDBC_URL
=
"jdbc:h2:"
+
getDbPath
();
public
static
final
String
DRIVER
=
"org.h2.Driver"
;
public
static
final
String
USER
=
"sa"
;
public
static
final
String
PASSWORD
=
""
;
public
static
final
String
JDBC_URL
=
"jdbc:h2:"
+
getDbPath
();
public
static
final
String
TCP_PORT
=
"9192"
;
private
static
String
getDbPath
()
{
...
...
src/main/java/university/at/jku/ce/init/MyAppServletContextListener.java
View file @
ba603bab
package
university.at.jku.ce.init
;
import
java.sql.SQLException
;
import
javax.servlet.ServletContextEvent
;
import
javax.servlet.ServletContextListener
;
import
org.h2.tools.Server
;
import
university.at.jku.ce.dao.DBInitializerDao
;
import
university.at.jku.ce.dao.h2dao.DaoParam
;
import
university.at.jku.ce.dao.h2dao.H2DBInitializerDao
;
public
class
MyAppServletContextListener
implements
ServletContextListener
{
DBInitializerDao
dao
=
new
H2DBInitializerDao
();
Server
server
;
@Override
public
void
contextInitialized
(
ServletContextEvent
sce
)
{
try
{
server
=
Server
.
createTcpServer
(
new
String
[]
{
"-tcpPort"
,
DaoParam
.
TCP_PORT
,
"-tcp"
,
"-tcpAllowOthers"
}).
start
();
}
catch
(
SQLException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
if
(!
dao
.
isValidDatabase
())
{
dao
.
initDatabase
();
System
.
out
.
println
(
"Initializing Database"
);
}
...
...
@@ -23,6 +35,7 @@ else {System.out.println("No Database initialization required");}
@Override
public
void
contextDestroyed
(
ServletContextEvent
sce
)
{
// TODO Auto-generated method stub
server
.
stop
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment