2 things.
So when using aerogear.js to make a cross domain call,
var pipeline = AeroGear.Pipeline();
cors = pipeline.add( {
name: "cors",
settings: {
This gist relates to AEROGEAR-534, https://issues.jboss.org/browse/AEROGEAR-534
I created a node.js server that handles CORS and jsonp for my testing
###Cross Domain Support
To do cross domain request, i've modified aerogear.js a bit.
I've added a new settings variable, settings.crossdomain, that can be mixed. If set to true, it will default to CORS, to override to jsonp set settings.crossdomain.type = "jsonp"
//FightCode can only understand your robot | |
//if its class is called Robot | |
var Robot = function(robot) { | |
}; | |
Robot.prototype.onIdle = function(ev) { | |
var robot = ev.robot; | |
robot.ahead(100); |
//Taken from the AeroGearExample | |
tasksPipe = [todo pipe:^(id<AGPipeConfig> config) { | |
[config name:@"status"]; | |
[config endpoint: @"realm/status"]; //endpoint with no trailing slash | |
[config type:@"REST"]; | |
}]; | |
//when i do the read, i get a 404, since the URL has a trailing slash on it | |
[tasksPipe read:^(id responseObject) { |
This is based off the most recent branch of the TODO app( my fork ) located here: https://github.com/lholmquist/TODO | |
start jboss server | |
run: mvn clean install on TODO app | |
access TODO app at http://localhost:8080/todo | |
log in with john/123 |
//https://github.com/lholmquist/WoWAerogear if you have yeoman installed, you should be able to do yeoman server, might have to do yeoman build first though | |
//excerpt from app.js | |
pipeline.add( { | |
name: "wowPipe", | |
settings: { | |
baseURL: "http://us.battle.net/api/wow/", | |
endpoint: "achievement/2144", //this should be in the read method, need datamanager for that? | |
jsonp: true, |
//was - worked | |
securePipe.read({ | |
error: function( data, message ) { | |
equal( message, "Error: Authentication Required", "Initial Page load Auth Failure" ); | |
start(); | |
} | |
}); | |
//should this return 1 or 2 values? and yes this is out of order, not suppose to be real code | |
var filtered = tasksValve.filter( { tags: 111 } ); | |
//the datamanager for this example | |
var tasksValve = aerogear.dataManager( "tasks" ).valves.tasks; | |
tasksValve.save([ | |
{ | |
id: 12345, | |
date: "2012-07-30", |
//When a field has multiple values, the filter method of the Memory Data Adapter won't work | |
//Here is some example data | |
userValve.save([ | |
{ | |
id: 12351, | |
fname: "Luke", | |
lname: "Public", | |
dept: [ "Accounting", "IT" ] |