我试图在Java中创建一个简单的HttpServer来处理GET请求,但是当我尝试获取请求的GET参数时,我注意到HttpExchange类没有方法.
有没有人知道一种简单的方法来读取GET参数(查询字符串)?
这是我的处理程序的样子:
public class TestHandler{
@Override
public void handle(HttpExchange exc) throws IOxception {
String response = "This is the reponse";
exc.sendResponseHeaders(200, response.length());
// need GET params here
OutputStream os = exc.getResponseBody();
os.write(response.getBytes());
os.close();
}
}
Run Code Online (Sandbox Code Playgroud)
..和主要方法:
public static void main(String[] args) throws Exception{
// create server on port 8000
InetSocketAddress address = new InetSocketAddress(8000);
HttpServer server = new HttpServer.create(address, 0);
// bind handler
server.createContext("/highscore", new TestHandler());
server.setExecutor(null);
server.start();
}
Run Code Online (Sandbox Code Playgroud) 我计划使用 Liquibase( https://www.liquibase.org ) 来管理 Oracle 数据库模式的迁移/版本控制。该项目在 Python 中使用 setuptools。我还看到了 Liquibase 的 Python 包装器,但它们似乎没有得到很好的维护。
有没有人有在 python 项目中集成 Liquibase 的经验?或者类似的?
我打算用RabbitMQ,Symfony2和RabbitMqBundle编写一个日志处理应用程序.我正在处理的工具必须具有高可用性并且每天必须处理数百万个条目,因此消费者始终处于运行状态(短暂休息很好)非常重要,否则我的队列可能会在一段时间后溢出.
是否有关于如何管理使用者的最佳实践(用PHP编写),在出现错误时启动/重启它们等?
谢谢
我在 Symfony2(兔子消费者)中有一个长时间运行的进程,我正在使用MonologBundle进行日志记录。这些行会立即记录下来,但我注意到进程的内存消耗随着每次迭代而增加,几分钟后达到 1GB 以上。
脚本运行:--env=prod
所以我做了一个较小的测试:
// taken from my symfony test command
$logger = $this->getContainer()->get('logger');
while (true){
$logger->debug("line one");
$logger->debug("line two");
$logger->debug("line three");
var_dump($logger);
}
Run Code Online (Sandbox Code Playgroud)
这是大约 10k 次迭代后的 var_dump 内容:
class Symfony\Bridge\Monolog\Logger#3 (3) {
protected $name =>
string(3) "app"
protected $handlers =>
array(1) {
[0] =>
class Monolog\Handler\FingersCrossedHandler#132 (11) {
protected $handler =>
class Monolog\Handler\StreamHandler#133 (9) {
...
}
protected $activationStrategy =>
class Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy#134 (1) {
...
}
protected $buffering =>
bool(true)
protected $bufferSize =>
int(0)
protected …Run Code Online (Sandbox Code Playgroud) rabbitmq ×2
symfony ×2
get ×1
httpserver ×1
java ×1
liquibase ×1
mariadb ×1
memory-leaks ×1
monolog ×1
mysql ×1
oracle ×1
python ×1
query-string ×1