本文整理汇总了C++中EList::iterator方法的典型用法代码示例。如果您正苦于以下问题:C++ EList::iterator方法的具体用法?C++ EList::iterator怎么用?C++ EList::iterator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EList
的用法示例。
在下文中一共展示了EList::iterator方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: toHttpString
EString EHttpProxyRequest::toHttpString() {
EString sb;
sb.append(getHttpVerb()).append(' ').append(getHttpURI()).append(' ').append(getHttpVersion())
.append(EHttpProxyConstants_CRLF);
boolean hostHeaderFound = false;
if (getHeaders() != null) {
sp<EIterator<EMapEntry<EString*, EList<EString*>*>*> > iter = getHeaders()->entrySet()->iterator();
while (iter->hasNext()) {
EMapEntry<EString*, EList<EString*>*>* header = iter->next();
if (!hostHeaderFound) {
hostHeaderFound = header->getKey()->equalsIgnoreCase("host");
}
EList<EString*>* values = header->getValue();
if (values) {
sp<EIterator<EString*> > iter2 = values->iterator();
while (iter2->hasNext()) {
sb.append(header->getKey()->c_str()).append(": ").append(iter2->next()).append(EHttpProxyConstants_CRLF);
}
}
}
if (!hostHeaderFound && (eso_strcmp(getHttpVersion(), EHttpProxyConstants_HTTP_1_1) == 0)) {
sb.append("Host: ").append(getHost()).append(EHttpProxyConstants_CRLF);
}
}
sb.append(EHttpProxyConstants_CRLF);
return sb;
}
示例2: statusLine_
EHttpProxyResponse::EHttpProxyResponse(const char* httpVersion,
const char* statusLine, EMap<EString*, EList<EString*>*>* headers) {
this->httpVersion = httpVersion;
this->statusLine = statusLine;
// parses the status code from the status line
EString statusLine_(statusLine);
this->statusCode = statusLine_.charAt(0) == ' ' ? EInteger::parseInt(statusLine_.substring(1, 4).c_str()) : EInteger
::parseInt(statusLine_.substring(0, 3).c_str());
this->headers.clear(); // Clear old.
if (headers) {
sp<EIterator<EMapEntry<EString*, EList<EString*>*>*> > iter = headers->entrySet()->iterator();
while (iter->hasNext()) {
EMapEntry<EString*, EList<EString*>*>* header = iter->next();
EList<EString*>* v = header->getValue();
if (v) {
EArrayList<EString*>* list = new EArrayList<EString*>(1);
sp<EIterator<EString*> > it = v->iterator();
while (it->hasNext()) {
list->add(new EString(it->next()));
}
this->headers.put(new EString(header->getKey()->c_str()), list);
}
else {
this->headers.put(new EString(header->getKey()->c_str()), null);
}
}
}
}
示例3: handleResponse
void EHttpDigestAuthLogicHandler::handleResponse(sp<EHttpProxyResponse>& response) {
this->response = response;
if (step == 0) {
if (response->getStatusCode() != 401 && response->getStatusCode() != 407) {
EString msg("Received unexpected response code (");
msg << response->getStatusLine() << ").";
throw EProxyAuthException(__FILE__, __LINE__, msg.c_str());
}
// Header should look like this
// Proxy-Authenticate: Digest still_some_more_stuff
EString k("Proxy-Authenticate");
EList<EString*>* values = response->getHeaders()->get(&k);
EString* challengeResponse = null;
sp<EIterator<EString*> > iter = values->iterator();
while (iter->hasNext()) {
EString* s = iter->next();
if (s->startsWith("Digest")) {
challengeResponse = s;
break;
}
}
if (challengeResponse == null) {
throw EProxyAuthException(__FILE__, __LINE__, "Server doesn't support digest authentication method !");
}
try {
EString s = challengeResponse->substring(7);
directives = EStringUtilities::parseDirectives((byte*)s.c_str(), s.length());
} catch (EException& e) {
throw EProxyAuthException(__FILE__, __LINE__, "Parsing of server digest directives failed", &e);
}
step = 1;
} else {
EString msg("Received unexpected response code (");
msg << response->getStatusLine() << ").";
throw EProxyAuthException(__FILE__, __LINE__, msg.c_str());
}
}
示例4: setHeaders
void EHttpProxyRequest::setHeaders(EMap<EString*, EList<EString*>*>* headers) {
if (!headers) return;
this->headers.clear(); // Clear old.
sp<EIterator<EMapEntry<EString*, EList<EString*>*>*> > iter = headers->entrySet()->iterator();
while (iter->hasNext()) {
EMapEntry<EString*, EList<EString*>*>* header = iter->next();
EArrayList<EString*>* listCopy = null;
EList<EString*>* values = header->getValue();
if (values) {
listCopy = new EArrayList<EString*>();
sp<EIterator<EString*> > iter2 = values->iterator();
while (iter2->hasNext()) {
listCopy->add(new EString(iter2->next()));
}
}
this->headers.put(new EString(header->getKey()->c_str()), listCopy);
}
}