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.
- Host: GitHub
- URL: https://github.com/clickermonkey/jayjax
- Owner: ClickerMonkey
- License: osl-3.0
- Created: 2014-02-10T21:07:16.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2014-02-21T19:36:02.000Z (almost 12 years ago)
- Last Synced: 2025-01-27T10:23:15.531Z (about 1 year ago)
- Language: Java
- Homepage:
- Size: 891 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
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