Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build works, trying to get Heroku going
- Loading branch information
Showing
3 changed files
with
33 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
web: sh able-example/target/appassembler/bin/able-example | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 30 additions & 3 deletions
33
able-example/src/main/java/net/lightbody/able/example/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,34 @@ | ||
package net.lightbody.able.example; | ||
|
||
public class Main { | ||
public static void main(String[] args) { | ||
System.out.println("***"); | ||
import org.eclipse.jetty.server.Server; | ||
import org.eclipse.jetty.servlet.ServletContextHandler; | ||
import org.eclipse.jetty.servlet.ServletHolder; | ||
|
||
import javax.servlet.ServletException; | ||
import javax.servlet.http.HttpServlet; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
import java.io.IOException; | ||
|
||
public class Main extends HttpServlet { | ||
@Override | ||
protected void doGet(HttpServletRequest req, HttpServletResponse resp) | ||
throws ServletException, IOException { | ||
resp.getWriter().print("Hello from Java!\n"); | ||
resp.getWriter().print(System.getenv("DATABASE_URL") + "\n"); | ||
} | ||
|
||
public static void main(String[] args) throws Exception{ | ||
String portStr = System.getenv("PORT"); | ||
if (portStr == null) { | ||
portStr = "8080"; | ||
} | ||
Server server = new Server(Integer.valueOf(portStr)); | ||
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS); | ||
context.setContextPath("/"); | ||
server.setHandler(context); | ||
context.addServlet(new ServletHolder(new Main()),"/*"); | ||
server.start(); | ||
server.join(); | ||
} | ||
} |