예제 #1
0
        public GetRenderingHtmlTasks(RenderingHtmlUrlBuilder urlBuilder, HttpClient httpClient, ICredentialsHeadersCryptor credentialsHeadersCryptor)
        {
            this.urlBuilder = urlBuilder;
            this.httpClient = httpClient;
            this.credentialsHeadersCryptor = credentialsHeadersCryptor;

            this.Validate();
        }
        public async Task <Stream> ReadRenderingHtmlAsync(IGetRenderingHtmlRequest request, CancellationToken cancelToken = default(CancellationToken))
        {
            IGetRenderingHtmlRequest requestCopy = request.DeepCopyGetRenderingHtmlRequest();

            using (ICredentialsHeadersCryptor cryptor = await this.GetCredentialsCryptorAsync(cancelToken))
            {
                IGetRenderingHtmlRequest autocompletedRequest = this.requestMerger.FillGetRenderingHtmlGaps(requestCopy);

                var urlBuilder = new RenderingHtmlUrlBuilder(this.restGrammar, this.webApiGrammar);
                var taskFlow   = new GetRenderingHtmlTasks(urlBuilder, this.httpClient, cryptor);

                return(await RestApiCallFlow.LoadResourceFromNetworkFlow(autocompletedRequest, taskFlow, cancelToken));
            }
        }
        public void SetUp()
        {
            IRestServiceGrammar  restGrammar   = RestServiceGrammar.ItemWebApiV2Grammar();
            IWebApiUrlParameters webApiGrammar = WebApiUrlParameters.ItemWebApiV2UrlParameters();

            this.builder = new RenderingHtmlUrlBuilder(restGrammar, webApiGrammar);

            SessionConfigPOD mutableSessionConfig = new SessionConfigPOD();

            mutableSessionConfig.ItemWebApiVersion = "v234";
            mutableSessionConfig.InstanceUrl       = "mobiledev1ua1.dk.sitecore.net:7119";
            mutableSessionConfig.Site = "/sitecore/shell";

            ItemSource source = LegacyConstants.DefaultSource();

            this.requestMerger = new UserRequestMerger(mutableSessionConfig, source);
        }
 public void TearDown()
 {
     this.builder = null;
 }