Announcement Announcement Module
Collapse
No announcement yet.
Problem using Android RestTemplate Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem using Android RestTemplate

    I've added the Android RestTemplate to my android application. I have a client app that looks like this:

    Code:
    public BaseMessageModel invokeGet(String uri, Class<? extends BaseMessageModel> responseType)  throws RestException
        {
            try
            {
                String url = getUri(uri);
                LOG.debug("Invoking GET:{}", url);
                BaseMessageModel response = restOperations.getForObject(url, responseType, eid);
                LOG.debug("Receieved response:{}", response);
                return response;
            }
            catch (Exception e)
            {
                throw new RestException("Invocation failed", e);
            }
        }
    When I run this code in a JVM and point it at my server which has a REST endpoint it works fine. When I deploy this in an emulator and try and get the emulator to talk to my server it always times out.

    Curiously, when I see the application code make the request, I don't see any log output on my server UNTIL the request times out and throws a socket timeout exception. Then I see the request hit my server. It's almost like the request isn't being flushed in the emulator until the connection is closed?

    I'd appreciate any input...

  • #2
    Re: Problem using Android RestTemplate

    What is the URI when you run it in the emulator? It cannot be "localhost".

    Comment


    • #3
      Sorry...this was a misconfiguration on our end.

      Comment

      Working...
      X