Re: Xalan handling of HTTP redirects by the document() method
sebb <[email protected]> Wed, 6 Jan 2016 17:37:32 +0000
| Newsgroups | gmane.text.xml.xalan.java.user |
|---|---|
| Message-ID | <CAOGo0VZ7nV7dqpFJt-dQ_mOgCrJphNSTAHw1F+5X4VirfqCgvA@mail.gmail.com> |
--001a114edb5a2093600528adcf5f Content-Type: text/plain; charset=UTF-8 On 6 January 2016 at 14:55, Dennis van der Laan <[email protected]> wrote: > Hi sebb, > > Don't know if this is answered yet, but I guess Xalan uses the java > standard HttpURLConnection to get the contents as an inputstream. The > HttpURLConnection class has a static method 'setFollowRedirects(boolean)', > which enables or disables redirection handling for all HttpURLConnections > in your JVM. There might be some code that disables this (the default is > 'true'). If enabling redirection handling breaks your code, you might want > to override the URIResolver for your transformations. In that case, you can > implement how external contents is loaded (e.g. you can add caching of > resources, etc). Be aware that the URIResolver also handles includes and > imports, not only the document() function. > Hope this helps. > Thanks. Xalan is actually being invoked by an Ant xslt task, which makes it difficult to change the setting. However you have given me something to look for in the source code, in case that suggests a solution. > Best regards, > Dennis > > On Tue, Jan 5, 2016 at 8:44 PM, sebb <[email protected]> wrote: > >> I'm getting an error when using document() on a URL which redirects. >> >> It looks like Xalan (2.7.2) is not honouring the redirect, but instead >> is processing the content. >> >> Is this a known restriction? >> >> Is there a way to tell Xalan to honour redirects when processing >> document() calls? >> > > > > -- > D.G. van der Laan, MSc > Sr. Software Engineer, Center for Information Technology > +31 (0)50 363 9273 > > --001a114edb5a2093600528adcf5f Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">On 6 January 2016 at 14:55, Dennis van der Laan <span dir= =3D"ltr"><<a href=3D"mailto:[email protected]" target=3D"_blank">d= [email protected]</a>></span> wrote:<br><div class=3D"gmail_extra">= <div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margi= n:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">= <div style=3D"font-family:arial,helvetica,sans-serif">Hi sebb,</div><div st= yle=3D"font-family:arial,helvetica,sans-serif"><br></div><div style=3D"font= -family:arial,helvetica,sans-serif">Don't know if this is answered yet,= but I guess Xalan uses the java standard HttpURLConnection to get the cont= ents as an inputstream. The HttpURLConnection class has a static method = 9;setFollowRedirects(boolean)', which enables or disables redirection h= andling for all HttpURLConnections in your JVM. There might be some code th= at disables this (the default is 'true'). If enabling redirection h= andling breaks your code, you might want to override the URIResolver for yo= ur transformations. In that case, you can implement how external contents i= s loaded (e.g. you can add caching of resources, etc). Be aware that the UR= IResolver also handles includes and imports, not only the document() functi= on.</div><div>Hope this helps.</div></div></blockquote><div><br></div><div>= Thanks.<br><br>Xalan is actually being invoked by an Ant xslt task, which m= akes it difficult to change the setting.<br><br></div><div>However you have= given me something to look for in the source code, in case that suggests a= solution.<br></div><div><br>=C2=A0 <br></div><blockquote class=3D"gmail_qu= ote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex= "><div dir=3D"ltr"><div style=3D"font-family:arial,helvetica,sans-serif">Be= st regards,</div><div style=3D"font-family:arial,helvetica,sans-serif">Denn= is</div></div><div class=3D"gmail_extra"><div><div class=3D"h5"><br><div cl= ass=3D"gmail_quote">On Tue, Jan 5, 2016 at 8:44 PM, sebb <span dir=3D"ltr">= <<a href=3D"mailto:[email protected]" target=3D"_blank">[email protected]<= /a>></span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:= 0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I'm getting an = error when using document() on a URL which redirects.<br> <br> It looks like Xalan (2.7.2) is not honouring the redirect, but instead<br> is processing the content.<br> <br> Is this a known restriction?<br> <br> Is there a way to tell Xalan to honour redirects when processing<br> document() calls?<br> </blockquote></div><br><br clear=3D"all"><div><br></div></div></div><span c= lass=3D"HOEnZb"><font color=3D"#888888">-- <br><div><div dir=3D"ltr"><div><= div dir=3D"ltr"><div><div><div><div><div><div><div></div><font color=3D"#cc= 0000" size=3D"1"><font face=3D"georgia,serif">D.G. van der Laan, MSc<br></f= ont></font></div><font color=3D"#cc0000" size=3D"1"><font face=3D"georgia,s= erif">Sr. Software Engineer, Center for Information Technology<br>+31 (0)50= 363 9273</font></font><br></div></div></div></div></div><img><br></div></d= iv></div></div> </font></span></div> </blockquote></div><br></div></div> --001a114edb5a2093600528adcf5f--