当前位置: 首页>>代码示例>>C++>>正文


C++ webcore::ResourceResponse类代码示例

本文整理汇总了C++中webcore::ResourceResponse的典型用法代码示例。如果您正苦于以下问题:C++ ResourceResponse类的具体用法?C++ ResourceResponse怎么用?C++ ResourceResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ResourceResponse类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CreateResponse

jint WebCoreResourceLoader::CreateResponse(JNIEnv* env, jobject obj, jstring url, jint statusCode,
                                                    jstring statusText, jstring mimeType, jlong expectedLength,
                                                    jstring encoding)
{
#ifdef ANDROID_INSTRUMENT
    TimeCounterAuto counter(TimeCounter::ResourceTimeCounter);
#endif
    LOG_ASSERT(url, "Must have a url in the response!");
    WebCore::KURL kurl(WebCore::ParsedURLString, to_string(env, url));
    WebCore::String encodingStr;
    WebCore::String mimeTypeStr;
    if (mimeType) {
        mimeTypeStr = to_string(env, mimeType);
        LOGV("Response setMIMEType: %s", mimeTypeStr.latin1().data());
    }
    if (encoding) {
        encodingStr = to_string(env, encoding);
        LOGV("Response setTextEncodingName: %s", encodingStr.latin1().data());
    }
    WebCore::ResourceResponse* response = new WebCore::ResourceResponse(
            kurl, mimeTypeStr, (long long)expectedLength,
            encodingStr, WebCore::String());
    response->setHTTPStatusCode(statusCode);
    if (statusText) {
        WebCore::String status = to_string(env, statusText);
        response->setHTTPStatusText(status);
        LOGV("Response setStatusText: %s", status.latin1().data());
    }
    return (int)response;
}
开发者ID:Androtos,项目名称:toolchain_benchmark,代码行数:30,代码来源:WebCoreResourceLoader.cpp

示例2: didReceiveResponse

void CustomProtocolManagerImpl::didReceiveResponse(uint64_t customProtocolID, const WebCore::ResourceResponse& response)
{
    WebSoupRequestAsyncData* data = m_customProtocolMap.get(customProtocolID);
    ASSERT(data);
    ASSERT(data->task);

    WebKitSoupRequestGeneric* request = WEBKIT_SOUP_REQUEST_GENERIC(g_task_get_source_object(data->task));
    webkitSoupRequestGenericSetContentLength(request, response.expectedContentLength() ? response.expectedContentLength() : -1);
    webkitSoupRequestGenericSetContentType(request, !response.mimeType().isEmpty() ? response.mimeType().utf8().data() : 0);
}
开发者ID:cheekiatng,项目名称:webkit,代码行数:10,代码来源:CustomProtocolManagerImpl.cpp

示例3: webkit_network_response_get_suggested_filename

/**
 * webkit_network_response_get_suggested_filename:
 * @response: a #WebKitNetworkResponse
 *
 * Obtains the suggested filename for the given network response. The
 * suggested filename is taken from the 'Content-Disposition' HTTP
 * header, but this is not always present, and this method will return
 * %NULL in such case.
 *
 * Returns: (transfer none): the suggested filename or %NULL if not present
 * Since: 1.10
 **/
const gchar* webkit_network_response_get_suggested_filename(WebKitNetworkResponse* response)
{
    g_return_val_if_fail(WEBKIT_IS_NETWORK_RESPONSE(response), 0);

    WebKitNetworkResponsePrivate* priv = response->priv;

    if (priv->suggestedFilename)
        return priv->suggestedFilename;

    WebCore::ResourceResponse coreResponse = core(response);
    priv->suggestedFilename = g_strdup(coreResponse.suggestedFilename().utf8().data());
    return priv->suggestedFilename;
}
开发者ID:3163504123,项目名称:phantomjs,代码行数:25,代码来源:webkitnetworkresponse.cpp

示例4: SetResponseHeader

// ----------------------------------------------------------------------------
void WebCoreResourceLoader::SetResponseHeader(JNIEnv* env, jobject obj, jint nativeResponse, jstring key, jstring val)
{
#ifdef ANDROID_INSTRUMENT
    TimeCounterAuto counter(TimeCounter::ResourceTimeCounter);
#endif
    
    WebCore::ResourceResponse* response = (WebCore::ResourceResponse*)nativeResponse;
    LOG_ASSERT(response, "nativeSetResponseHeader must take a valid response pointer!");

    LOG_ASSERT(key, "How did a null value become a key?");
    if (val) {
        WebCore::String valStr = to_string(env, val);
        if (!valStr.isEmpty())
            response->setHTTPHeaderField(to_string(env, key), valStr);
    }
}
开发者ID:Androtos,项目名称:toolchain_benchmark,代码行数:17,代码来源:WebCoreResourceLoader.cpp

示例5: sharedWillSendRedirectedRequest

void NetworkResourceLoader::sharedWillSendRedirectedRequest(const WebCore::ResourceRequest& request, const WebCore::ResourceResponse& redirectResponse)
{
    // We only expect to get the willSendRequest callback from ResourceHandle as the result of a redirect.
    ASSERT(!redirectResponse.isNull());
    ASSERT(RunLoop::isMain());

    m_currentRequest = request;

#if ENABLE(NETWORK_CACHE)
    WebCore::updateRedirectChainStatus(m_redirectChainCacheStatus, redirectResponse);
#endif

    if (isSynchronous()) {
        // FIXME: This needs to be fixed to follow the redirect correctly even for cross-domain requests.
        // This includes at least updating host records, and comparing the current request instead of the original request here.
        if (!protocolHostAndPortAreEqual(originalRequest().url(), m_currentRequest.url())) {
            ASSERT(m_synchronousLoadData->error.isNull());
            m_synchronousLoadData->error = SynchronousLoaderClient::platformBadResponseError();
            m_currentRequest = ResourceRequest();
        }
        continueWillSendRequest(m_currentRequest);
        return;
    }
    sendAbortingOnFailure(Messages::WebResourceLoader::WillSendRequest(m_currentRequest, redirectResponse));
}
开发者ID:xiaoyanzheng,项目名称:webkit,代码行数:25,代码来源:NetworkResourceLoader.cpp

示例6: drtDescriptionSuitableForTestResult

static QString drtDescriptionSuitableForTestResult(const WebCore::ResourceResponse& response)
{
    QString text = response.httpStatusText();
    if (text.isEmpty())
        return QLatin1String("(null)");

    return text;
}
开发者ID:Marforius,项目名称:qt,代码行数:8,代码来源:FrameLoaderClientQt.cpp

示例7: didDecidePolicyForResponse

void DumpRenderTree::didDecidePolicyForResponse(const WebCore::ResourceResponse& response)
{
    if (!testDone && m_policyDelegateEnabled) {
        if (WebCore::contentDispositionType(response.httpHeaderField("Content-Disposition")) == WebCore::ContentDispositionAttachment)
            printf("Policy delegate: resource is an attachment, suggested file name '%s'\n", response.suggestedFilename().utf8().data());
        if (waitForPolicy)
            gTestRunner->notifyDone();
    }
}
开发者ID:,项目名称:,代码行数:9,代码来源:

示例8: encodeResourceResponse

void encodeResourceResponse(ArgumentEncoder* encoder, const WebCore::ResourceResponse& resourceResponse)
{
#if USE(CFNETWORK)
    bool responseIsPresent = resourceResponse.cfURLResponse();
    encoder->encode(responseIsPresent);

    if (!responseIsPresent)
        return;

    RetainPtr<CFDictionaryRef> dictionary(AdoptCF, wkCFURLResponseCreateSerializableRepresentation(resourceResponse.cfURLResponse(), CoreIPC::tokenNullTypeRef()));
    encode(encoder, dictionary.get());
#endif
}
开发者ID:,项目名称:,代码行数:13,代码来源:

示例9: dispatchWillSendRequest

void FrameLoaderClientQt::dispatchWillSendRequest(WebCore::DocumentLoader*, unsigned long identifier, WebCore::ResourceRequest& newRequest, const WebCore::ResourceResponse& redirectResponse)
{

    if (dumpResourceLoadCallbacks)
        printf("%s - willSendRequest %s redirectResponse %s\n",
               qPrintable(dumpAssignedUrls[identifier]),
               qPrintable(drtDescriptionSuitableForTestResult(newRequest)),
               (redirectResponse.isNull()) ? "(null)" : qPrintable(drtDescriptionSuitableForTestResult(redirectResponse)));

    if (sendRequestReturnsNull)
        newRequest.setURL(QUrl());

    if (sendRequestReturnsNullOnRedirect && !redirectResponse.isNull()) {
        printf("Returning null for this redirect\n");
        newRequest.setURL(QUrl());
    }

    for (int i = 0; i < sendRequestClearHeaders.size(); ++i)
          newRequest.setHTTPHeaderField(sendRequestClearHeaders.at(i).toLocal8Bit().constData(), QString());

    // seems like the Mac code doesn't do anything here by default neither
    //qDebug() << "FrameLoaderClientQt::dispatchWillSendRequest" << request.isNull() << request.url().string`();
}
开发者ID:mikezit,项目名称:Webkit_Code,代码行数:23,代码来源:FrameLoaderClientQt.cpp

示例10: fileDoesNotExistError

WebCore::ResourceError FrameLoaderClientWx::fileDoesNotExistError(const WebCore::ResourceResponse& response)
{
    notImplemented();
    return ResourceError(String(), WebKitErrorCannotShowURL, response.url().string(), String());
}
开发者ID:mikezit,项目名称:Webkit_Code,代码行数:5,代码来源:FrameLoaderClientWx.cpp

示例11: cannotShowMIMETypeError

WebCore::ResourceError FrameLoaderClientWx::cannotShowMIMETypeError(const WebCore::ResourceResponse& response)
{
    notImplemented();
    return ResourceError(String(), WebKitErrorCannotShowMIMEType, response.url().string(), String());
}
开发者ID:mikezit,项目名称:Webkit_Code,代码行数:5,代码来源:FrameLoaderClientWx.cpp

示例12: fileDoesNotExistError

WebCore::ResourceError FrameLoaderClientQt::fileDoesNotExistError(const WebCore::ResourceResponse& response)
{
    return ResourceError("QtNetwork", QNetworkReply::ContentNotFoundError, response.url().string(),
            QCoreApplication::translate("QWebFrame", "File does not exist", 0, QCoreApplication::UnicodeUTF8));
}
开发者ID:Marforius,项目名称:qt,代码行数:5,代码来源:FrameLoaderClientQt.cpp

示例13: cannotShowMIMETypeError

WebCore::ResourceError FrameLoaderClientQt::cannotShowMIMETypeError(const WebCore::ResourceResponse& response)
{
    return ResourceError("WebKit", WebKitErrorCannotShowMIMEType, response.url().string(),
            QCoreApplication::translate("QWebFrame", "Cannot show mimetype", 0, QCoreApplication::UnicodeUTF8));
}
开发者ID:Marforius,项目名称:qt,代码行数:5,代码来源:FrameLoaderClientQt.cpp

示例14: fileDoesNotExistError

WebCore::ResourceError FrameLoaderClientQt::fileDoesNotExistError(const WebCore::ResourceResponse& response)
{
    return ResourceError("Error", -998 /* ### */, response.url().string(),
            QCoreApplication::translate("QWebFrame", "File does not exist", 0, QCoreApplication::UnicodeUTF8));
}
开发者ID:,项目名称:,代码行数:5,代码来源:

示例15: didReceiveResponseForFrame

void DumpRenderTree::didReceiveResponseForFrame(WebCore::Frame*, const WebCore::ResourceResponse& response)
{
    if (!testDone && gTestRunner->dumpResourceResponseMIMETypes())
        printf("%s has MIME type %s\n", response.url().lastPathComponent().utf8().data(), response.mimeType().utf8().data());
}
开发者ID:,项目名称:,代码行数:5,代码来源:


注:本文中的webcore::ResourceResponse类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。