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
2. Service Provider 'Connect' Framework | |
The spring-social-core module includes a Service Provider 'Connect' Framework for managing connections to Software-as-a-Service (SaaS) providers such as Facebook and Twitter. This framework allows your application to establish connections between local user accounts and accounts those users have with external service providers. Once a connection is established, it can be be used to obtain a strongly-typed Java binding to the ServiceProvider's API, giving your application the ability to invoke the API on behalf of a user. | |
To illustrate, consider Facebook as an example ServiceProvider. Suppose your application, AcmeApp, allows users to share content with their Facebook friends. To support this, a connection needs to be established between a user's AcmeApp account and her Facebook account. Once established, a FacebookApi instance can be obtained and used to post content to the user's wall. Spring Social's 'Connect' framework provides a clean API for managing service prov |
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) { |
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); | |
}); |
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; |
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; |
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; |
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 ... |
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; |
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 |
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; |
OlderNewer