PDA

View Full Version : Alternative Ext Direct Java Implementation



rastafarra
8 Jun 2009, 12:06 AM
i'd like to introduce new ext direct library written in java.

featues:
simple usage
fast method search
java exception support
bean arguments support
argument polymorphism supportmore infomation you can find on http://bitbucket.org/cattus/hqextdirect/ (http://bitbucket.org/cattus/hqextdirect/overview/)

simple example:


import hqextdirect.AmbiguousMethod;
import hqextdirect.Dispatcher;
import hqextdirect.Router;

import javax.servlet.http.HttpServletRequest;



class TestAction
{
public Integer multiply(Integer a, Integer b)
{
return a * b;
}
}



public class TestRouter
extends Router
{
private final Dispatcher dispatcher;

public TestRouter()
{
dispatcher = new Dispatcher();

try {
// this adds all public methods of TestAction class
// to the dispatcher
dispatcher.setAction("TestAction", new TestAction());
} catch (AmbiguousMethod ambigousMethod) {
// empty
}
}

protected synchronized Dispatcher getDispatcher
(HttpServletRequest request)
{
return dispatcher;
}
}
TestRouter is servlet. on GET request it is show description like

{"actions" :
{"TestAction" :
[{"len" : 2
,"name" : "multiply"}]}
,"url" : "/TestRouter"
,"type" : "remoting" };on POST request it do dispatch