/// <summary>
        /// Kreira novi Request
        /// </summary>
        /// <param name="__url"></param>
        /// <param name="__action"></param>
        /// <param name="__type"></param>
        /// <returns></returns>
        public static webRequest createNewRequest(String __url,
                                                  webRequestActionType __action = webRequestActionType.openUrl,
                                                  webRequestType __type         = webRequestType.unknown)
        {
            webRequest output = null;

            if (__type == webRequestType.unknown)
            {
                __type = webRequestBase.getPreference(__action);
            }

            switch (__type)
            {
            case webRequestType.webRequestBrowser:
                output = new webRequestBrowser(__url, __action);
                break;

            case webRequestType.webRequestClient:
                output = new webRequestClient(__url, __action);
                break;

            case webRequestType.webRequestLookup:
                output = new webRequestLookup(__url, __action);
                break;

            case webRequestType.webRequestFile:
                output = new webRequestFile(__url, __action);
                break;

            default:
                break;
            }

            return(output);
        }
예제 #2
0
 public webRequestLookup(String __url = "", webRequestActionType __action = webRequestActionType.ipResolve,
                         String __customWhoIsServer = "")
 {
     url          = __url;
     action       = __action;
     customServer = __customWhoIsServer;
 }
예제 #3
0
        /// <summary>
        /// Pravi novi request i dodaje ga u trenutni request block
        /// </summary>
        /// <param name="__url">URL koji treba da se izvrsi</param>
        /// <param name="__action">Akcija koja treba da se izvrsi</param>
        /// <param name="__type">Tip webRequesta</param>
        /// <returns>Novo kreirani request</returns>
        public webRequest addNewRequest(String __url, webRequestActionType __action = webRequestActionType.openUrl,
                                        webRequestType __type = webRequestType.unknown)
        {
            webRequest output = webLoadingEngine.createNewRequest(__url, __action, __type);

            requestBlock.Add(output);
            return(output);
        }
        public webRequestClient(String __url = "", webRequestActionType __action = webRequestActionType.openUrl)
        {
            url    = __url;
            action = __action;

            //if (__url.StartsWith("/"))
            //{
            //    throw new aceGeneralException("URL has no shema and domain", null, this, "No shema [" + __url + "]");
            //}
        }
예제 #5
0
        /// <summary>
        /// Omogućava ad-hoc izvršavanje webRequest-a
        /// </summary>
        /// <param name="__url"></param>
        /// <param name="__syncMode"></param>
        /// <param name="__action"></param>
        /// <param name="__type"></param>
        /// <param name="purge">Da li da obrise sve ranije izvrsene Blokove i Zahteve ?</param>
        /// <returns>Vraća dobijeni rezultat</returns>
        public webResult executeRequest(String __url, executionSyncMode __syncMode,
                                        webRequestActionType __action = webRequestActionType.openUrl,
                                        webRequestType __type         = webRequestType.unknown, Boolean purge = true)
        {
            if (purge)
            {
                purgeExecutedBlocksAndRequests(true);
            }
            webRequestBlock blck    = getCurrentBlock();
            webRequest      request = addNewRequest(__url, __action, __type);

            webResultBlock wRB = executeCurrentBlock(__syncMode);

            return(request.result);
        }
예제 #6
0
        public override bool hasPreference(webRequestActionType __action)
        {
            switch (__action)
            {
            case webRequestActionType.openUrl:
                return(true);

                break;

            default:
                return(false);

                break;
            }
        }
예제 #7
0
        /// <summary>
        /// Preuzima __source String i pravi DOM objekat prema podesavanju
        /// </summary>
        /// <param name="__source"></param>
        /// <param name="action"></param>
        /// <param name="htmlSettings"></param>
        internal void deploySource(String __source, webRequestActionType action, htmlDomSettings htmlSettings = null)
        {
            source = __source;
            // null;

            switch (action)
            {
            case webRequestActionType.openUrl:
                HtmlDocument html = htmlSettings.getBlankDocument();
                source = htmlSettings.sourcePreFilter(source);
                html.LoadHtml(source);
                document = __source;
                break;

            case webRequestActionType.ipResolve:
            case webRequestActionType.XML:
                XmlDocument xml = new XmlDocument();
                xml.LoadXml(source);
                document  = xml;
                nsPrefix  = xml.getNamespacePrefix();
                nsManager = new XmlNamespaceManager(xml.NameTable);
                break;

            case webRequestActionType.HTMLasXML:
                HtmlDocument html2 = htmlSettings.getBlankDocument();
                html2.OptionOutputAsXml = true;

                source = htmlSettings.sourcePreFilter(source);
                html2.LoadHtml(source);
                _nav      = html2.CreateNavigator();
                nsManager = new XmlNamespaceManager(_nav.NameTable);
                nsPrefix  = _nav.NamespaceURI;
                //html2.DocumentNode as XmlNode;
                //source.ToXmlDOM();
                document        = html2;
                processedSource = html2.DocumentNode.OuterHtml;
                break;

            case webRequestActionType.Text:
            case webRequestActionType.whoIs:
            case webRequestActionType.CheckUrlOnly:
            default:
                document = __source;
                break;
            }

            _documentType = detectDocumentType();
        }
        /// <summary>
        /// Pravi equest na osnovu settings a ima mogucnost override-a za URL i ACTION parametre
        /// </summary>
        /// <param name="settings"></param>
        /// <param name="__url"></param>
        /// <param name="__action"></param>
        /// <returns></returns>
        public static webRequest createNewRequest(commonRequestSettings settings, String __url = null,
                                                  webRequestActionType __action = webRequestActionType.None)
        {
            if (String.IsNullOrEmpty(__url))
            {
                __url = settings.url;
            }
            if (__action == webRequestActionType.None)
            {
                __action = settings.action;
            }
            webRequest request = webLoadingEngine.createNewRequest(__url, __action, settings.requestType);

            request.setObjectBySource(settings, new String[] { "url", "action" });
            return(request);
        }
예제 #9
0
        public static webRequestType getPreference(webRequestActionType __action)
        {
            switch (__action)
            {
            case webRequestActionType.Download:
            case webRequestActionType.FTPUpload:
            case webRequestActionType.FTPDownload:
            case webRequestActionType.localFile:
                return(webRequestType.webRequestFile);

                break;

            case webRequestActionType.ipResolve:
            case webRequestActionType.dnsResolve:
            case webRequestActionType.CheckUrlOnly:
            case webRequestActionType.whoIs:
                return(webRequestType.webRequestLookup);

                break;

            case webRequestActionType.openUrl:
            case webRequestActionType.GetHeaders:
            case webRequestActionType.Text:
            case webRequestActionType.XML:
            case webRequestActionType.HTMLasXML:

                return(webRequestType.webRequestClient);

                break;

            default:
                return(webRequestType.unknown);

                break;
            }
        }
 public override bool hasPreference(webRequestActionType __action)
 {
     return(webRequestBase.getPreference(__action) == webRequestType.webRequestClient);
 }
예제 #11
0
        //public WebRequest httpRequest;

        public webRequestFile(String __url = "", webRequestActionType __action = webRequestActionType.openUrl)
        {
            url    = __url;
            action = __action;
        }
예제 #12
0
 // da li ima preferencije ka ovoj akciji
 public abstract Boolean hasPreference(webRequestActionType __action);