My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Featured
Downloads
Wiki pages
Links

java REST framework servlet-based (Java REST Annotations impl), openid 2.0 relying party, oauth 1.0a consumer and service provider, json-ioc

OpenID RelyingParty

Java implementation for openid 2.0 and is backwards compatible for 1.x

Simple, lightweight and provides a clean api.

See the Quick Start Guide, openid wiki, source and a demo source.

Available extensions:

Supports login without leaving page using ajax/popup. See it live.

Easy deployment to google appengine(java) with default configuration. See http://dyuproject.appspot.com

Add <sessions-enabled>true</sessions-enabled> to your appengine-web.xml if using the default OpenIdUserManager.

Only 3 jars needed:

1. jetty-util-6.1.19.jar - 170kb

2. dyuproject-util-1.1.7.jar - 53kb

3. dyuproject-openid-1.1.7.jar - 62kb

or you can use this all-in-one jar 178kb


OAuth Consumer & Service Provider

Java implementation for the latest oauth spec 1.0a - http://oauth.googlecode.com/svn/spec/core/1.0a/drafts/3/oauth-core-1_0a.html

The 1.0 spec was found to have a security issue - http://blog.oauth.net/2009/04/22/acknowledgement-of-the-oauth-security-issue/

See the OAuthConsumer wiki and OAuthServiceProvider wiki.

The signatures HMAC-SHA1 and PLAINTEXT can be used.

RSA-SHA1 (asymmetric) is currently not implemented. It is a lot more cpu-intensive compared to HMAC-SHA1 (symmetric)

Plays well with google appengine

OAuth demo is live at http://dyuproject.appspot.com

Only 3 jars needed:

1. jetty-util-6.1.19.jar - 170kb

2. dyuproject-util-1.1.7.jar - 53kb

3. dyuproject-oauth-1.1.7.jar - 45kb

or you can use this all-in-one jar 155kb


JSON IOC

Small, lightweight and fast inversion-of-control/dependency-injection alternative using json

See the wiki.

Plays well with google appengine

Only 3 jars needed:

1. jetty-util-6.1.19.jar - 170kb

2. dyuproject-json-1.1.7.jar - 13kb

3. dyuproject-ioc-1.1.7.jar - 26kb

    ApplicationContext ac = ApplicationContext.load("classpath:com/acme/helloworld/application.json");
    Foo foo = (Foo)ac.findPojo("foo");
    System.err.println(foo.getMessage()); // Hello World
    Bar bar = (Bar)ac.findPojo("bar");
    System.err.println(bar.getFooList().get(0) == foo); // true
    System.err.println(bar.getFooList().get(1).getMessage()); // foo!

application.json

{
  "message": "Hello World",
  "foo":
  {
    "class": "com.acme.helloworld.Foo",
    "message": $message
  },
  "bar":
  {
    "class": "com.acme.helloworld.Bar",
    "fooList":
    [
      $foo,
      {
        "class": "com.acme.helloworld.Foo",
        "message": "foo!"
      }
    ]
  }
}

Lightweight servlet-based REST framework

Implementation for Java REST Annotations. See the sample HelloWorldService.

Plays well with google appengine

Browse the rest wiki, source, simple demo source and todo-list demo source.

Live demo is at http://dyuproject.appspot.com/

Advantages:

1. Simple (conforms to REST)

2. Write once (webapp and webservice in one)

3. Easy to learn (entirely based on Servlets ... near zero learning curve)

4. Naturally scalable (stateless, cookie-based session implementation similar to edge rails)

HelloWorldService.java

public class HelloWorldService extends AbstractService
{    
    @HttpResource(location="/")
    @Get
    public void root(RequestContext rc) throws IOException, ServletException
    {
        rc.getResponse().setContentType("text/html");
        getWebContext().getJSPDispatcher().dispatch("index.jsp", rc.getRequest(), rc.getResponse());
    }

    @HttpResource(location="/helloworld/$")
    @Get
    public void helloworldEntity(RequestContext rc) throws IOException, ServletException
    {
        rc.getRequest().setAttribute("message", "get entity: " + rc.getPathElement(1));
        rc.getRequest().setAttribute("timestamp", new Date());
        rc.getResponse().setContentType("text/html");
        getWebContext().getJSPDispatcher().dispatch("helloworld/index.jsp", rc.getRequest(), rc.getResponse());
    }
    
    @HttpResource(location="/helloworld")
    @Get
    public void helloworld(RequestContext rc) throws IOException, ServletException
    {
        rc.getRequest().setAttribute("message", "Hello world!");
        rc.getRequest().setAttribute("timestamp", new Date());
        rc.getResponse().setContentType("text/html");
        getWebContext().getJSPDispatcher().dispatch("helloworld/index.jsp", rc.getRequest(), rc.getResponse());
    }

    @HttpResource(location="/helloworld")
    @Post
    public void helloworldPost(RequestContext rc) throws IOException, ServletException
    {
        rc.getRequest().setAttribute("message", "This is a POST request");
        rc.getRequest().setAttribute("timestamp", new Date());
        rc.getResponse().setContentType("text/html");
        getWebContext().getJSPDispatcher().dispatch("helloworld/index.jsp", rc.getRequest(), rc.getResponse());
    }

}

The maven2 repository

  <repositories>
      <id>dyuproject-repo</id>
      <name>dyuproject-repo</name>      
      <url>http://dyuproject.googlecode.com/svn/repos/maven2</url>
    </repository>
  </repositories>

image made with wordle

Powered by Google Project Hosting