Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2004-2010 Oracle Corporation. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at Contributors: Kohsuke Kawaguchi /
package org.kohsuke.stapler.bind;
Handles to the object bound via BoundObjectTable. As org.kohsuke.stapler.HttpResponse, this object generates a redirect to the URL that it points to.

public abstract class Bound implements HttpResponse {
Explicitly unbind this object. The referenced object won't be bound to URL anymore.
    public abstract void release();

The URL where the object is bound to. This method starts with '/' and thus always absolute within the current web server.
    public abstract String getURL();

Gets the bound object.
    public abstract Object getTarget();

Returns a JavaScript expression which evaluates to a JavaScript proxy that talks back to the bound object that this handle represents.
    public final String getProxyScript() {
        StringBuilder buf = new StringBuilder("makeStaplerProxy('").append(getURL()).append("','").append(
        boolean first=true;
        for (Method m : getTarget().getClass().getMethods()) {
            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(;
                    if (names.isEmpty())
                        names = Collections.singleton(m.getName());
                } else
            for (String n : names) {
                if (first)  first = false;
                else        buf.append(',');
        return buf.toString();
    private static String camelize(String name) {
        return Character.toLowerCase(name.charAt(0))+name.substring(1);
New to GrepCode? Check out our FAQ X