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

  • Home
  • SEARCH
  • 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 3675678
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T03:00:22+00:00 2026-05-19T03:00:22+00:00

I am having a weird problem with a small restlet service that I am

  • 0

I am having a weird problem with a small restlet service that I am building as an exercise. The application is supposed to respond with some XML (specifically TwiML, as it is meant for Twilio) on an HTTP POST, and it worked well for standalone requests. However, when requested by Twilio, the response never completes and it times out. After comparing the traffic coming from Twilio with the one that is working (using a fake HTML form), I isolated the issue to the “Connection: close” header and can reproduce it using nothing but curl command-line. Here is the request that works:

curl -i -H 'Connection: keep-alive' -X POST -d "name=value" http://localhost:8020/hello

and here is the one that just hangs:

curl -i -H 'Connection: close' -X POST -d "name=value" http://localhost:8020/hello

If I kill the server then curl says “(52) Empty reply from server”. Here is the code that I am using in the ServerResource:

@Post
public Representation hello(Representation repr)
{
    Representation result = new StringRepresentation(("<Response>\n"+
            "   <Say>Hello. This is a test.</Say>\n"+
            "</Response>"), MediaType.APPLICATION_XML);
    return result;
}

Is something obviously wrong with what I am doing here? I am using restlet-2.0, but also tried with 2.1m1 with the same result. I would really appreciate a quick response as I am on a deadline to finish the exercise.

  • 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-19T03:00:22+00:00Added an answer on May 19, 2026 at 3:00 am

    not sure if you found a solution for your error, but I came across the same problem in Restlet V 2.0.4.

    When running the restlet using the default server. Here the server does assume that the response stream is not writable and thus will not respond with an entity.

    As a quick fix I located

      org.restlet.engine.http.connector.Connection
    

    and changed the the canWrite() method to

    public boolean canWrite() { 
        return (
                 (getState() == ConnectionState.OPEN) 
                         || (getState() == ConnectionState.CLOSING)) 
                && !isOutboundBusy() 
                && (getOutboundMessages().size() > 0); 
    } 
    

    from the original

    public boolean canWrite() { 
        return (getState() == ConnectionState.OPEN) && !isOutboundBusy() 
                && (getOutboundMessages().size() > 0); 
    }
    

    Not sure if that is a good fix, but after recompiling the restlet module it now seems to work fine.
    It seems to be the issue that when specifying the HTTP Header ‘Connection: close’ the stream is by default in closing state.

    Hope that helps

    Joey

    See here for the problem on the restlet forum

    http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2698048

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having a weird problem. I'm testing an ASP.NET application I wrote that queries SQL
This is a really weird problem that I have been having. When I download
I'm new to Ruby, so I'm having some trouble understanding this weird exception problem
Having a weird problem here. Everybody knows that if you use web.config's customErrors section
I am having a very weird problem with building a SQL Server 2008 Database
I am having a weird problem with pointers .I am building a k-d tree
I'm having an extremely weird problem with a PHP script of mine. I'm uploading
This is a weird problem I have started having recently. My team is developing
I'm having some weird issues with Xcode, and this is pretty much impossible to
I'm having a really really weird problem with a web app I'm programming. Basically,

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.