History | Log In     View a printable version of the current page. Get help!  
Issue Details [XML]

Key: SES-663
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Arjohn Kampman
Reporter: James Leigh
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Sesame

RepositoryConnection#add(URL) does not include HTTP Accept Header

Created: 26/Feb/09 07:24 PM   Updated: 07/Jul/10 02:55 PM
Component/s: Repository API
Affects Version/s: 2.0
Fix Version/s: 2.3.2


 Description   
With so many RDF formats in use and a growing number of servers that can server both RDF and non-RDF data, it is important that the Sesame client identify itself as an RDF client. Whenever a request is made for RDF data, Sesame should include an HTTP Accept Header of the formats it supports (or rdf+xml). The method RepositoryConnection#add(URL) in particular does not include an HTTP Accept and should be changed. The HTTP client and DatasetSail both include an Accept Header in remote connections and should be considered when developing a solution to reduce potential code duplication.

 All   Comments   Change History      Sort Order:
Comment by James Leigh [31/May/10 02:38 PM]

Comment by Arjohn Kampman [01/Jun/10 11:36 AM]
The supplied patch will cause a NPE if the method is called with a <null> dataFormat argument and there is no file extension that can be matched to a specific RDF format. Ideally, this method would fall back to content negotiation for http-URLs in such cases.

Comment by Jeen Broekstra [01/Jun/10 02:49 PM]
Fair point, I had not realized that dataFormat could be null.

Doesn't adding an if around the setRequestProperty solve this?

if (dataFormat != null) {
  connection.setProperty("Accept", dataFormat.getDefaultMimeType());
}

Comment by Arjohn Kampman [01/Jun/10 09:50 PM]
That would fix the NPE, but only bring us half-way. When passing a <null> parameter, it would be better to accept any format that can be parsed.

Comment by Arjohn Kampman [07/Jul/10 02:55 PM]
Resolved in svn rev 10428.