//--------------------------------- REVISIONS ------------------------------ // Date Name Tracking # Description // --------- ------------------- ------------- ---------------------- // 12JUN2009 James Shen Initial Creation //////////////////////////////////////////////////////////////////////////// /** * Constructor. * @param data POST message body. * @param headers POST message http headrs. */ public Part(byte[] data, Arg[] headers) { // data is mandatory, everything else is optional if (data == null) { throw new ArgumentException("part data must be supplied"); } _content = data; _headers = headers; }
private static Response Sync( string method, string url, Arg[] inputArgs, Arg[] httpArgs, IRequestListener listener, PostData multiPart) { var request = new Request { _method = method, _url = url, _httpArgs = httpArgs, _inputArgs = inputArgs, _multiPart = multiPart, _listener = listener }; var response = new Response(); request.DoHTTP(response); return response; }
private static void Async( string method, string url, Arg[] inputArgs, Arg[] httpArgs, IRequestListener listener, PostData multiPart, object context) { var request = new Request { _method = method, _context = context, _listener = listener, _url = url, _httpArgs = httpArgs, _inputArgs = inputArgs, _multiPart = multiPart }; //strategies request._thread = new Thread(request.Run); request._thread.Start(); }
//--------------------------------- REVISIONS ------------------------------ // Date Name Tracking # Description // --------- ------------------- ------------- ---------------------- // 12JUN2009 James Shen Initial Creation //////////////////////////////////////////////////////////////////////////// /** * Issue an asynchronous POST requst. * @param url Http request url. * @param inputArgs argument of for the url. * @param httpArgs extra http header. * @param listener RequestLister used to handle the async http response. * @param multiPart message body. * @param context message context ,wiil pass as the same in done(). */ public static void Post( string url, Arg[] inputArgs, Arg[] httpArgs, IRequestListener listener, PostData multiPart, object context) { Async(POST, url, inputArgs, httpArgs, listener, multiPart, context); }
//--------------------------------- REVISIONS ------------------------------ // Date Name Tracking # Description // --------- ------------------- ------------- ---------------------- // 12JUN2009 James Shen Initial Creation //////////////////////////////////////////////////////////////////////////// /** * Issue a synchronous POST requst. * @param url Http request url. * @param inputArgs argument of for the url. * @param httpArgs extra http header. * @param listener RequestLister used to handle the sync http response. * @param multiPart message body. * @return the http response object. * @ any IOException */ public static Response Post(string url, Arg[] inputArgs, Arg[] httpArgs, IRequestListener listener, PostData multiPart) { return Sync(POST, url, inputArgs, httpArgs, listener, multiPart); }
//--------------------------------- REVISIONS ------------------------------ // Date Name Tracking # Description // --------- ------------------- ------------- ---------------------- // 12JUN2009 James Shen Initial Creation //////////////////////////////////////////////////////////////////////////// /** * Issue a asynchronous GET requst. * @param url Http request url. * @param inputArgs argument of for the url. * @param httpArgs extra http header. * @param listener RequestLister used to handle the async http response. * @param context message context ,wiil pass as the same in done(). */ public static void Get( string url, Arg[] inputArgs, Arg[] httpArgs, IRequestListener listener, object context) { Async(GET, url, inputArgs, httpArgs, listener, null, context); }
//--------------------------------- REVISIONS ------------------------------ // Date Name Tracking # Description // --------- ------------------- ------------- ---------------------- // 12JUN2009 James Shen Initial Creation //////////////////////////////////////////////////////////////////////////// /** * Issue a synchronous GET requst. * @param url Http request url. * @param inputArgs argument of for the url. * @param httpArgs extra http header. * @param listener RequestLister used to handle the sync http response. * @return the http response object. * @ any IOException. */ public static Response Get(string url, Arg[] inputArgs, Arg[] httpArgs, IRequestListener listener) { return Sync(GET, url, inputArgs, httpArgs, listener, null); }