SWX Java alpha released!

Filed under: Releases — Wrote by ken on Tuesday, October 16th, 2007 @ 8:13 am

The alpha version of SWX Java was released on Google code.
This is an alpha test version so that developers and users can find out about SWX Java, and make comments on how to improve it.
Here is a quick guide on how to use SWX Java.

How to use :

  1. Copy swxjava.jar and json_simple.jar to WEB-INF/lib directory of your web-app.
  2. Create a service class in java.
  3. Edit the config files (web.xml and swx.xml).

    - web.xml

    <web-app id="swx">
    <servlet>
    <servlet-name>swx-gateway</servlet-name>
    <display-name>SWX Gateway Servlet</display-name>
    <description>SWX Gateway Servlet</description>
    <servlet-class>org.swxjava.servlet.SwxGatewayServlet</servlet-class>
    <init-param>
    <param-name>debug</param-name>
    <param-value>true</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>swx-gateway</servlet-name>
    <url-pattern>/swx/*</url-pattern>
    </servlet-mapping>
    </web-app>

    - swx.xml under the WEB-INF directory

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE swx PUBLIC “-//DTD SWX Java 0.1//EN”
    “http://swxjava.org/dtds/swx-01.dtd”>
    <swx>
    <allow>
    <convert converter=”bean” match=”org.swxjava.examples.*” />
    <service name=”TestDataTypes” locator=”new”>
    <param name=”class” value=”org.swxjava.examples.TestDataTypes” />
    </service>
    </allow>
    </swx>

  4. Deploy your web app.
  5. Make swx call.

    import org.swxformat.SWX;
    // Set up SWX gateway
    var swx:SWX = new SWX();
    swx.gateway = “http://localhost:8080/YOUR_APP_NAME/swx/gateway”;
    swx.debug = true;
    var callParameters:Object =
    {
    serviceClass: “TestDataTypes”,
    method: “testArray”,
    result: [this, this[”testArrayHandler”]]
    }
    swx.call(callParameters);
    function testArrayHandler(event:Object) {
    trace(”Result : ” + event.result);
    }

TODO :

  • Documentation
  • Performance enhancement
  • Cool examples
  • Support for SWX Tools
  • Error handling
  • Logging
  • Date converter
  • AVM2 support
  • Annotation
  • Context driven JavaBean converter

There is an mailing list on Google groups, if you have any questions and suggestions. You could join swxjava group.
SWX Java is Open Source, available under the MIT License.

  -

No comments yet. Be the first to comment this post.

Leave your comment