Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jaxrs-dev] Request for extension to Response

Thanks, Santiago. I've created https://github.com/eclipse-ee4j/jaxrs-api/issues/706.

Note that I'll be offline after tonight for a week. Please don't take a lack of response for lack of interest. ;-)

On 11/28/18 9:47 AM, Santiago Pericas-Geertsen wrote:


On Nov 27, 2018, at 7:30 PM, Ron Sigal <rsigal@xxxxxxxxxx> wrote:

A number of javax.ws.rs.core.Response methods, e.g., getEntity() and hasEntity(), include a line in the javadoc like

* @throws IllegalStateException in case the response has been {@link #close() closed}.

However, in the absence of a method like isClosed(), we end up writing code like


try {
   if (response.getEntity() != null) return response;
}
catch(IllegalStateException ise) {
   // IllegalStateException from ClientResponse.getEntity() means the response is closed and got no entity
}

instead of


if (!response.isClosed() && response.getEntity() != null) {
   return response;
}

The implementation of isClosed() should be simple, and it leads to nicer code.



 Seems like a reasonable addition to me.

— Santiago


_______________________________________________
jaxrs-dev mailing list
jaxrs-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/jaxrs-dev
-- 
My company's smarter than your company (unless you work for Red Hat)

Back to the top