problem solved. I was referencing the app engine/gwt project from a console app. apparently you can't do this. when I debug it as a google app project, it works. hope this minor pain and lesson will help someone else someday. thanks, David
On Feb 19, 2:13 pm, davidnelson <[email protected]> wrote: > more info, I tried using the app engine version 1.3.0 and that's when > I get nullpointerexceptions. switching back to 1.3.1 and I get the > first exception I initially posted, sync or async. > > On Feb 19, 1:37 pm, Eli Jones <[email protected]> wrote: > > > > > I don't code in Java.. but my guess is you're making a silly mistake in > > there somewhere.. > > > Copy pasting some other person's posted code from the Java AppEngine group I > > see it done this way: > > > URL url = new URL(urlStr); > > URLFetchService urlFetchService = > > URLFetchServiceFactory.getURLFetchService(); > > HTTPRequest httpRequest = new > > HTTPRequest(url, HTTPMethod.GET,followRedirects()); > > HTTPResponse response = urlFetchService.fetch(httpRequest); > > > On Fri, Feb 19, 2010 at 4:27 PM, davidnelson < > > > [email protected]> wrote: > > > weird, I get the same error even when I pin objects and call urlfetch > > > synchronously: > > > > url = new URL(urlString); > > > request = new HTTPRequest(url); > > > request.addHeader(userAgentHeader); > > > request.addHeader(authorizationHeader); > > > request.addHeader(acceptEncodingHeader); > > > request.addHeader(acceptCharsetHeader); > > > // undo pinning after debug > > > HTTPResponse response = > > > urlFetchService.fetch(request); > > > byte[] responseBytes = > > > response.getContent(); > > > String responseString = new > > > String(responseBytes); > > > parseResponse(responseString); > > > apiCallsMade++; > > > > On Feb 19, 7:33 am, Conor Power <[email protected]> wrote: > > > > apologies if I'm a little vague in my reply but I remember receiving > > > > something similar when I first started using the URLFetchService and I > > > think > > > > it was related to the fact that I had imported the incorrect classes for > > > > HTTPRequest or header or something like like. I think I just chose the > > > first > > > > one offered to me by the IDE ... > > > > > It was a while ago so I hope I'm not sending you on a wild goose chase. > > > > > On Fri, Feb 19, 2010 at 4:52 AM, davidnelson < > > > > > [email protected]> wrote: > > > > > Hi, > > > > > > I'm trying to implement async http in java. Here is the important > > > > > part of the code: > > > > > > for (String urlString : urls) > > > > > { > > > > > // TODO: try and get rid of these two > > > heap > > > > > allocations > > > > > url = new URL(urlString); > > > > > request = new HTTPRequest(url); > > > > > request.addHeader(userAgentHeader); > > > > > request.addHeader(authorizationHeader); > > > > > > > > > > request.addHeader(acceptEncodingHeader); > > > > > request.addHeader(acceptCharsetHeader); > > > > responses.add(URLFetchServiceFactory.getURLFetchService().fetchAsync(reques > > > t)); > > > > > apiCallsMade++; > > > > > } > > > > > for (Future<HTTPResponse> futureResponse : > > > > > responses) > > > > > { > > > > > parseResponse(new > > > > > String(futureResponse.get().getContent())); > > > > > } > > > > > > I keep getting this error: "com.google.apphosting.api.ApiProxy > > > > > $CallNotFoundException: The API package 'urlfetch' or call 'Fetch()' > > > > > was not found.". I looked around for any jars that were missing from > > > > > the classpath but didn't see anything missing. Do you know which jar > > > > > that code is in? I googled the error and also searched through this > > > > > group but found nothing. > > > > > > Thanks, > > > > > David > > > > > > -- > > > > > You received this message because you are subscribed to the Google > > > Groups > > > > > "Google App Engine" group. > > > > > To post to this group, send email to [email protected] > > > . > > > > > To unsubscribe from this group, send email to > > > > > [email protected]<google-appengine%2Bunsubscrib > > > > > [email protected]><google-appengine%2Bunsubscrib > > > [email protected]> > > > > > . > > > > > For more options, visit this group at > > > > >http://groups.google.com/group/google-appengine?hl=en. > > > > -- > > > You received this message because you are subscribed to the Google Groups > > > "Google App Engine" group. > > > To post to this group, send email to [email protected]. > > > To unsubscribe from this group, send email to > > > [email protected]<google-appengine%2Bunsubscrib > > > [email protected]> > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/google-appengine?hl=en. -- You received this message because you are subscribed to the Google Groups "Google App Engine" 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-appengine?hl=en.
