Modify

Opened 5 years ago

Last modified 5 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 5 years ago.

Download all attachments as: .zip

Change History (2)

Changed 5 years ago by simon04

Attachment: 9476.patch added

comment:1 Changed 5 years ago by Don-vip

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.
to The owner will be changed from team to the specified user.
The owner will change to simon04
as duplicate The resolution will be set to duplicate.The specified ticket will be cross-referenced with this ticket
The owner will be changed from team to anonymous.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.