/// <summary> /// Setup a rest handler that calls back for gets and posts to the specified urlBase. /// The 'urlBase' is like "/login/". This will create the rest interface "^/api/login/" /// </summary> /// <param name="urlBase">base of the url that's us</param> /// <param name="pget">called on GET operations</param> /// <param name="ppost">called on POST operations</param> public RestHandler(string urlBase, ProcessGetCallback pget, ProcessPostCallback ppost) { m_baseUrl = urlBase; m_processGet = pget; m_processPost = ppost; m_prefix = APINAME + urlBase; RestManager.Instance.RegisterListener(this); m_log.Log(LogLevel.DRESTDETAIL, "Register GET/POST handler for {0}", m_prefix); }
/// <summary> /// Setup a REST handler that returns the values from a ParameterSet. /// </summary> /// <param name="urlBase">base of the url for this parameter set</param> /// <param name="parms">the parameter set to read and write</param> /// <param name="writable">if 'true', it allows POST operations to change the parameter set</param> public RestHandler(string urlBase, IDisplayable displayable) { m_baseUrl = urlBase; m_displayable = displayable; m_processGet = ProcessGetParam; m_prefix = APINAME + urlBase; RestManager.Instance.RegisterListener(this); m_log.Log(LogLevel.DRESTDETAIL, "Register GET/POST displayable handler for {0}", m_prefix); }
/// <summary> /// Setup a REST handler that returns the values from a ParameterSet. /// </summary> /// <param name="urlBase">base of the url for this parameter set</param> /// <param name="parms">the parameter set to read and write</param> /// <param name="writable">if 'true', it allows POST operations to change the parameter set</param> public RestHandler(string urlBase, ref ParameterSet parms, bool writable) { m_baseUrl = urlBase; m_parameterSet = parms; m_parameterSetWritable = writable; m_processGet = ProcessGetParam; if (writable) { m_processPost = ProcessPostParam; } m_prefix = APINAME + urlBase; RestManager.Instance.RegisterListener(this); m_log.Log(LogLevel.DRESTDETAIL, "RestHandler: parameterset, p={0}", m_prefix); }