实际上我正在从一个播放应用程序重定向到另一个播放应用程序,最后我收到作为结果对象的响应..下面是两个应用程序中的操作。我正在从应用程序 1 重定向到应用程序 2。应用程序 2 将返回我需要提取的 JSON 字符串。
如何从 Result 对象中检索 JSON 内容?
应用1:
public static Result redirectTest(){
Result result = redirect("http://ipaddress:9000/authenticate");
/*** here I would like to extract JSON string from result***/
return result;
}
Run Code Online (Sandbox Code Playgroud)
应用2:
@SecuredAction
public static Result index() {
Map<String, String> response = new HashMap<String, String>();
DemoUser user = (DemoUser) ctx().args.get(SecureSocial.USER_KEY);
for(BasicProfile basicProfile: user.identities){
response.put("name", basicProfile.firstName().get());
response.put("emailId", basicProfile.email().get());
response.put("providerId", basicProfile.providerId());
response.put("avatarurl", basicProfile.avatarUrl().get());
}
return ok(new JSONObject(response).toString());
}
Run Code Online (Sandbox Code Playgroud) 我正在寻找Titan和Spark-GraphX之间的区别,哪一个最好用.我用Google搜索了,但没有得到关于此的文章
有人可以提供指针吗?
我试图使用下面的代码将Titan图数据导出到JSON文件
TitanGraph titanGraph = TitanFactory.open("D:/Dev/Titan/titan-1.0.0-hadoop1/conf/titan-cassandra.properties");
FileOutputStream outJSON = new FileOutputStream("D:/titan-graph.json");
GraphSONWriter.build().create().writeGraph(outJSON, titanGraph);
Run Code Online (Sandbox Code Playgroud)
运行此代码获取异常时:
Exception in thread "main" com.fasterxml.jackson.databind.JsonMappingException: (was java.lang.IllegalStateException) (through reference chain: com.thinkaurelius.titan.graphdb.relations.RelationIdentifier["inVertexId"])
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:210)
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:177)
at com.fasterxml.jackson.databind.ser.std.StdSerializer.wrapAndThrow(StdSerializer.java:187)
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:647)
at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:152)
at org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONUtil.writeWithType(GraphSONUtil.java:49)
at org.apache.tinkerpop.gremlin.structure.util.star.StarGraphGraphSONSerializer.ser(StarGraphGraphSONSerializer.java:100)
at org.apache.tinkerpop.gremlin.structure.util.star.StarGraphGraphSONSerializer.serialize(StarGraphGraphSONSerializer.java:64)
at org.apache.tinkerpop.gremlin.structure.util.star.StarGraphGraphSONSerializer.serialize(StarGraphGraphSONSerializer.java:54)
at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:128)
at com.fasterxml.jackson.databind.ObjectMapper._configAndWriteValue(ObjectMapper.java:2881)
at com.fasterxml.jackson.databind.ObjectMapper.writeValue(ObjectMapper.java:2304)
at org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONWriter.writeVertex(GraphSONWriter.java:76)
at org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONWriter.writeVertices(GraphSONWriter.java:104)
at org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONWriter.writeGraph(GraphSONWriter.java:65)
at com.mimos.titan.TitanGraphTest.main(TitanGraphTest.java:29)
Caused by: java.lang.IllegalStateException
at com.google.common.base.Preconditions.checkState(Preconditions.java:158)
at com.thinkaurelius.titan.graphdb.relations.RelationIdentifier.getInVertexId(RelationIdentifier.java:69)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:466)
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:639)
... …Run Code Online (Sandbox Code Playgroud)