Skip to content

Instantly share code, notes, and snippets.

View danbev's full-sized avatar
⌨️
T.C.B "Taking care of business." Cosmo Kramer

Daniel Bevenius danbev

⌨️
T.C.B "Taking care of business." Cosmo Kramer
View GitHub Profile
@danbev
danbev / gist:3826704
Created October 3, 2012 12:36
building aerogear-android-todo

When building aerogear-android-todo I get the following error:

[INFO] --- maven-compiler-plugin:2.0.2.SP1:compile (default-compile) @ android-todos ---
[INFO] Compiling 96 source files to /Users/danbev/work/jboss/aerogear/aerogear-android-todo/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.405s
[INFO] Finished at: Wed Oct 03 14:01:54 CEST 2012
[INFO] Final Memory: 8M/81M
@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)
@danbev
danbev / gist:3938238
Created October 23, 2012 11:13
RestEasy Programmatic Configuration

Programmatic endpoint configuration in RestEasy

This section will try to sort out the best way to implement programmatic endpoint configuration. The approach taken is to make as few changes as possible to RestEasy, which is means that when changes were required whole methods have been copied and those new methods changed were possible.

The following branch contains the code discussed in this document: programmatic-config

Lets starting with a very basic POJO like this:

public class Pojo
{
   public String doit()
@danbev
danbev / gist:3938515
Created October 23, 2012 12:36
AeroGear-iOS 1.0.0.M1

AeroGear-iOS 1.0.0.M1

A little bit more than two month ago the work on the AeroGear-iOS library started. We added an initial (and simple) API to communicate against the JBoss RestEasy component. The functionality contains:

  • HTTP communication
  • Data storage
  • Authentication and user enrollment

This little document describes the API in a more detailed way.

@danbev
danbev / gist:3939375
Created October 23, 2012 15:18
Android build
Running org.aerogear.android.pipeline.PipelineTest
Warning: an error occurred while binding shadow class: ShadowGeoPoint
Warning: an error occurred while binding shadow class: ShadowItemizedOverlay
Warning: an error occurred while binding shadow class: ShadowMapController
Warning: an error occurred while binding shadow class: ShadowMapActivity
Warning: an error occurred while binding shadow class: ShadowMapView
Warning: an error occurred while binding shadow class: ShadowOverlayItem
Tests run: 18, Failures: 0, Errors: 18, Skipped: 0, Time elapsed: 12.058 sec <<< FAILURE!
testAddNewPipeToPipeline(org.aerogear.android.pipeline.PipelineTest)  Time elapsed: 3.451 sec  <<< ERROR!
@danbev
danbev / gist:3992369
Created November 1, 2012 07:52
AeroGear-Controller Status Response

Background

This gist discusses possible solutions to AEROGEAR-581 "Support listening for "HttpErrorStatusEvent" and return response status/message."

Task description

When a request enters the controller, and the isRouteAllowed() method of the current SecurityProvider implementation denies the request, we want to be able to return a response code instead of redirecting the request to a view. This would be done by having AeroGear-Controller listen for CDI events of something like HttpErrorStatusEvent, and in that case respond with the information in the generated event (status and message).

Current implementation

The current implementation allows for a SecurityProvider implementation to throw an exception and if that exception is of type HttpStatusAwareException the controller sets the status code from the instance on the HttpServletResponse. One things I noticed when looking into this is that there is a bug, which I think I introduced,

@danbev
danbev / gist:3992808
Created November 1, 2012 09:54
JAX-RS Integration with AeroGear Controller

Integration point for a JAX-RS implementation in AeroGear Controller

This section will discuss how a JAX-RS implementation can be integrated and used with AeroGear Controller.

Background

An application that uses AeroGear Controller is deployed as a web application archive (WAR), with the aerogear-controller.jar in the WEB-INF/lib directory. Upon deploying the WAR, the servlet container will scan the deployment for @WebFilter annotation (among other things). AeroGear Controller contains such a servlet filter named AeroGear. All request to the web application will go through the AeroGear filter. AeroGear gets injected with a Router instance which is able to dispatch to the routes that the end users has configured.

Integrating a JAX-RS impl

@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)
@danbev
danbev / gist:4023803
Created November 6, 2012 09:59
AeroGear Server Side Interfaces

AeroGear Server Side Interfaces

This document describes the server side interfaces for AeroGear. Since all interactions use the Http protocol the interfaces in question are resource URLs.

Some of the exposed resource URLs are specific to AeroGear, for example if AeroGear-Security is in use, then there are certain URL that are exposed by default. But for most of the resource URLs the actual composition of the URLs is specific to the server side application. This document's indent is to be a guide for users creating new RESTful server side applications as well as for client developers to know how to interact with RESTful applications (what request/responses will look like).

Transport protocol

The APIs described in this document are based on Hypertext Transfer Protocol, version 1.1 and https is recommended. Please refer to the security section of this document for details why https is important.

Resources

A resource, or an endpoint, is identified by