Alex Blakemore
Alex Blakemore

Reputation: 11906

JBoss stripping HTTP response message body when HTTP status is not 200

I'm trying to deploy a Rails 3.2 app on JBOSS AS 7.1, using JRuby 1.6.6.

When the Rails controller sets a status code for the HTTP response header to anything other than 200, all the text from the response body is stripped -- apparently by JBoss. The problem does not occur under WebBrick.

Here is a little code to illustrate:

def show
  # The text below is never displayed when app deployed under JBoss
  render :text => "Hello user, send a better id next time", :status => :not_found
end

Any idea why JBoss might be eating the message body for the response?

If it's trying to optimize, that seems in violation of (at least the spirit) of the HTTP spec, which says 404 packets may contain message bodies.

Setting the status correctly is useful for automating testing among other things.

Upvotes: 0

Views: 312

Answers (1)

Alex Blakemore
Alex Blakemore

Reputation: 11906

I'm not sure whether this is the solution, or just a coincidence, but I increased the heap size and PermGen memory by setting JAVAOPTS and afterwards this problem went away.

The switches that worked were:

JAVA_OPTS=-Xms512m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=256m

Upvotes: 0

Related Questions