How to resolove illegal character in query firebase using java

Varun_Rathinam :

I'm trying to access firebase database with orderby query. im developing restapi, Using that i can able to form the query in java, but i dont know where exactly invalid character is present;

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$1.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`

i got error in apache tomcat, but sameurl when i try to pass in postman it works good;

Please give me some suggestion;

Varun_Rathinam :

Yeah i can able to resolve this issue, im just encoding the double quotes values;

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

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

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=161333&siteId=1