Пример #1
0
HTTPServerRequestImpl::HTTPServerRequestImpl(HTTPServerResponse& response, HTTPServerSession& session, HTTPServerParams* pParams):
	_response(response),
	_pStream(0),
	_pParams(pParams)
{
	poco_check_ptr (_pParams);
	
	_pParams->duplicate();

	HTTPHeaderInputStream hs(session);
	read(hs);
	
	// Now that we know socket is still connected, obtain addresses
	_clientAddress = session.clientAddress();
	_serverAddress = session.serverAddress();
	
	if (getChunkedTransferEncoding())
		_pStream = new HTTPChunkedInputStream(session);
	else if (getContentLength() != HTTPMessage::UNKNOWN_CONTENT_LENGTH)
		_pStream = new HTTPFixedLengthInputStream(session, getContentLength());
	else if (getMethod() == HTTPRequest::HTTP_GET || getMethod() == HTTPRequest::HTTP_HEAD)
		_pStream = new HTTPFixedLengthInputStream(session, 0);
	else
		_pStream = new HTTPInputStream(session);
}
Пример #2
0
bool onekeyShare(int platformId, CCDictionary *content, C2DXShareResultEvent callback) {
	JniMethodInfo mi;
	if (platformId > 0) {
		bool isHave = getMethod(mi, "onekeyShare", "(ILjava/lang/String;)V");
		if (!isHave) {
			return false;
		}
	} else {
		bool isHave = getMethod(mi, "onekeyShare", "(Ljava/lang/String;)V");
		if (!isHave) {
			return false;
		}
	}

	CCJSONConverter* json = CCJSONConverter::sharedConverter();
	const char* ccContent = json->strFrom(content);
	jstring jContent = mi.env->NewStringUTF(ccContent);
	// free(ccContent);

	if (platformId > 0) {
		mi.env->CallStaticVoidMethod(mi.classID, mi.methodID, platformId, jContent);
	} else {
		mi.env->CallStaticVoidMethod(mi.classID, mi.methodID, jContent);
	}
	releaseMethod(mi);
	
	shareCb = callback;
	return true;
}
Пример #3
0
/**
 * @brief Parse socket data.
 * @param [in] s The socket from which to retrieve data.
 */
void HttpParser::parse(Socket s) {
	std::string line;
	line = s.readToDelim(lineTerminator);
	parseRequestLine(line);
	line = s.readToDelim(lineTerminator);
	while(!line.empty()) {
		m_headers.insert(parseHeader(line));
		line = s.readToDelim(lineTerminator);
	}
	// Only PUT and POST requests have a body
	if (getMethod() != "POST" && getMethod() != "PUT") {
		return;
	}

	// We have now parsed up to and including the separator ... we are now at the point where we
	// want to read the body.  There are two stories here.  The first is that we know the exact length
	// of the body or we read until we can't read anymore.
	if (hasHeader(HttpRequest::HTTP_HEADER_CONTENT_LENGTH)) {
		std::string val = getHeader(HttpRequest::HTTP_HEADER_CONTENT_LENGTH);
		int length = std::atoi(val.c_str());
		uint8_t data[length];
		s.receive_cpp(data, length, true);
		m_body = std::string((char *)data, length);
	} else {
		uint8_t data[512];
		int rc = s.receive_cpp(data, sizeof(data));
		m_body = std::string((char *)data, rc);
	}
	ESP_LOGD(LOG_TAG, "Size of body: %d", m_body.length());
} // parse
Пример #4
0
void dynpm(GtkWidget *widget, gpointer data){
    char **cards = getCards((char*) DEFAULT_DRM_DIR);
    if (cards == NULL) {
        g_printerr("Card list is empty.\n");
        return;
    }

    int idx = 0;
    while (cards[idx] != NULL) {
        g_print("Found card: %s\n", cards[idx]);

        if (canModifyPM()) {
            g_print("Setting dynpm\n");
            setMethod(cards[idx], DYNPM);
            g_print("method = %d\n", getMethod(cards[idx]));
            if (getMethod(cards[idx]) != METHOD_UNKNOWN) {
                g_print("profile = %d\n", getProfile(cards[idx]));
            }
        } else {
            g_print("Insufficient permission to modify PM method\n");
        }
        idx++;
    }
    freeCards(cards);
}
Пример #5
0
RunnerStatus DynamicResult::deduceStatus(oRunner &runner) const {
  if (getMethod(MDeduceRStatus))
    return toStatus(getMethod(MDeduceRStatus)->evaluate(parser));
  else if (getMethodSource(MDeduceRStatus).empty())
    return GeneralResult::deduceStatus(runner);
  else throw meosException("Syntax error");
}
Пример #6
0
int DynamicResult::deduceTime(oRunner &runner, int startTime) const {
 if (getMethod(MDeduceRTime))
    return getMethod(MDeduceRTime)->evaluate(parser);
  else if (getMethodSource(MDeduceRTime).empty())
    return GeneralResult::deduceTime(runner, startTime);
  else throw meosException("Syntax error");
}
Пример #7
0
int DynamicResult::deducePoints(oTeam &team) const {
  if (getMethod(MDeduceTPoints))
    return getMethod(MDeduceTPoints)->evaluate(parser);
  else if (getMethodSource(MDeduceTPoints).empty())
    return GeneralResult::deducePoints(team);
  else throw meosException("Syntax error");
}
Пример #8
0
void Reporter::processEnd() {
    mFirst = true;
    if(getMethod(mType) == COUT) {
        std::cout << std::endl;
    } else if(getMethod(mType) == LOG) {
        // Not implemented yet
    }
}
Пример #9
0
bool TdeinterlaceSettings::getTip(unsigned int pageId, char_t *tipS, size_t len)
{
    if (getMethod(cfgId).id != DSCALER) {
        tsnprintf_s(tipS, len, _TRUNCATE, _l("Method: %s"), getMethod(cfgId).name);
        return true;
    } else {
        return false;
    }
}
Пример #10
0
int DynamicResult::score(oRunner &runner, RunnerStatus st, int time, int points) const {
 if (getMethod(MRScore)) {
   parser.addSymbol("ComputedTime", time);
   parser.addSymbol("ComputedStatus", st);
   parser.addSymbol("ComputedPoints", points);
   return getMethod(MRScore)->evaluate(parser);
 }
 else if (getMethodSource(MRScore).empty())
    return GeneralResult::score(runner, st, time, points);
 else throw meosException("Syntax error");
}
Пример #11
0
void Actions::loadJTextField(){
    ui->comboBox->clear();
    ui->comboBox->addItem("onEnter");
    ui->comboBox->addItem("onEditText");
    // добавить другие варианты здесь
    emit getMethod(0);
}
Пример #12
0
bool WPaintedWidget::createPainter()
{
  if (painter_)
    return false;

  if (preferredMethod_ == PngImage) {
    painter_ = new WWidgetRasterPainter(this);
    return true;
  }

  const WEnvironment& env = WApplication::instance()->environment();

  /*
   * For IE < 9: no choice. Use VML
   */
  if (env.agentIsIElt(9)) {
    painter_ = new WWidgetVectorPainter(this, WWidgetPainter::InlineVml);
    return true;
  }

  /* Otherwise, combined preferred method with actual capabilities */
  Method method = getMethod();

  if (method == InlineSvgVml)
    painter_ = new WWidgetVectorPainter(this, WWidgetPainter::InlineSvg);
  else if (method == PngImage)
    painter_ = new WWidgetRasterPainter(this);
  else
    painter_ = new WWidgetCanvasPainter(this);

  return true;
}
Пример #13
0
void ListFilter::columnChanged(bool doFilter) {
    if(column.IsWindow() && method.IsWindow()) {
        auto n = method.GetCount();
        size_t col = getColumn();

        for (int i = StringMatch::METHOD_LAST; i < n; ++i) {
            method.DeleteString(StringMatch::METHOD_LAST);
        }

        if (getMethod() == -1) {
            method.SetCurSel(StringMatch::PARTIAL);
        }

        if (col >= colCount || columns[col]->isNumericType()) {
            method.AddString(_T("="));
            method.AddString(_T(">="));
            method.AddString(_T("<="));
            method.AddString(_T(">"));
            method.AddString(_T("<"));
            method.AddString(_T("!="));
        }

        if (doFilter)
            textUpdated(true);
        usingTypedMethod = false;
    }
}
int solveLinearSystemByIterativeMethods(double** A, double* b, double* x, int n, string methodStr, double abs_eps = 1.0E-12, double rel_eps = 1.0E-15, long max_iter_num = 10000000)
{
    int method = getMethod(methodStr);
    int iterCount = 0;
    switch(method)
    {
    case Jacobi:
        iterCount = solveByJacobi(A, b, x, n);
        break;
    case GaussSeidel:
        iterCount = solveByGaussSeidel(A, b, x, n);
        break;
    case ConjugateGradient:
        iterCount = solveByConjugateGradient(A, b, x, n);
        break;
    case PCG:
        iterCount = solveByPreconditionedConjugateGradient(A, b, x, n);
        break;
    case FFT:
        break;
    case MultiGrid:
        break;
    }
    return iterCount;
}
Пример #15
0
void Actions::loadJTextArea(){
    ui->comboBox->clear();
    ui->comboBox->addItem("onKeyPress");
    // добавить другие варианты здесь
    emit getMethod(0);
    
}
Пример #16
0
void FeiyuSdkHelper::doQuitRole(const char* serverId, const char* serverName, const char* roleId, const char* roleLv, 
    const char* roleName, const char* uid, const char* nickName, const char* extStr)
{
    JniMethodInfo mi;
    const char* signature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V";
    bool isHave = getMethod(mi, "doQuitRole", signature);
    if (isHave)
    {
        jstring serverId_content = mi.env->NewStringUTF(serverId);
        jstring serverName_content = mi.env->NewStringUTF(serverName);
        jstring roleId_content = mi.env->NewStringUTF(roleId);
        jstring roleLv_content = mi.env->NewStringUTF(roleLv);
        jstring roleName_content = mi.env->NewStringUTF(roleName);
        jstring uid_content = mi.env->NewStringUTF(uid);
        jstring nickName_content = mi.env->NewStringUTF(nickName);
        jstring extStr_content = mi.env->NewStringUTF(extStr);
        mi.env->CallStaticVoidMethod(mi.classID, mi.methodID, serverId_content, serverName_content, roleId_content, 
            roleLv_content, roleName_content, uid_content, nickName_content, extStr_content);
        mi.env->DeleteLocalRef(extStr_content);
        mi.env->DeleteLocalRef(roleId_content);
        mi.env->DeleteLocalRef(roleLv_content);
        mi.env->DeleteLocalRef(roleName_content);
        mi.env->DeleteLocalRef(serverId_content);
        mi.env->DeleteLocalRef(serverName_content);
        mi.env->DeleteLocalRef(nickName_content);
        mi.env->DeleteLocalRef(uid_content);
        releaseMethod(mi);
    }
}
		bool ShareRec::getLocalVideoPath(jlong videoId, char** path){
			jobject javaRecorder = getRecorder();
			if (javaRecorder != NULL) {
				JniMethodInfo mi;
				bool res = getMethod(mi, "getLocalVideoPath", "(J)Ljava/lang/String;");
				if (res) {
					jstring jpath = (jstring) mi.env->CallObjectMethod(javaRecorder, mi.methodID, videoId);
					releaseMethod(mi);
					
					if (jpath != NULL) {
						const char* cpath = mi.env->GetStringUTFChars(jpath, JNI_FALSE);
						int len = mi.env->GetStringUTFLength(jpath);
						char* tmp = (char*) malloc(sizeof(char) * len);
						for (int i = 0; i < len; i++) {
							tmp[i] = cpath[i];
						}
						path[0] = tmp;
						mi.env->ReleaseStringUTFChars(jpath, cpath);
						return true;
					}
				}
			}

			return false;
		}
Пример #18
0
void Actions::loadJComboBox(){
    ui->comboBox->clear();
    ui->comboBox->addItem("onSelectItem");
    // добавить другие варианты здесь
    emit getMethod(0);

}
Пример #19
0
void HttpMessageHandler::handle(struct ns_connection *nc, struct http_message *hm)	{
    std::string requestMethod = getMethod(hm);
    if (requestMethod.compare("GET") == 0)  {
        handleGet(nc, hm);
    }else if (requestMethod.compare("OPTIONS") == 0)  {
        sendOptions(nc);
    }
}
Пример #20
0
ReturnType ProvidedServicePort::callService(std::string &name,
		std::string &invalue, std::string &outvalue) {
	Method *p = getMethod(name);

	if (p == NULL)
		return OPROS_UNSUPPORTED_METHOD;

	return p->call(invalue, outvalue);
}
Пример #21
0
Method* rvmGetMethod(Env* env, Class* clazz, const char* name, const char* desc) {
    Method* method = getMethod(env, clazz, name, desc);
    if (rvmExceptionCheck(env)) return NULL;
    if (!method) {
        rvmThrowNoSuchMethodError(env, name);
        return NULL;
    }
    return method;
}
Пример #22
0
JavaMethod *JNIKit::getMethod(string declaredIn, string methodName, string desc) {
	// Resolve class and resolve method in succession
	JavaClass *declaringClass = getClass(declaredIn);

	if (!declaringClass)
		throw JNIError("could not resolve class from string");

	return getMethod(declaringClass, methodName, desc);
}
Пример #23
0
void TdeinterlaceSettings::createFilters(size_t filtersorder, Tfilters *filters, TfilterQueue &queue) const
{
    idffOnChange(idffs, filters, queue.temporary);
    if (is && show) {
        if (!queue.temporary) {
            setOnChange(IDFF_deinterlaceMethod, filters, &Tfilters::onQueueChange);
        }
        queueFilter<TimgFilterDeinterlace>(filtersorder, filters, queue);
        switch (getMethod(cfgId).id) {
            case BYPASS:
                break;
            case TOMSMOCOMP_DEINT_FILTER:
                queueFilter<TimgFilterTomsMoComp>(filtersorder, filters, queue);
                return;
            case DGBOB_DEINT_FILTER:
                queueFilter<TimgFilterDGbob>(filtersorder, filters, queue);
                return;
            case FRAMERATEDOUBLER:
                queueFilter<TimgFilterFramerateDoubler>(filtersorder, filters, queue);
                return;
            case DSCALER:
                queueFilter<TimgFilterDScalerDI>(filtersorder, filters, queue);
                return;
            case KERNELDEINT:
                queueFilter<TimgFilterKernelDeint2>(filtersorder, filters, queue);
                return;
            case KERNELBOB:
                queueFilter<TimgFilterKernelBob>(filtersorder, filters, queue);
                return;
            case YADIF:
                queueFilter<TimgFilterYadif>(filtersorder, filters, queue);
                return;
            default:
                queueFilter<TimgFilterAvcodecDeinterlace>(filtersorder, filters, queue);
                return; //mplayer deinterlacers
        }
    }
    if (getMethod(cfgId).id != YADIF || !is || !show) {
        // Inform yadif filter that it is no longer in the filter queue.
        // FIXME create more generic function that call Tfilter::onRemoveFromFilterQueue.
        TimgFilterYadif *imgFilterYadif = filters->getFilter<TimgFilterYadif>();
        imgFilterYadif->done();
    }
}
/**
 * Return paramter value for the given name.  If returned string is empty, it means that the parameter was not present.
 * If the returned string is SSOAgentRequest::EMPTY_PARAM, it means that the parameter is present, without a value.
 */
string SSOAgentRequest::getParameter(string pName) {

	if (params.empty()) {

		string qryStr = this->getQueryString();
		if (!qryStr.empty()) {
			// Read and parse query string into parameters.
			parseQueryString(qryStr);
			
		} else if (!strcmp(getMethod().c_str(), "POST")) {
			
			// Read and parse request body into parametsers.
			DWORD bodySz = this->getBodySize();
			
			if (bodySz > 0) {
				LPBYTE body = this->getBody();
				jk_log(logger, JK_LOG_DEBUG, "POST Request has a body, type=[%s] size=%d", getContentType().c_str(), bodySz);
				parsePostData(body, bodySz, this->getContentType());
			} else {
				jk_log(logger, JK_LOG_DEBUG, "POST Request has no body");
			}
			
		} else {
			jk_log(logger, JK_LOG_TRACE, "GET Request has no parameters, method [%s]", getMethod().c_str());
		}

		// Just for debugging purposes
		map<string, string>::iterator i;
		for (i = params.begin() ; i != params.end() ; i++) {
			pair <string, string> p = *i;
			jk_log(logger, JK_LOG_DEBUG, "Populating request with param %s=[%s]", p.first.c_str(), p.second.c_str());
		}
	} 

	map<string, string>::const_iterator params_it;
	params_it = params.find(pName);

	// Did we find the parameter ?!
	if (params_it == params.end()) {
		return SSOAgentRequest::EMPTY_STR;
	} else {
		return params_it->second;
	}
}
Пример #25
0
 unsigned int dtor(int) {
     C *c = (C *) this;
     C &cRef = *c;
     auto vt = VirtualTable<C, baseclasses...>::getVTable(cRef);
     unsigned int index = VTUtils::getDestructorOffset<C>();
     void *dtorPtr = vt.getMethod(index);
     void(*method)(C *) = union_cast<void (*)(C *)>(dtorPtr);
     method(c);
     return 0;
 }
Пример #26
0
void FeiyuSdkHelper::doLogin()
{
    JniMethodInfo mi;
    bool isHave = getMethod(mi, "doLogin", "()V");
    if (isHave)
     {
        mi.env->CallStaticVoidMethod(mi.classID, mi.methodID);
        releaseMethod(mi);
    }
}
Пример #27
0
void FeiyuSdkHelper::showExitGameDialog()
{
    JniMethodInfo mi;
    bool isHave = getMethod(mi, "showExitGameDialog", "()V");
    if (isHave)
     {
        mi.env->CallStaticVoidMethod(mi.classID, mi.methodID);
        releaseMethod(mi);
    }
}
Пример #28
0
void Transport::debuggerInfo(InfoVec &info) {
  Add(info, "Thread Type", getThreadTypeName());
  Add(info, "URL",         getCommand());
  Add(info, "HTTP",        getHTTPVersion());
  Add(info, "Method",      getMethodName());
  if (getMethod() == Method::POST) {
    int size; getPostData(size);
    Add(info, "Post Data", FormatSize(size));
  }
}
Пример #29
0
void FeiyuSdkHelper::doSetting(bool bOpen)
{
    JniMethodInfo mi;
    bool isHave = getMethod(mi, "doSetting", "(Z)V");
    if (isHave)
     {
        mi.env->CallStaticVoidMethod(mi.classID, mi.methodID, bOpen);
        releaseMethod(mi);
    }
}
		void ShareRec::stopRecorder() {
			jobject javaRecorder = getRecorder();
			if (javaRecorder != NULL) {
				JniMethodInfo mi;
				bool res = getMethod(mi, "stop", "()V");
				if (res) {
					mi.env->CallVoidMethod(javaRecorder, mi.methodID);
					releaseMethod(mi);
				}
			}
		}