All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mastfrog.webapi.WebCall Maven / Gradle / Ivy

There is a newer version: 2.9.7
Show newest version
package com.mastfrog.webapi;

import com.mastfrog.acteur.headers.Method;
import com.mastfrog.giulius.Dependencies;

/**
 * Implemented on enum constants which represents web calls
 *
 * @author Tim Boudreau
 */
public interface WebCall {

    /**
     * The human-readable name of this call, typically id().toString()
     * @return a name
     */
    String name();
    /**
     * The enum ID of this call
     * @return an id
     */
    Enum id();
    /**
     * The HTTP method of this call;  the default is GET
     * @return 
     */
    Method method();
    /**
     * The path portion of the URL to call;  will be appended to the 
     * Invoker's base URL.  Simple
     * string substitution can be done by putting lower-case simple class names
     * into the path, delimited by {{ }}.  So, for example,
     * /users/{{userid}&rcub would mean to look for
     * a class whose simple name, lower-cased, is userid, call
     * toString() on it, and replace the templated portion with that.
     * 

* For more complex transformations of the path, implement * Decorator. * @return A url */ String urlTemplate(); /** * The set of types which may, or are expected to, be passed in when making * a web call * @return */ Class[] requiredTypes(); /** * If true, look for a set of BasicCredentialss in the call * context, and if present, include an Authorization header based on them * to authenticate. * @return */ boolean authenticationRequired(); /** * Get the decorator, if any, associated with some required type * @param The object type * @param The type of the decorator * @param type The object type * @return The type of the decorator */ > Class decorator(Class type); /** * If true, a response body is expected and should be waited for before * calling back the callback. Simple calls may just need acknowledgement. * @return whether or not a body is required */ boolean expectResponseBody(); /** * If true, do not close the connection - the caller will hold on to * the ResponseFuture * @return */ boolean isStayOpen(); > Class interpolator(Class type); Interpreter interpreter(Dependencies deps); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy