'Page-render entry point for REST interface.
@param r: the S3Request instance
@param attr: controller attributes'

def apply_method(self, r, **attr):

    output = {}
    if (r.http == 'POST'):
        if (r.representation == 'json'):
            method = r.method
            if (method == 'signup'):
                output = self.signup(r, **attr)
            elif (method == 'cancel'):
                output = self.cancel(r, **attr)
            else:
                r.error(405, current.ERROR.BAD_METHOD)
        else:
            r.error(415, current.ERROR.BAD_FORMAT)
    else:
        r.error(405, current.ERROR.BAD_METHOD)
    return output
