Skip to content

Commit

Permalink
build works, trying to get Heroku going
Browse files Browse the repository at this point in the history
  • Loading branch information
lightbody committed Nov 13, 2011
1 parent fd015dc commit 5576fb0
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Procfile
@@ -0,0 +1,2 @@
web: sh able-example/target/appassembler/bin/able-example

2 changes: 1 addition & 1 deletion able-example/pom.xml
Expand Up @@ -67,7 +67,7 @@

<dependency>
<groupId>net.lightbody.able</groupId>
<artifactId>able</artifactId>
<artifactId>able-core</artifactId>
<version>${project.version}</version>
</dependency>

Expand Down
33 changes: 30 additions & 3 deletions able-example/src/main/java/net/lightbody/able/example/Main.java
@@ -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();
}
}

0 comments on commit 5576fb0

Please sign in to comment.