Skip to content

Instantly share code, notes, and snippets.

View danbev's full-sized avatar
🖥️
Taking care of business

Daniel Bevenius danbev

🖥️
Taking care of business
View GitHub Profile
@danbev
danbev / gist:4343461
Created December 20, 2012 07:07
kitchensink-js-stacktrace
2012/12/14 12:21:07,076 INFO [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss EAP 6.0.0.GA (AS 7.1.2.Final-redhat-1) started in 42724ms - Started 254 of 387 services (130 services are passive or on-demand)
2012/12/14 12:21:12,151 INFO [org.jboss.resteasy.cdi.CdiInjectorFactory] (http-/127.5.123.1:8080-4) Found BeanManager at java:comp/BeanManager
2012/12/14 12:21:12,229 INFO [org.jboss.resteasy.spi.ResteasyDeployment] (http-/127.5.123.1:8080-4) Deploying javax.ws.rs.core.Application: class org.jboss.as.quickstarts.html5_mobile.rest.JaxRsActivator$Proxy$_$$_WeldClientProxy
2012/12/14 12:21:33,823 INFO [org.jboss.as.ejb3] (http-/127.5.123.1:8080-4) JBAS014101: Failed to find SFSB instance with session ID {[-124, -38, 92, 8, 21, 31, 66, -55, -82, -96, -73, -79, -76, 89, 22, -55]} in cache
2012/12/14 12:21:33,823 ERROR [org.jboss.as.ejb3.invocation] (http-/127.5.123.1:8080-4) JBAS014134: EJB Invocation failed on component MemberService for method public org.jboss.as.quickstarts.html5_mobile.model.Mem
@danbev
danbev / gist:4338567
Created December 19, 2012 17:30
jboss-as-kitchensink-aerogear-js issue

Stacktrace from openshift instance: https://gist.github.com/4343461

If we look at MemberService line 81:

@GET
    @Path("/{id:[0-9][0-9]*}")
    @Produces(MediaType.APPLICATION_JSON)
    public Member lookupMemberById(@PathParam("id") long id) {
 Member member = repository.findById(id);
@danbev
danbev / gist:4330773
Created December 18, 2012 18:47
Exception
2012/12/18 13:45:49,236 ERROR [org.jboss.ejb3.invocation] (http-127.10.193.1-127.10.193.1-8080-3) JBAS014134: EJB Invocation failed on component AuthenticationServiceImpl for method public abstract javax.ws.rs.core.Response org.jboss.aerogear.security.rest.service.AuthenticationService.getSecret(): javax.ejb.EJBException: java.lang.NullPointerException
at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:166) [jboss-as-ejb3-7.1.0.Final.jar:7.1.0.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:230) [jboss-as-ejb3-7.1.0.Final.jar:7.1.0.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:304) [jboss-as-ejb3-7.1.0.Final.jar:7.1.0.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:190) [jboss-as-ejb3-7.1.0.Final.jar:7.1.0.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1
@danbev
danbev / gist:4223589
Created December 6, 2012 10:42
Request Parameter Support in AeroGear Controller

#Request Parameter Support in AeroGear Controller# This gist discusses the implementation for AEROGEAR-671 which is about adding support for Query, Header, Cookie, and form request parameter support to AeroGear Route endpoints.

Route configuration

This is what a route might look like that uses two Query parameter:

route()
       .from("/cars")
       .on(RequestMethod.GET)
       .produces(MediaType.JSON.toString())
@danbev
danbev / gist:4154088
Created November 27, 2012 12:50
TotpTest

I've been looking at the testOtpAfter40seconds and can't seem wrap my head around it:

    @Test
    public void testOtpAfter40seconds() throws Exception {
        totp = new Totp(sharedSecret, clock);
        String otp = totp.now();
        when(clock.getCurrentInterval()).thenReturn(addInterval(40));
        totp = new Totp(sharedSecret, clock);
        assertFalse("OTP should be invalid", totp.verify(otp));
    }
@danbev
danbev / gist:4152998
Last active October 13, 2015 06:27
AeroGear Controller/Camel Integration

AeroGear Camel/SwitchYard Integration

Currently one can already expose a service as a RESTful endpoint in Camel using Camel's CXFRS Component. The same goes for a service in SwitchYard that can be exposed using the RestEasy Component.
We are not suggesting to build yet another integration platform, but instead provide adapters which act as remote clients to utilize existing services.

So, a few reasons why users might opt to expose their services through AeroGear Controller:

  • Mobil Gateway
  • Backend integration
  • Thin logic layer
  • Caching
  • Security
@danbev
danbev / gist:4152794
Created November 27, 2012 06:48
RESTFul Endpoints in AeroGear Controller

RESTFul Endpoints in AeroGear Controller

The plan for AeroGear Controller is to utilize RestEasy which is a JAX-RS implementation. There is really nothing in the JAX-RS specification that we require, but more some of the functionality that the exists in RestEasy. This document will try to list what this functionality is and if we should really use a JAX-RS implementation of write/"borrow" what we need.

AeroGear controller current has routing support for POJO endpoints, but current routing will forward the result of such an endpoint to a view. For a RESTful POJO endpoint we would return the data in the content type that the caller asks for (using the Http Accept header).

Working Branch

Features Required

The following features have been identified as required by AeroGear Controller.

@danbev
danbev / gist:4147473
Created November 26, 2012 10:02
Paging/Querying in AeroGear Controller

Paging/Querying in AeroGear Controller

This document is intended to discuss a solution for AEROGEAR-645 "Add Query/Paging support on RESTful endpoints".
This dev-aerogear mail list thread was used as a starting point to gather requirements and ideas.

Background

Lets just clarify the two concepts that we are dealing with here, Paging and Query.

Paging

Paging deals with limiting the number of results returned from a single request. One "page" can contain a certain number of items as the result of invoking a request, sometimes referred to the size of a page. Let say you want to limit you the number of result returned to 10 items, this could look something like this:

@danbev
danbev / gist:4135522
Created November 23, 2012 13:03
DefaultRoute toString() using StringConcatination with + operator
public java.lang.String toString();
Code:
0: new #175 // class java/lang/StringBuilder
3: dup
4: ldc #177 // String DefaultRoute[path=
6: invokespecial #179 // Method java/lang/StringBuilder."<init>":(Ljava/lang/String;)V
9: aload_0
10: getfield #60 // Field path:Ljava/lang/String;
13: invokevirtual #182 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
16: ldc #186 // String ,
@danbev
danbev / gist:4135508
Created November 23, 2012 12:59
DefaultRoute toString() using StringBuilder
public java.lang.String toString();
Code:
0: new #175 // class java/lang/StringBuilder
3: dup
4: ldc #177 // String DefaultRoute[
6: invokespecial #179 // Method java/lang/StringBuilder."<init>":(Ljava/lang/String;)V
9: ldc #182 // String path=
11: invokevirtual #184 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
14: aload_0
15: getfield #60 // Field path:Ljava/lang/String;