- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试访问可以使用 curl 对其进行测试的 Rest 资源
id 长度应为 11 个字符
如果 id 的长度小于 11 例如 '12345'
https://somesite.com:7677/something/id/ {id} iam 从我的 java 代码和 curl 中得到 404 HTTP 错误,这是预期的
如果 id 的长度等于 11 并且它是无效的 id
然后我从 curl 和 java 得到相同的响应
但是如果我给出 curl 已经存在的有效 id
我得到了正确的 json 响应,但是当我试图从 restTemplate 访问 Rest 资源时,它显示错误,如下所示
The request sent by the client was syntactically incorrect (). and there are no error logs for this request
<bean id="restTemplate" class="org.springframework.web.client.RestTemplate">
<property name="messageConverters">
<list>
<ref bean="jsonHttpMessageConverter" />
</list>
</property>
</bean>
public List<Account> getAccounts(PersonNumber personNumber) {
logger.warn("Inside getAccounts of TransferAgreement client");
String url = "https://somesite.com:7677/something/id/12345";
logger.warn("URL acessing "+personNumber.toString()+" URL "+ url);
String a = restTemplate.getForObject(url, String.class);
System.out.println(a);
return null;
}
最佳答案
假设您正在使用 Eclipse。
为 Spring 启用日志记录
关于Spring RestTemplate 初学者 : The request sent by the client was syntactically incorrect (),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10247869/
我编写了以下代码来测试同步 RestTemplate 和 AsyncRestTemplate 的性能。我只是在 POSTMAN 上手动运行了几次。 我们只是将 10 个引用传递给 GET 调用,以便我
这种方式创建RestTemplate有什么区别 RestTemplate restTemplate = restTemplateBuilder .setConnectT
这个问题已经有答案了: IllegalArgumentException: Not enough variable values available with RestTemplate? (2 个回答
这是我的应用程序的主类 @SpringBootApplication (scanBasePackages = { "com.xyz.*" }) @EnableAsync @EnableAspectJA
我当前的代码: RestTemplate restTemplate = new RestTemplate(); restTemplate.getMessageConverters().add(new
我将开发一个简单的 Spring MVC Web 应用程序,它将使用 Heroku 上的远程 RESTful 服务。 我希望 MVC Web 应用程序根据 Controller 调用 REST 服务。
项目场景: Spring 的 RestTemplate 是一个健壮的、流行的基于 Java 的 Http客户端。 RestTemplate实现request param参数传送,如果如下所示,直接传一
我想通过 RestTemplate 发送请求。但是我的网址有大括号('{','}'),因此我有异常(exception):“没有足够的变量值可用于扩展......”。 我尝试通过 uri UriCom
有一个 RestFull 方法返回一个菜单对象列表 public ResponseEntity> getMenus() { .. } 但我不知道如何从 RestTemplate 中获取它们,从 Res
摘要: RestTemplate与REST资源交互的方法涵盖了HTTP请求方法,包括get, post, put, delete。 本文分享自华为云社区《Springboot RestTemplate
我有一个 springboot 休息服务 A 使用 restTemplate 调用休息服务 B。休息服务 A 的 restTemplate bean 创建如下,超时设置如下面的代码片段所示。 @Bea
我有一个 @Service有几种方法,每种方法使用不同的 web api。每个调用都应该有一个自定义的读取超时。 拥有一个 RestTemplate 实例并在每个方法中通过工厂更改超时是否是线程安全的
这是我的休息模板配置, @Bean @Qualifier("myRestService") public RestTemplate createRestTemplate(@Va
是否可以使用 RestTemplateBuilder 创建仅带有不记名 header 和 token 的 RestTemplate 实例? 我知道我可以使用 RestTemplate 交换并在 Htt
我正在尝试对请求正文执行 DELETE,但我不断收到 400(错误请求)错误。当我在 swagger/postman 中这样做时,它成功地删除了记录。但是从 Java 代码我不能这样做 外部 API
我需要创建 RestTemplate 请求,它将发送图像以通过 PHP 应用程序上传。 我的代码是: Resource resource = new FileSystemResource("/User
我正在使用 swagger codegen ( on this Zoura swagger ) 创建 Java/rest 模板客户端。我正在使用 swagger Gradle 插件: id "org.
我有Restful API,当找不到某个项目时会响应404错误,但是根据未找到该项目的原因(未知,不可用等),会有不同的消息,可以使用Spring MVC通过以下方式完成: response.send
我正在使用 Spring 中的 RestTemplate 来查询搜索服务。我在进行正确的序列化方面遇到了一些困难。如果我使用此方法,restTemplate 将返回一个列表。我不明白如何传递参数化类型
我们有这样的代码,它使用 OData 来指定资源(为简单起见,在此处使用公司代码进行硬编码): String uri = "[my_endpoint]/companyprofiles.read?$fi
我是一名优秀的程序员,十分优秀!