Simple Java TCP/HTTP server wired for MYSQL and JSON replies
Allows you to have a live server wired up for MYSQL, JSON, GET, POST in under 2 minutes.
This server is wired for you to:
- Connect To MYSQL using JDBC
- Query MYSQL
- Manages most object conversions from MSYQL to java objects
- Listen for GET/POST requests of port 1234
- Send back a JSON response
To use WITH MYSQL:
-
Create a MYSQL DB called Sample
-
Create a table called user
-
In user table add three fields: first, last, social
- Social should be int
- First, last should be varchar
-
Import project into your favorite IDE
-
Start server
-
Open browser
-
Type in http://localhost:1234/welcome
================================= To use WITHOUT MYSQL
- Import project into your favorite IDE
- Start server
- Open browser
- Type in http://localhost:1234/welcome
================================= For even faster use:
- Open terminal and type:
- java -jar WAFSimpleHTTPServer.jar
- GSON
- Jetty
- JDBC
My team and I use this server for various mobile apps and web apps. It is very robust and has served us well. We figured we could share it with the world because it took a long time to get right.
We hope it helps everyone get their projects of the ground quickly by showing you how to use the JDBC driver to connect to MYSQL, and Jetty to actually handle the HTTP requests. We will add HTTPS support as soon as we can abstract our proprietary information from it and make it available for everyone.
Server was built and contributed by William Falcon, Sam Frank, Michael Ben-Ami. All of us are studying Computer Science at Columbia University in New York.
Enjoy!!
To see this server in action checkout these projects: Meal Idea iPhone App - http://itunes.com/apps/mealidea
(If you use the server in a live product send me the name and link and we'll add your name here william@mealidea.com)