Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
56bb4a8
Update pom.xml
PBesze Oct 18, 2017
bd19e7e
Update pom.xml
PBesze Oct 18, 2017
890f3e2
Update pom.xml
PBesze Oct 18, 2017
9fd4999
Update Application.java
PBesze Oct 18, 2017
8e5f66b
Update Application.java
PBesze Oct 18, 2017
bd22cd2
Create Procfile
PBesze Oct 18, 2017
06f4d09
Update pom.xml
PBesze Oct 18, 2017
971eff5
Merge pull request #1 from PBesze/pbesze-heroku
PBesze Oct 18, 2017
54d9715
Update Application.java
PBesze Oct 18, 2017
2229948
Update pom.xml
PBesze Oct 18, 2017
a307e72
Update Procfile
PBesze Oct 18, 2017
40f13e9
Update pom.xml
PBesze Oct 19, 2017
6b9036f
Delete Procfile
PBesze Oct 19, 2017
56d3963
Create Procfile
PBesze Oct 19, 2017
df43eb3
Update Procfile
PBesze Oct 19, 2017
4b40e09
Update pom.xml
PBesze Oct 19, 2017
1f3f634
Update Procfile
PBesze Oct 19, 2017
fece3cf
Update pom.xml
PBesze Oct 19, 2017
49ba60c
Update Procfile
PBesze Oct 19, 2017
120545d
Update Procfile
PBesze Oct 19, 2017
fe785d6
Update Procfile
PBesze Oct 19, 2017
29c3157
Update pom.xml
PBesze Oct 19, 2017
60a906a
Update pom.xml
PBesze Oct 19, 2017
a4324f5
Update Procfile
PBesze Oct 19, 2017
b098ec6
Update Procfile
PBesze Oct 19, 2017
593dab8
Update Procfile
PBesze Oct 19, 2017
7cb4c30
Update pom.xml
PBesze Oct 19, 2017
51d3af4
Update Procfile
PBesze Oct 19, 2017
339a91e
Update pom.xml
PBesze Oct 19, 2017
c957e59
Update pom.xml
PBesze Oct 19, 2017
f1ed82b
Update pom.xml
PBesze Oct 19, 2017
f39401c
Update Procfile
PBesze Oct 19, 2017
f3666ec
Update pom.xml
PBesze Oct 19, 2017
2a2d278
Update Procfile
PBesze Oct 19, 2017
c01059d
Update pom.xml
PBesze Oct 19, 2017
4d2211b
Update pom.xml
PBesze Oct 19, 2017
e2d7de2
Update pom.xml
PBesze Oct 19, 2017
646cc0c
Update pom.xml
PBesze Oct 19, 2017
2535499
Delete Procfile
PBesze Oct 19, 2017
a5e7481
Create Procfile
PBesze Oct 19, 2017
a7e5b0f
Update Application.java
PBesze Oct 19, 2017
6c9e4cf
Update Application.java
PBesze Oct 19, 2017
85c5c22
Update Path.java
PBesze Oct 19, 2017
15db8b6
Update Path.java
PBesze Oct 19, 2017
bc672d5
Update messages_de.properties
PBesze Oct 19, 2017
f79221c
Update messages_de.properties
PBesze Oct 19, 2017
344519a
Merge pull request #2 from PBesze/dev
PBesze Oct 19, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: java $JAVA_OPTS -jar ./target/spark-basic-structure-1.0-SNAPSHOT-jar-with-dependencies.jar
51 changes: 49 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,34 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<descriptorRefs>
<!-- This tells Maven to include all dependencies -->
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>app.Application</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
Expand All @@ -27,6 +50,20 @@
</arguments>
</configuration>
</plugin>
<plugin>
<groupId>com.heroku.sdk</groupId>
<artifactId>heroku-maven-plugin</artifactId>
<version>1.2.2</version>
<configuration>
<jdkVersion>1.8</jdkVersion>
<includes>
<include>target/spark-basic-structure-1.0.BUILD-SNAPSHOT.jar</include>
</includes>
<processTypes>
<web>java -jar ./target/spark-basic-structure-1.0.BUILD-SNAPSHOT.jar </web>
</processTypes>
</configuration>
</plugin>
</plugins>
</build>

Expand Down Expand Up @@ -54,7 +91,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.6</version>
<version>1.16.18</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
Expand All @@ -76,6 +113,16 @@
<artifactId>jbcrypt</artifactId>
<version>0.3m</version>
</dependency>
<dependency>
<groupId>com.heroku.sdk</groupId>
<artifactId>heroku-maven-plugin</artifactId>
<version>1.2.2</version>
</dependency>
</dependencies>

<repositories>
<repository>
<id>projectlombok.org</id>
<url>http://projectlombok.org/mavenrepo</url>
</repository>
</repositories>
</project>
10 changes: 9 additions & 1 deletion src/main/java/app/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static void main(String[] args) {
userDao = new UserDao();

// Configure Spark
port(4567);
port(getHerokuAssignedPort());
staticFiles.location("/public");
staticFiles.expireTime(600L);
enableDebugScreen();
Expand All @@ -37,11 +37,19 @@ public static void main(String[] args) {
get(Path.Web.LOGIN, LoginController.serveLoginPage);
post(Path.Web.LOGIN, LoginController.handleLoginPost);
post(Path.Web.LOGOUT, LoginController.handleLogoutPost);
get(Path.Web.HOME, IndexController.serveIndexPage);
get("*", ViewUtil.notFound);

//Set up after-filters (called after each get/post)
after("*", Filters.addGzipHeader);

}
static int getHerokuAssignedPort() {
ProcessBuilder processBuilder = new ProcessBuilder();
if (processBuilder.environment().get("PORT") != null) {
return Integer.parseInt(processBuilder.environment().get("PORT"));
}
return 4567; //return default port if heroku-port isn't set (i.e. on localhost)
}

}
1 change: 1 addition & 0 deletions src/main/java/app/util/Path.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public static class Web {
@Getter public static final String LOGOUT = "/logout/";
@Getter public static final String BOOKS = "/books/";
@Getter public static final String ONE_BOOK = "/books/:isbn/";
@Getter public static final String HOME = "/";
}

public static class Template {
Expand Down
18 changes: 9 additions & 9 deletions src/main/resources/localization/messages_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,29 @@
COMMON_TITLE=Ze Spark Library
COMMON_FOOTER_TEXT=Ze application uses <a href="https://openlibrary.org/" target="_blank">OpenLibrary</a> vor images.
COMMON_NAV_ALLBOOKS=View all ze books
COMMON_NAV_LOGIN=Innlogg
COMMON_NAV_LOGOUT=Auslogg
COMMON_NAV_LOGIN=Anmelden
COMMON_NAV_LOGOUT=Abmelden
ERROR_406_NOT_ACCEPTABLE=No zuitable content found. Please zpecify eizer 'html/text' or 'application/json'.
ERROR_404_NOT_FOUND=Ve cannot find ze page you are looking for <small>(error 404)</small>


## Index
INDEX_HEADING=Velcome to ze Spark Library
INDEX_HEADING=Willkommen in den Spark Bibliothek!
INDEX_REGISTERED_USERS=Zere are currently {0} users registered:
INDEX_PASSWORD_INFO=It seems zey have all chosen ze password "password" for some reason. Hov silly.
INDEX_BOOK_OF_THE_DAY_TEXT=Ze book of ze day is:
INDEX_BOOK_OF_THE_DAY_LINK=<strong>{0} von {1}</strong>


## Login
LOGIN_HEADING=Innlogg
LOGIN_INSTRUCTIONS=Please enter dein username und password. <small><br>(Zee ze <a href="{0}">index page</a> if you need a hint)</small>
LOGIN_AUTH_SUCCEEDED=You''re logged in as ''{0}''.
LOGIN_HEADING=Anmelden
LOGIN_INSTRUCTIONS=Bitte die Zugangsdaten eingeben! <small><br>(Zee ze <a href="{0}">index page</a> if you need a hint)</small>
LOGIN_AUTH_SUCCEEDED=Sie sind als ''{0}'' angemeldet.
LOGIN_AUTH_FAILED=Ze login informazion you zuplied vas incorrect.
LOGIN_LOGGED_OUT=You have been logged aus.
LOGIN_LABEL_USERNAME=Username
LOGIN_LABEL_PASSWORD=Password
LOGIN_BUTTON_LOGIN=Innlogg
LOGIN_LABEL_USERNAME=BenutzerIn
LOGIN_LABEL_PASSWORD=Passwort
LOGIN_BUTTON_LOGIN=Anmelden


## Books
Expand Down