コード例 #1
0
ファイル: Part.cs プロジェクト: 237rxd/maptiledownloader
        //--------------------------------- 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;
        }
コード例 #2
0
ファイル: Request.cs プロジェクト: 237rxd/maptiledownloader
        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;
        }
コード例 #3
0
ファイル: Request.cs プロジェクト: 237rxd/maptiledownloader
        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();
        }
コード例 #4
0
ファイル: Request.cs プロジェクト: 237rxd/maptiledownloader
 //--------------------------------- 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);
 }
コード例 #5
0
ファイル: Request.cs プロジェクト: 237rxd/maptiledownloader
 //--------------------------------- 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);
 }
コード例 #6
0
ファイル: Request.cs プロジェクト: 237rxd/maptiledownloader
 //--------------------------------- 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);
 }
コード例 #7
0
ファイル: Request.cs プロジェクト: 237rxd/maptiledownloader
 //--------------------------------- 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);
 }