You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/11/17 17:01:03 UTC

[jira] [Commented] (JENA-1263) Configure HTTP client to follow 303 redirects

    [ https://issues.apache.org/jira/browse/JENA-1263?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15674240#comment-15674240 ] 

ASF GitHub Bot commented on JENA-1263:
--------------------------------------

GitHub user ajs6f opened a pull request:

    https://github.com/apache/jena/pull/194

    JENA-1263: Recommended redirect behavior

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/ajs6f/jena JENA-1263

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/jena/pull/194.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #194
    
----
commit ab2ee7087b0bd1d0fa7105481adcefed9fac80df
Author: ajs6f <aj...@virginia.edu>
Date:   2016-11-17T16:59:29Z

    JENA-1263: Recommended redirect behavior

----


> Configure HTTP client to follow 303 redirects 
> ----------------------------------------------
>
>                 Key: JENA-1263
>                 URL: https://issues.apache.org/jira/browse/JENA-1263
>             Project: Apache Jena
>          Issue Type: Improvement
>          Components: ARQ
>    Affects Versions: Jena 3.1.1
>            Reporter: Aaron Coburn
>            Assignee: A. Soroka
>            Priority: Minor
>             Fix For: Jena 3.2.0
>
>
> When calling RDFDataMgr.read(Model model, String uri), the underlying HTTP client does not appear to follow 303 redirects. For example:
> {code:java}
> Model m = createDefaultModel();
> RDFDataMgr.read(m, "http://purl.org/dc/terms/");
> {code}
> {code}
> org.apache.jena.riot.RiotException: Failed to determine the content type: (URI=http://purl.org/dc/terms/ : stream=text/html)
> {code}
> A work-around is to add a static block with a custom HTTP client like so:
> {code:java}
> static {
>     HttpOp.setDefaultHttpClient(
>             HttpClientBuilder.create().setRedirectStrategy(
>                     new LaxRedirectStrategy()).build());
> }
> {code}
> By default the Apache HTTP client follows 301 and 302 redirects (but not 303 redirects), but the W3C recommends using 303 redirects for publishing RDF vocabularies (https://www.w3.org/TR/swbp-vocab-pub/), which is what the Dublin Core vocabularies use.
> This sort of redirect handling worked previously, e.g. Jena 3.1.0; it would be convenient if the underlying HTTP client simply followed the 303 redirects.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)