[jboss-jira] [JBoss JIRA] Created: (JBPORTAL-2368) Setting the ResourceResponse.HTTP_STATUS_CODE property does not modify the actual server response status code

Philip Kedy (JIRA) jira-events at lists.jboss.org
Mon Apr 13 08:59:22 EDT 2009


Setting the ResourceResponse.HTTP_STATUS_CODE property does not modify the actual server response status code
-------------------------------------------------------------------------------------------------------------

                 Key: JBPORTAL-2368
                 URL: https://jira.jboss.org/jira/browse/JBPORTAL-2368
             Project: JBoss Portal
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: Portal Core
    Affects Versions: 2.7.2 Final
         Environment: Not appropriate for this issue
            Reporter: Philip Kedy
            Priority: Minor


If you set the ResourceResponse.HTTP_STATUS_CODE property of the ResourceResponse object, the status remains unchanged.  Without this capability ajax calls return 200 Success even if you set an error.

This is an additional tweak related to bug #2242

In the class org.jboss.portal.core.controller.handler.HTTPResponse I made the following tweak to both HTTPResponse.sendResponse methods.  This assumes the property value is a valid integer string.

Before change:
            if (properties != null)
            {
            	for (String key: properties.keySet())
            	{
            		if (properties.getValue(key) != null)
            		{
                		resp.addHeader(key, properties.getValue(key));
            		}
            	}
            }

After change:

            if (properties != null)
            {
            	for (String key: properties.keySet())
            	{
            		if (properties.getValue(key) != null)
            		{
                		if (key.equals(ResourceResponse.HTTP_STATUS_CODE)) {
            				resp.setStatus(Integer.parseInt(properties.getValue(key)));
            			} else {
            				resp.addHeader(key, properties.getValue(key));
            			}
            		}
            	}
            }


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list