Skip to content

Instantly share code, notes, and snippets.

View abstractj's full-sized avatar

Bruno Oliveira da Silva abstractj

View GitHub Profile
@danbev
danbev / gist:4001775
Created November 2, 2012 14:43
Handling SecurityProvider Responses in AeroGear-Controller

Handling SecurityProvider Responses within AeroGear-Controller

This gist is a follow up a previous gist that investigated using CDI events for handling SecurityProvider responses.

Background

In short, a route can be configured so that only users belonging to certain groups can access the target endpoint. For example:

route()
       .from("/delorean").roles("admin")
 .on(RequestMethod.GET)
@matzew
matzew / gist:3945727
Created October 24, 2012 12:09
Private versus internal API

Not exposing implementation details

Looking at this pull request and the related discussion:

  • the Pipe interface is the only access that endusers should have to a pipe.
  • the RestAdapter is a HTTP RESTful implementation of the Pipe.
  • Endusers should not be able do do new RestAdapter(...);

Looking at the discussion of the above PR, it's clear that there exposing internal APIs and/or implementation details has PROs and CONS...

@owenthereal
owenthereal / run-test262-nailgun.sh
Created October 17, 2012 03:21
Run ecmascript test262 suite for Dynjs with nailgun
#!/bin/sh
# Usage:
#
# * copy this file to the test262 folder
# * start nailgun server with `ng-server`
# * run suite with `sh run-test262-nailgun.sh <dynjs-folder>`
if [ $# = 0 ]
then
@danbev
danbev / gist:3871798
Created October 11, 2012 11:42
RestEasy Integration

RestEasy Integration with AeroGear Controller

This document is intended to describe AeroGear Controllers integration with RestEasy.

Background

Currently, the routes that AeroGear Controller can handle are "one way" in the sense that they go through AeroGear Controller are forwarded to a view, which can be populated by a data model provided by the Controller for the route in question.
For example:

route()
      .from("/customers/{id}")
 .on(RequestMethod.GET)
this.getData = function() {
return data;
};
this.setData = function( newData ) {
data = newData;
};
this.addDataRecord = function( record ) {
data.push( record );
};
this.removeDataRecord = function( record ) {

AeroGear DataManager JavaScript Specification

This is a very high level overview of the DataManager spec for the AeroGear.js library. This can also be used as inspiration for the other client libraries and is open for discussion from all points of view.

AeroGear.DataManager

Similar to AeroGear.Pipeline, this is an object used as a factory for creating new DataManager objects, which at this time are being referred to as valves in an attempt to stay with the Pipeline theme but is definitely not a name that is set in stone. A new valve is based off of adapters and planned adapters for the JS lib are memory (default), session/local storage, IndexedDB and possibly Web SQL though I believe this is no longer maintained and may be unnecessary. These objects then deal only with client side data.

Methods

@matzew
matzew / gist:3405912
Created August 20, 2012 17:15
AeroGear-iOS: first API draft

Basic functionality of the aerogear-ios pipeline structure - DRAFT Version 0.1

The pipeline object (AGPipeline):

/**
 * AGPipeline represents a 'collection' of server connections (pipes) and
 * their corresponding data models. This object provides a standard way to
 * communicate with the server no matter the data format or transport expected.
 * 
  • A pipeline must have at least one pipe.
@danbev
danbev / gist:3305522
Created August 9, 2012 16:09
Route definitions explained

Below is how routes are defined in aerogear-controller:

Routes routes = new AbstractRoutingModule() {
    @Override
    public void configuration() {
        route()
                .from("/home")
                .on(GET)
                .to(SampleController.class).index();
 }
Request Headers
POST /todo-server/rest/task HTTP/1.1
Host: localhost:8080
Connection: keep-alive
Content-Length: 124
Origin: http://localhost:8080
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_0) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.57 Safari/537.1
Content-Type: application/json
Accept: */*
/* Need to add license, description, etc. */
// This will be broken into its own file to be reused
(function( window, undefined ) {
var aerogear = window.aerogear = {
};
})( this );
// AeroGear Pipeline