An open API service indexing awesome lists of open source software.

https://github.com/clickermonkey/jayjax

The easiest way to call your Java code from JavaScript or form submits. Minimal configuration, create a public API, upload files, and automatic object serialization.
https://github.com/clickermonkey/jayjax

Last synced: 11 months ago
JSON representation

The easiest way to call your Java code from JavaScript or form submits. Minimal configuration, create a public API, upload files, and automatic object serialization.

Awesome Lists containing this project

README

          

jayjax
======

The easiest way to call your Java code from JavaScript or form submits.

**Features**
- Minimal configuration.
- Expose your methods for API calls. i.e. `GET /user/profile/123414`
- Generates JavaScript for making asynchronous calls to defined methods.
- Automatic serialization of objects, no configuration or coding required.
- Single & Multiple File uploading.
- Controller scopes. One instance per request, session, thread, or application.
- Regular Expressions in actions for pretty URLs. i.e. `/user/(.+)`
- Pass special variables with $variableName. i.e. `$request`, `$response`, `$session`, `$cookie[0]`, `$session[user]`, etc.
- Validator invoked before method with all available information.
- Add your own converters when the default isn't sufficient.
- Only allow function calls on secure connections.

## Example

#### Configuration (WEB-INF/jayjax.xml)
```xml



```
#### Java
```java
public class MyController {
public User getUser(long userId) {
// ...
}
public long post(User user, String title, String description) {
// ...
}
public boolean update(User user, String name, Part picture) {
// ...
}
}
```
#### JavaScript
```html

MyController.getUser(332, {
success: function(user,status,xhr) {
// process user
}
});
MyController.post('Title', 'Description', {
success: function(postId,status,xhr) {
// success!
}
});

```
#### HTML
```html



Submit Blog Post



Update Name and Picture

```
#### Configuration (WEB-INF/web.xml)
```xml

jayjax
org.magnos.jayjax.FunctionServlet

52428800
52428800
0

jayjax
/jj/*

jayjax javascript
org.magnos.jayjax.JavascriptServlet

jayjax javascript
/js/*

```

#### TODO
- Add basic validators
- Non-null arguments
- Validator list
- Authorization (OpenAuth?)
- Testing
- Test ALL special variables
- Type Annotation to use generic classes as in-parameters (can only be used as out since type information is not available)
- Decide
- What to do about circular references
- Performance
- Stress Test
- Add JSON-RPC server over TCP and HTTP