public final String getProxyScript ( ) { StringBuilder buf = new StringBuilder ( "makeStaplerProxy('" ) . append ( getURL ( ) ) . append ( "','" ) . append ( WebApp . getCurrent ( ) . getCrumbIssuer ( ) . issueCrumb ( ) ) . append ( "',[" ) ; boolean first = true ; for ( Method m : getTarget ( ) . getClass ( ) . getMethods ( ) ) { Collection < String > names ; if ( m . getName ( ) . startsWith ( "js" ) ) { names = Collections . singleton ( camelize ( m . getName ( ) . substring ( 2 ) ) ) ; } else { JavaScriptMethod a = m . getAnnotation ( JavaScriptMethod . class ) ; if ( a != null ) { names = Arrays . asList ( a . name ( ) ) ; if ( names . isEmpty ( ) ) names = Collections . singleton ( m . getName ( ) ) ; } else continue ; } for ( String n : names ) { if ( first ) first = false ; else buf . append ( ' ' ) ; buf . append ( ' ' ) . append ( n ) . append ( ' ' ) ; } } buf . append ( "])" ) ; return buf . toString ( ) ; }
Returns a JavaScript expression which evaluates to a JavaScript proxy that talks back to the bound object that this handle represents .