我有一個用Jolie編寫的服務,我希望根據請求提取http頭文件。以同樣的方式可以打印出request.id,我想打印標題。試着在代碼中使用粗體字。這裏代碼:如何在Jolie編程語言服務上獲取http頭文件
execution { concurrent }
inputPort UserDB_Service {
Location: "socket://localhost:8002/"
Protocol: http { .format = "json"}
Interfaces: Users, ShutdownInterface, ConnectionPool
}
outputPort DB_Connector {
Location: "socket://localhost:1000/"
Protocol: sodep
Interfaces: ConnectionPool
}
init
{
[email protected]_Connector()(connectionInfo);
[email protected](connectionInfo)()
}
main
{
//Example: http://localhost:8002/retrieve?id=1
[ retrieve(request)(response) {
[email protected](
"select * from users where user_id=:id" {
.id = request.id
}
)(sqlResponse);
[email protected]("You have requested the user_id: " + request.id)();
**[email protected]("Request Headers: " + response.format)();**
if (#sqlResponse.row == 1) {
response -> sqlResponse.row[0]
}
} ]
}
感謝您的幫助。
它沒有把大膽,但在接下來的格式:**調用println @控制檯( 「請求頭:」 + request.format)(); ** 而且它的請求,沒有迴應。對於混淆的爭論抱歉。這是我想要的請求標題。 –
這個問題措辭不好,沒有太大意義,但我投了贊成票,因爲它似乎是關於jolie的第一個問題,這似乎是一種有趣的語言。 – exebook