View MappingJackson2HttpMessageConverter.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
/* | |
* Copyright 2002-2012 the original author or authors. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
View CorisFilter.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
package org.springframework.web.servlet.support; | |
import java.io.IOException; | |
import javax.servlet.FilterChain; | |
import javax.servlet.ServletException; | |
import javax.servlet.http.HttpServletRequest; | |
import javax.servlet.http.HttpServletResponse; | |
import org.springframework.web.filter.OncePerRequestFilter; |
View facebook.js
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
define("facebook", ["jquery", "https://connect.facebook.net/en_US/all.js"], function($) { | |
$("<div id='fb-root'></div>").prependTo($("body")); | |
FB.init({ | |
appId : 'YOUR_APP_ID', // App ID | |
channelUrl : '//YOUR_DOMAIN/channel.html', // Channel File | |
status : false, // check login status | |
cookie : false, // enable cookies to allow the server to access the session | |
xfbml : false // parse XFBML |
View JsonNodeRowMapper.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
// convenient Spring JDBC RowMapper for when you want the flexibility of Jackson's TreeModel API | |
// Note: Jackson can also serialize standard Java Collections (Maps and Lists) to JSON: if you don't need JsonNode, | |
// it's simpler and more portable to have Spring JDBC simply return a Map or List<Map>. | |
package org.springframework.jdbc.core; | |
import java.math.BigDecimal; | |
import java.sql.ResultSet; | |
import java.sql.ResultSetMetaData; | |
import java.sql.SQLException; |
View ExternalizedSql.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
// example api usage: | |
String sql = SqlUtils.sql(new ClassPathResource("complex.sql", getClass())); | |
// example complex.sql | |
SELECT {a bunch of fields} | |
FROM {table} | |
INNER JOIN {other} ON ... | |
INNER JOIN {other} ON ... |
View ExampleController.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
import java.net.URI; | |
import java.net.URISyntaxException; | |
import java.util.ArrayList; | |
import java.util.List; | |
import org.codehaus.jackson.JsonNode; | |
import org.codehaus.jackson.map.ObjectMapper; | |
import org.codehaus.jackson.node.ObjectNode; | |
import org.springframework.http.HttpStatus; | |
import org.springframework.http.MediaType; |
View WelcomeMailerTests.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
package com.example.mail; | |
import static org.junit.Assert.assertEquals; | |
import static org.junit.Assert.assertTrue; | |
import java.io.InputStreamReader; | |
import java.io.Reader; | |
import java.util.Date; | |
import java.util.HashMap; | |
import java.util.Map; |
View jmustache-spring-mvc.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
build.gradle | |
------------ | |
jmustacheVersion = '1.5' | |
dependencies { | |
compile 'com.samskivert:jmustache:$jmustacheVersion' | |
} | |
JMustacheViewResolver.java | |
-------------------------- | |
package org.springframework.servlet.mvc.view.jmustache; |
View gist:1150698
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
// BEFORE $.Deferred() | |
mainView.render(function(root) { | |
var mainContent = root.find("#content"); | |
subView.render(function(el) { | |
mainContent.append(el); | |
nestedView.render(function(el) { | |
mainContent.append(el); | |
allDoneCallback(root); | |
}); |
View ecmascript5-objects.js
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
var ns = ns || {}; | |
ns.PropertyUtils = { | |
// Make the named (or all) properties of o nonenumerable, if configurable. | |
hide : function(o) { | |
var props = (arguments.length == 1) | |
? Object.getOwnPropertyNames(o) | |
: Array.prototype.splice.call(arguments, 1); | |
props.forEach(function(p) { |
NewerOlder