mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-13 12:02:20 +00:00
Integrated JavaScript proxy support.
This commit is contained in:
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 {
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user