Modify

Opened 11 years ago

Last modified 11 years ago

#9476 new enhancement

[Patch draft] Annotations for remote control implementation

Reported by: simon04 Owned by: team
Priority: normal Milestone:
Component: Core remotecontrol Version:
Keywords: Cc:

Description

I was playing around a bit with annotations. The goal would be to make implementing new remote control handlers more fun. A handler is an arbitrary method annotated with @RequestMethod and its parameters annotated with @RequestParameter. The load_object could look like:

@RequestMethod(
        command = "load_object",
        usage = "Download objects with given id.",
        usageExamples = {"/load_object?new_layer=true&objects=w106159509",
                "/load_object?new_layer=true&objects=r2263653&relation_members=true"
        })
public static void loadObject(
                          @RequestParameter(name = "objects") String objects,
                          @RequestParameter(name="new_layer", optional = false) String new_layer,
                          @RequestParameter(name="relation_members", optional = false) String relation_members) {
// implementation follows
}

A working, but unfinished patch is attached.

Attachments (1)

9476.patch (8.4 KB ) - added by simon04 11 years ago.

Download all attachments as: .zip

Change History (2)

by simon04, 11 years ago

Attachment: 9476.patch added

comment:1 by Don-vip, 11 years ago

Is the duplication of parameter name really necessary ? If we could simply use the function's parameter name, it would be simpler, no ?

I let you decide the milestone :)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from team to the specified user.
Next status will be 'needinfo'. The owner will be changed from team to simon04.
as duplicate The resolution will be set to duplicate. Next status will be 'closed'. The specified ticket will be cross-referenced with this ticket.
The owner will be changed from team to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.