-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Instead of extending HTTPObject, I would like to delegate to it. One way to achieve that is to create factory classes that generate HTTPObjects rather than classes that extend HTTPObject.
Instead of:
HttpObject speaker = new HttpObject("/speak"){
@Override
public Response get(Request req) {
return OK(Html("Hello World"));
}
};
Something like:
HttpObject speaker = new HttpObject("/speak", Get(req->OK(Html("Hello World"))));
The Method Signature of the HttpObject constructor could take a vararg of handlers (with a check to ensure no duplicate verbs are used) such as
public HttpObject(String path, HttpVerbs... handlers)
Would anybody on this project object to me adding this interface to HTTPObjects?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels