Integrated JavaScript proxy support.

This commit is contained in:
Kohsuke Kawaguchi committed 2011-03-10 10:37:55 -08:00
1 parent 53a2df1476
commit b33dfa88f8
3 files changed
+78 -1

No files matched your search

@@ -0,0 +1,32 @@
package hudson.plugins.ui_samples;
import hudson.Extension;
import org.kohsuke.stapler.bind.JavaScriptMethod;
/**
* "Export" Java objects to JavaScript in the browser as a proxy object, so that
* you can make ajax-calls to the server later.
*
* @author Kohsuke Kawaguchi
*/
@Extension
public class JavaScriptProxy extends UISample {
private int i;
@Override
public String getDescription() {
return "Use JavaScript proxy objects to access server-side Java objects from inside the browser.";
}
/**
* The annotation exposes this method to JavaScript proxy.
*/
@JavaScriptMethod
public int increment(int n) {
return i+=n;
}
@Extension
public static final class DescriptorImpl extends UISampleDescriptor {
}
}