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

David Beaudet commented on JENA-2203:
-------------------------------------

Java 9 httpclient had
|Enum Constants|
||Enum Constant||Description||
||{{[ALWAYS|https://docs.oracle.com/javase/9/docs/api/jdk/incubator/http/HttpClient.Redirect.html#ALWAYS]}}|Always
 redirect.|
||{{[NEVER|https://docs.oracle.com/javase/9/docs/api/jdk/incubator/http/HttpClient.Redirect.html#NEVER]}}|Never
 redirect.|
||{{[SAME_PROTOCOL|https://docs.oracle.com/javase/9/docs/api/jdk/incubator/http/HttpClient.Redirect.html#SAME_PROTOCOL]}}|Redirect
 to same protocol only.|
||{{[SECURE|https://docs.oracle.com/javase/9/docs/api/jdk/incubator/http/HttpClient.Redirect.html#SECURE]}}|Redirect
 always except from HTTPS URLs to HTTP URLs.|

 

where in java 16 
([https://docs.oracle.com/en/java/javase/16/docs/api/java.net.http/java/net/http/HttpClient.Redirect.html])
 this has changed to:
 
Description
{{[ALWAYS|https://docs.oracle.com/en/java/javase/16/docs/api/java.net.http/java/net/http/HttpClient.Redirect.html#ALWAYS]}}
Always redirect.
{{[NEVER|https://docs.oracle.com/en/java/javase/16/docs/api/java.net.http/java/net/http/HttpClient.Redirect.html#NEVER]}}
Never redirect.
{{[NORMAL|https://docs.oracle.com/en/java/javase/16/docs/api/java.net.http/java/net/http/HttpClient.Redirect.html#NORMAL]}}
Always redirect, except from HTTPS URLs to HTTP URLs.
 

It seems "secure" has been renamed to "normal" although it's a bit of a mystery 
why the behavior would change regarding 303 handling (if it actually has).  
Maybe the URL I'm using is responding a bit differently since the initial issue 
since an insecure redirect from https -> http appears to be in play from 

[https://purl.org/iso25964/skos-thes] to 

[http://pub.tenforce.com/schemas/iso25964/skos-thes] 

 

I suppose one course of action is to point out this problem to the maintainer 
of the final URL, although it would be nice to have a slightly more obvious way 
of dealing with this in Jena when / if it arises.

> 303 redirect issues cropped up again in 4.3 snapshot
> ----------------------------------------------------
>
>                 Key: JENA-2203
>                 URL: https://issues.apache.org/jira/browse/JENA-2203
>             Project: Apache Jena
>          Issue Type: Improvement
>    Affects Versions: Jena 4.3.0
>            Reporter: David Beaudet
>            Assignee: Andy Seaborne
>            Priority: Major
>
> The same issue noted in #JENA-1263 with 303 redirects not being followed when 
> loading ontologies seems to have cropped up again in version 4.3.0 and 
> requires the following workaround in client code:
>     static {
>         HttpEnv.setDftHttpClient(
>                 HttpClient.newBuilder()
>                     .connectTimeout(Duration.ofSeconds(10))
>                     .followRedirects(Redirect.ALWAYS)
>                     .build()
>         );
> The default builder sets Redirect.NORMAL which, at least in the latest 
> versions of Java (I'm using OpenJDK 16) doesn't appear to follow 303. 
>  
> Can reproduce with the following:
>         OntModel data = 
> ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM_RULE_INF);
>         data.read("http://purl.org/iso25964/skos-thes";);



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to