My guess would be that you need to run your searchString variable  
through Java.Net.URLEncode to encode spaces and other special  
characters.

Jeremy R. Geerdes
Effective website design & development
Des Moines, IA

For more information or a project quote:
http://jgeerdes.home.mchsi.com
http://jgeerdes.blogspot.com
http://jgeerdes.wordpress.com
[email protected]

Unless otherwise noted, any price quotes contained within this  
communication are given in US dollars.

If you're in the Des Moines, IA, area, check out Debra Heights  
Wesleyan Church!

And check out my blog, Adventures in Web Development, at 
http://jgeerdes.blogspot.com 
  !


On Apr 19, 2009, at 4:15 AM, Jagadeesh kasiram wrote:

>
> HI,
>
>
> This is the query i am using to access the search.
>
> // some code goes here
>
>       String 
> text="http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q= 
> "+searchString;
>
>     GetMethod get = new GetMethod(text);
>
>     HttpClient client = new HttpClient();
>     client.executeMethod(get);
>
>     String result=get.getResponseBodyAsString();
>
>     get.releaseConnection();
>     response.getWriter().print(result);
>
> // some code goes here
>
>
> if i give like this i am getting correctly
> searchString = "java"
>
>
> If i give like this i am getting following error
>
> 1)searchString = " java swing "
> 2)searchString = " How to create jar file "
>
> i mean if u give more than two or three word means , this error  
> occuring, what shall do,
>
>
> [WARN] StandardWrapperValve[shell]: Servlet.service() for servlet  
> shell threw exception
> java.lang.IllegalArgumentException: Invalid uri 
> 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=ipl 
>  time': Invalid query
>     at  
> org 
> .apache.commons.httpclient.HttpMethodBase.<init>(HttpMethodBase.java: 
> 222)
>     at  
> org 
> .apache.commons.httpclient.methods.GetMethod.<init>(GetMethod.java:89)
>     at  
> com 
> .search.server.GoogleSearchService.service(GoogleSearchService.java: 
> 47)
>     at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>     at  
> com 
> .google.gwt.dev.shell.GWTShellServlet.service(GWTShellServlet.java: 
> 289)
>     at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>     at  
> org 
> .apache 
> .catalina 
> .core 
> .ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java: 
> 237)
>     at  
> org 
> .apache 
> .catalina 
> .core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
>     at  
> org 
> .apache 
> .catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java: 
> 214)
>     at  
> org 
> .apache 
> .catalina 
> .core.StandardValveContext.invokeNext(StandardValveContext.java:104)
>     at  
> org 
> .apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 
> 520)
>     at  
> org 
> .apache 
> .catalina 
> .core.StandardContextValve.invokeInternal(StandardContextValve.java: 
> 198)
>     at  
> org 
> .apache 
> .catalina.core.StandardContextValve.invoke(StandardContextValve.java: 
> 152)
>     at  
> org 
> .apache 
> .catalina 
> .core.StandardValveContext.invokeNext(StandardValveContext.java:104)
>     at  
> org 
> .apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 
> 520)
>     at  
> org 
> .apache 
> .catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
>     at  
> org 
> .apache 
> .catalina 
> .core.StandardValveContext.invokeNext(StandardValveContext.java:104)
>     at  
> org 
> .apache 
> .catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
>     at  
> org 
> .apache 
> .catalina 
> .core.StandardValveContext.invokeNext(StandardValveContext.java:102)
>     at  
> org 
> .apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 
> 520)
>     at  
> org 
> .apache 
> .catalina.core.StandardEngineValve.invoke(StandardEngineValve.java: 
> 109)
>     at  
> org 
> .apache 
> .catalina 
> .core.StandardValveContext.invokeNext(StandardValveContext.java:104)
>     at  
> org 
> .apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 
> 520)
>     at  
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
>     at  
> org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java: 
> 160)
>     at  
> org 
> .apache.coyote.http11.Http11Processor.process(Http11Processor.java: 
> 799)
>     at org.apache.coyote.http11.Http11Protocol 
> $Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
>     at  
> org 
> .apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java: 
> 577)
>     at org.apache.tomcat.util.threads.ThreadPool 
> $ControlRunnable.run(ThreadPool.java:683)
>     at java.lang.Thread.run(Unknown Source)
>
>
>
> what is the error, How to rectify it.
>
> Help me to correct the error.
>
> Regards
> Jag
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google AJAX APIs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-AJAX-Search-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to