Skip to content

Instantly share code, notes, and snippets.

hello ej
@cledesma
cledesma / discussion slides
Created June 16, 2013 23:28
Slides used last June 15
HTTP Request/Response
https://docs.google.com/file/d/0B_iYaUmfEuC9c0pNOU5QQk9jLTg/edit?usp=sharing
From Desktop to Web Java
https://docs.google.com/file/d/0B_iYaUmfEuC9VzBqTmZkc2ptckk/edit?usp=sharing
Spark
https://docs.google.com/file/d/0B_iYaUmfEuC9UGZxTVo4WDQySzQ/edit?usp=sharing
Requirement:
When browser calls for localhost:4567/devconph
Logo of DevCon should appear
Logo of DevCon should be retrieved via:
http://graph.facebook.com/devconph
You can use
http://beders.github.io/Resty/Resty/Overview.html
@cledesma
cledesma / glassfish setup
Created June 15, 2013 05:37
Glassfish Setup
Installing Glassfish Plugin to Eclipse
https://docs.google.com/file/d/0B_iYaUmfEuC9dllfYVZOczZzUHc/edit?usp=sharing
Running JerseyDemo on Glassfish Server
https://docs.google.com/file/d/0B_iYaUmfEuC9NXg4aXp3UV94bGM/edit?usp=sharing
<form action="http://localhost:4567/hello" method="post">
<input type="text" name="test" />
</form>
get(new Route("/hello/withparams/:name") {
@Override
public Object handle(Request request, Response response) {
return "Hello " + request.params(":name");
}
});
@cledesma
cledesma / curl_github_gist
Last active December 18, 2015 11:58
Creating a Gist on Github Programatically
- Do an HTTP POST request to create a gist:
curl -X POST -d '{"description":"the description for this gist","public":true,"files":{"DevCon Java Camp.txt":{"content":"Hello POST request"}}}' https://api.github.com/gists
- Access the gist you created by doing an HTTP GET request:
curl -X GET https://api.github.com/gists/5778798
- You can also view the note you created in Github:
@cledesma
cledesma / curl_google.txt
Created June 14, 2013 02:05
Google Underneath the Browser
curl -v http://google.com/
@cledesma
cledesma / ReadConsoleSystem.java
Created June 13, 2013 23:03
Sample Console-based Program
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class ReadConsoleSystem {
public static void main(String[] args) {
System.out.println("Enter something here : ");
try{