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
public class InputStreamToString { | |
public static String convert(InputStream is) { | |
String line = ""; | |
StringBuilder builder = new StringBuilder(); | |
BufferedReader rd=new BufferedReader(new InputStreamReader(is)); | |
try { | |
while ((line = rd.readLine()) != null) { |
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
try { | |
DefaultHttpClient client = new DefaultHttpClient(); | |
HttpGet request = new HttpGet("http://www.google.com"); | |
HttpResponse response = client.execute(request); | |
InputStream content = response.getEntity().getContent(); | |
// ... | |
} catch (ClientProtocolException e) { |
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
InvocationRequest request = new DefaultInvocationRequest(); | |
File pom = new File("MY_PROJECT/pom.xml"); | |
request.setPomFile(pom); | |
File baseDir = new File("MY_PROJECT"); | |
request.setBaseDirectory(baseDir); | |
ArrayList<String> goals = new ArrayList<String>(); | |
goals.add("clean"); |
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
[alias] | |
standup = log --all --since yesterday --oneline --author <your_firstname> |
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
myproject | |
|_src | |
|_templates | |
|_main.ftl | |
|_pages | |
|_home.ftl | |
|_... |
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
public class Application { | |
public static void main(String[] args) throws IOException { | |
final Configuration cfg = configureFreemarker(); | |
get(new Route("/") { | |
@Override | |
public Object handle(Request request, Response response) { | |
//freemarker needs a Writer to render the final Html code |
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
<h1>Welcome to my website!</h1> | |
<p>This is the home page!</p> |
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
<html> | |
<head> | |
<title>${title}</title> | |
</head> | |
<body> | |
<#include page /> | |
</body> | |
</html> |
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
public class Application { | |
public static void main(String[] args) { | |
get(new Route(“/”) { | |
@Override | |
public Object handle(Request request, // | |
Response response) { | |
return “Welcome!” | |
} | |
}); | |
} |
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
package com.blogtag.digest; | |
import java.io.IOException; | |
import java.util.Random; | |
import org.springframework.http.HttpHeaders; | |
import org.springframework.http.HttpRequest; | |
import org.springframework.http.client.ClientHttpRequestExecution; | |
import org.springframework.http.client.ClientHttpRequestInterceptor; | |
import org.springframework.http.client.ClientHttpResponse; |
NewerOlder