[
https://issues.apache.org/jira/browse/SCB-775?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16556825#comment-16556825
]
ASF GitHub Bot commented on SCB-775:
------------------------------------
liubao68 commented on a change in pull request #837: [SCB-775]support invoke
service using raw type like JsonObject & String
URL:
https://github.com/apache/incubator-servicecomb-java-chassis/pull/837#discussion_r205319690
##########
File path:
demo/demo-schema/src/main/java/org/apache/servicecomb/demo/RestObjectMapperWithStringMapper.java
##########
@@ -56,7 +60,11 @@ public RestObjectMapperWithStringMapper() {
public <T> T convertValue(Object fromValue, JavaType toValueType) throws
IllegalArgumentException {
if (String.class.isInstance(fromValue)
&& !BeanUtils.isSimpleValueType(toValueType.getRawClass())) {
- return super.convertValue(new JsonObject((String) fromValue),
toValueType);
+ try {
+ return super.readValue((String) fromValue, toValueType);
+ } catch (IOException e) {
+ LOGGER.error("Failed to convert value for {}.", e.getMessage());
Review comment:
I mean go on. Seems better.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> support invoke service using raw type like JsonObject
> -----------------------------------------------------
>
> Key: SCB-775
> URL: https://issues.apache.org/jira/browse/SCB-775
> Project: Apache ServiceComb
> Issue Type: New Feature
> Components: Java-Chassis
> Reporter: liubao
> Assignee: liubao
> Priority: Major
>
> When using RestTemplate, can use JsonObject or String as request body
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)