Hi Boris, Overriding doInit() method is easier as you don't need to make the super.init() call and in addition if anything goes wrong, the doCatch() will be invoked.
Regarding the broken pipe, I'm wondering it this isn't due to the ranged request. Have you tried a straight/non-ranged HTTP call from curl or another HTTP client? The idea to prevent direct access to header is not really to be more general than HTTP, but rather to expose HTTP semantics as a Java API. This is an aspect we might reconsider, especially for extension headers. Best regards, Jerome 2013/6/15 Borislav Iordanov <bo...@miamidade.gov> > Hi Jerome, > > Thanks a lot for your reply, replacing the handle() method by an > implementation of get() yielded a NullPointerException in the > ServerResource.handle implementation. It turned out it was because I'm also > overriding the 'init' method in order to get to the request and response > objects, as I read somewhere in the docs that I should do. Commenting out > my overriding of init or calling super.init solved the NPE. I also read > somewhere on the restlet website that "to intercept init, I can override > doInit" which I didn't do because I didn't want to "intercept" anything. I > only want to get a reference to me request and response objects. > > The broken pipe exception remains. The client is Chrome Version > 27.0.1453.110 on Ubuntu, as I mentioned via an HTML <embed> tag generally > used for videos. Here is the info that get be gather from Chrome dev tools > for that particular request. Note that I did try setting the Content-Length > header explicitly. > > Request URL:http://localhost:8182/show > Request Method:GET > Status Code:206 Partial Content > Request Headersview source > Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 > Accept-Encoding:gzip,deflate,sdch > Accept-Language:en-US,en;q=0.8 > Connection:keep-alive > Cookie:__atuvc=12%7C5%2C0%7C6%2C0%7C7%2C0%7C8%2C2%7C9; > vctk=1e66b965-3619-403f-b22a-2281faed2977; > user=20657493-763c-4109-805d-48de04f4317d > Host:localhost:8182 > If-Range:Wed, 17 Apr 2013 04:35:52 GMT > Range:bytes=120832-120832 > Referer:http://localhost:8182/ > User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like > Gecko) Chrome/27.0.1453.110 Safari/537.36 > Response Headers > HTTP/1.1 206 Partial Content > Content-Length: 1 > Content-Range: bytes 120832-120832/8973447 > Content-Type: video/mp4 > Last-Modified: Wed, 17 Apr 2013 04:35:52 GMT > Date: Sat, 15 Jun 2013 17:38:56 GMT > Accept-Ranges: bytes > Server: Restlet-Framework/2.1.2 > > Final note: it took my a while to find out how to add header to an HTTP > response. I understand that Restlet aims to be more general than HTTP, but > one has to assume HTTP is the overwhelming majority of use cases. I would > suggest that a call to: > > HttpResponse.addHeader(....) > > should lead to a NullPointerException, but rather automatically create the > header "Series" in the response if they are not there. > > Thanks again! > Boris > > ------------------------------------------------------ > > http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3058179 > ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3058205