private static void AddRequestInfoToResponseStatus(IHttpRequest httpReq, IHasResponseStatus responseObject)
        {
            if (httpReq == null || responseObject == null)
                return;

            var traceIdString = httpReq.Headers[ServiceUtils.TRACE_ID_HTTP_HEADER];
            if (!string.IsNullOrWhiteSpace(traceIdString))
                responseObject.AddExtensionData(ServiceUtils.TRACE_ID_HTTP_HEADER, traceIdString);

            IHasMobileRequestHead mobileRequest = httpReq.RequestObject as IHasMobileRequestHead;
            if (mobileRequest != null)
            {
                foreach (string extensionKey in ServiceUtils.MobileWriteBackExtensionKeys)
                {
                    string extensionData = mobileRequest.GetExtensionData(extensionKey);
                    if (extensionData != null)
                        responseObject.AddExtensionData(extensionKey, extensionData);
                }
            }

            if (httpReq.IsH5GatewayRequest())
            {
                foreach (string key in httpReq.Headers.Keys)
                {
                    string refinedKey = key.ToLower();
                    if (refinedKey.StartsWith(ServiceUtils.H5GatewayResponseDataHeaderPrefix))
                    {
                        string value = httpReq.Headers[key];
                        refinedKey = key.Substring(ServiceUtils.H5GatewayResponseDataHeaderPrefix.Length);
                        if (!string.IsNullOrWhiteSpace(refinedKey))
                            responseObject.AddExtensionData(refinedKey, value);
                    }
                }
            }
        }
Esempio n. 2
0
 public static string GetMobileAuthLoginType(this IHasMobileRequestHead request)
 {
     return(request.GetExtensionData(MobileAuthLoginTypeExtensionKey));
 }