如何使用 java 解决查询 firebase 中的非法字符

How to resolove illegal character in query firebase using java

我正在尝试使用 orderby 查询访问 firebase 数据库。我正在开发 restapi,使用它我可以在 java 中形成查询,但我不知道确切的无效字符在哪里;

https://xxxxxxxxx.firebaseio.com/access/in.json?orderBy="time_stamp"

java.lang.IllegalArgumentException: Illegal character in query at index 65: https://xxxxxxxxxx.firebaseio.com/access/in.json?orderBy="time_stamp"
java.net.URI.create(URI.java:852)
org.apache.http.client.methods.HttpGet.<init>(HttpGet.java:69)
net.thegreshams.firebase4j.service.Firebase.get_date(Firebase.java:149)
net.thegreshams.firebase4j.service.Firebase.get_date(Firebase.java:112)
net.thegreshams.firebase4j.demo.Demo.testREST(Demo.java:50)
com.data.firebase.FirebaseWSService.testREST(FirebaseWSService.java:67)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
com.sun.jersey.spi.container.JavaMethodInvokerFactory.invoke(JavaMethodInvokerFactory.java:60)
com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)
com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:708)
javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)`enter code here`

我在 apache 中遇到错误 tomcat,但是当我尝试传入 postman 时,sameurl 运行良好;

请给我一些建议;

是的,我可以解决这个问题,我只是对双引号值进行编码;

API url : /rest/search/FirebaseDB/"time_stamp"

在Java中: url = url + "orderBy="+ URLEncoder.encode(time_stamp, "UTF-8");