Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7180325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:19:24+00:00 2026-05-28T17:19:24+00:00

I am developing a play web application which is supposed to be deployed on

  • 0

I am developing a play web application which is supposed to be deployed on Google app engine. I am trying to send a request to another server than process the respond. On my localhost it is working perfectly however I have difficulties when I test it on GAE. The code is the following:

import com.google.appengine.repackaged.org.apache.http.HttpResponse;
import com.google.appengine.repackaged.org.apache.http.client.methods.HttpGet;
import com.google.appengine.repackaged.org.apache.http.conn.scheme.PlainSocketFactory;
import com.google.appengine.repackaged.org.apache.http.conn.scheme.Scheme;
import com.google.appengine.repackaged.org.apache.http.conn.scheme.SchemeRegistry;
import com.google.appengine.repackaged.org.apache.http.impl.client.DefaultHttpClient;
import com.google.appengine.repackaged.org.apache.http.impl.conn.SingleClientConnManager;
import com.google.appengine.repackaged.org.apache.http.params.BasicHttpParams;

public class Getter{

public static byte[] getStuff(){
    
    String urlString = "http://example.com/item?param=xy";

    SchemeRegistry schemeRegistry = new SchemeRegistry(); 
    schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80)); 
    BasicHttpParams params = new BasicHttpParams(); 
    SingleClientConnManager connmgr = new SingleClientConnManager(params, schemeRegistry); 
    DefaultHttpClient client = new DefaultHttpClient(connmgr, params); 
    

    HttpGet get = new HttpGet(urlString);
    byte[] buf = null;
    try {   
        HttpResponse resp = client.execute(get);
        buf = new byte[(int) resp.getEntity().getContentLength()];
        resp.getEntity().getContent().read(buf);
    } catch (Exception e) {
        System.out.println("There was a problem.");
        e.printStackTrace();
    }
    return buf;
}

}

The sad thing is that I don’t get any error message with e.printStackTrace();. On GAE the log prints out "There was a problem". I tried many implementation after researched but couldn’t get any of them running.
I appreciate any kind of help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T17:19:26+00:00Added an answer on May 28, 2026 at 5:19 pm

    UPDATE:

    Before abandoning your current URL Fetch library, make sure that the server is publicly accessible. Note that the App Engine development server uses the network configuration of your computer when making requests; thus, if the URL you’re trying to fetch from is accessible to your network but not outside the network, then this could cause problems.

    If you’ve verified that the URL is indeed publicly accessible, then please read on:

    Fetching URLs with Google App Engine in Java:

    Google App Engine has a very clear set of requirements for making HTTP requests from App Engine. While other methods may work from your local development server; oftentimes, those same methodologies don’t work in production.

    Check out the URLFetch documentation. It outlines at least two different ways of using either the low level URLFetch service or the java.net library to make an HTTP request.

    Below is an example using java.net, which I’ve found to be highly reliable:

    import java.net.MalformedURLException;
    import java.net.URL;
    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    import java.io.IOException;
    
    // ...
        try {
            URL url = new URL("http://www.example.com/atom.xml");
            BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
            String line;
    
            while ((line = reader.readLine()) != null) {
                // ...
            }
            reader.close();
    
        } catch (MalformedURLException e) {
            // ...
        } catch (IOException e) {
            // ...
        }
    

    HTTP POST:

    import java.net.HttpURLConnection;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.net.URLEncoder;
    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    import java.io.IOException;
    import java.io.OutputStreamWriter;
    
        // ...
        String message = URLEncoder.encode("my message", "UTF-8");
    
        try {
            URL url = new URL("http://www.example.com/comment");
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setDoOutput(true);
            connection.setRequestMethod("POST");
    
            OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream());
            writer.write("message=" + message);
            writer.close();
    
            if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
                // OK
            } else {
                // Server returned HTTP error code.
            }
        } catch (MalformedURLException e) {
            // ...
        } catch (IOException e) {
            // ...
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a web app using the play! framework and morphia/mongodb. I'm trying to
When developing a new web based application which version of html should you aim
I am about 70% of the way through developing a web application which contains
I am developing an application in which I have to perform three functions play,
I am developing an application in which I used VideoView to play a video.
I am developing a web application with Play! Framework using Notepad++ on windows xp.
I am developing an iPhone application in which I play videos using MPMoviePlayerController .
Ok, I have been thinking of developing a web application using the play framework
Developing server side code i finally got my eyes X-crossed trying to write -
When developing whether its Web or Desktop at which point should a developer switch

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.