URL url = new URL("http://www.ya.ru"); InputStream strm = url.openStream(); InputStreamReader r = new InputStreamReader(strm); char[] charr = new char[1024]; int len = r.read(charr); String s = new String(charr, 0, len);
On 25 фев, 12:04, kghate <kgh...@gmail.com> wrote: > I am trying to get a simple URLFetchService example to work, here is > the code. > > URL url = new URL("http://www.google.com"); > URLFetchService urlFetchService = > URLFetchServiceFactory.getURLFetchService(); > HTTPRequest httpRequest = new HTTPRequest(url,HTTPMethod.GET); > HTTPResponse resp = urlFetchService.fetch(httpRequest); > System.out.println(resp.toString()); > > Getting a nullpointer in the "fetch" method > > java.lang.NullPointerException > at > com.google.appengine.api.urlfetch.URLFetchServiceImpl.fetch(URLFetchService > Impl.java: > 31) > > What am I missing? Please help.. -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.