我的字符串可以在RestTemplate的Spring交换和执行之间更改吗?

时间:2019-12-23 20:25:11

标签: kotlin resttemplate

我在测试中使用了这段代码,其中#include <stdio.h> #include <iostream> #include "SFML/Graphics.hpp" using namespace std; struct ellipse { sf::Text ellipseTitle; }; vector<ellipse> initialize(vector<ellipse> ellipses,unsigned short numberOfEllipses,sf::Font& myFont) { ellipse e; e.ellipseTitle.setFont(myFont); e.ellipseTitle.setCharacterSize(20); e.ellipseTitle.setFillColor(sf::Color::White); for(int i=0;i<numberOfEllipses;i++) { e.ellipseTitle.setString("[Some text "+to_string(i)+"]"); sf::FloatRect textRect = e.ellipseTitle.getLocalBounds(); e.ellipseTitle.setOrigin(textRect.left + textRect.width/2.0f,textRect.top + textRect.height/2.0f); e.ellipseTitle.setPosition(sf::Vector2f(100,100+(20*i))); ellipses.push_back(e); } return ellipses; } int main() { sf::RenderWindow window(sf::VideoMode(640,480), "Demo",sf::Style::Default); unsigned short numberOfEllipses=11; sf::Font myFont; string myfontFileName="./media/Arial.ttf"; if (!myFont.loadFromFile(myfontFileName)) { cout << "Could not find the font " << myfontFileName << endl; return EXIT_FAILURE; } vector<ellipse> ellipses; ellipses=initialize(ellipses,numberOfEllipses,myFont); sf::Event myEvent; while (window.isOpen()) { while (window.pollEvent(myEvent)) { if (myEvent.type == sf::Event::EventType::Closed) { window.close(); } } window.clear(); for(ellipse e:ellipses) { cout << "title " << e.ellipseTitle.getString().toAnsiString() << endl; window.draw(e.ellipseTitle); } window.display(); } return EXIT_SUCCESS; }``` 实际上是一个字符串。网址指向我上传的亚马逊的S3图片。

url

第一个调用结果进入rest.exchange(url, HttpMethod.GET, HttpEntity(null, HttpHeaders()), ByteArray::class.java) val file = rest.execute(URI(url), HttpMethod.GET, null, ResponseExtractor { val tmpFile = File.createTempFile("media", tmpFileName) StreamUtils.copy(it.body, FileOutputStream(tmpFile)) tmpFile }) 。后者返回200。

比较http调用中使用的两个结果字符串,我得到了这个差异(因为它是从工作的,因此是机密的,因此不会发布整个URL):

Error parsing the X-Amz-Credential parameter; the Credential is mal-formed; expecting "<YOUR-AKID>/YYYYMMDD/REGION/SERVICE/aws4_request"

此行为可能是什么原因?

0 个答案:

没有答案