[xmlc] Re: Re: Re: Re: Re: SSI and XMLC

"Jacob Kjome" <[email protected]> Thu, 31 Mar 2011 16:34:14 -0500
Newsgroups gmane.comp.java.enhydra.xmlc
Message-ID <[email protected]>
This is a multi-part message in MIME format...

------------=_1301607257-30467-16295
Content-Type: text/plain;charset=iso-8859-1; format="flowed"
Content-Transfer-Encoding: quoted-printable


Actually, yes you can.=A0 That's the whole point of the new resource load=
er=20
concept in XMLC 2.3.2.=A0 It's THE central location for ALL resource look=
ups in=20
XMLC.=A0 You can verify this yourself by using the custom document/resour=
ce=20
loader I sent you earlier and logging the paths that are requested just b=
efore=20
the URL is looked up and returned.=A0 You will find that the path for the=
 SSI=20
include is looked up.=A0 After all, there's no parsing a URL before the U=
RL is=20
obtained.=A0 And the resource loader is what obtains the URL.

So, all you need to do is let the classloader return the URL.=A0 Then che=
ck=20
URL.toExternalForm() (or URL.toString) for the path being both a "jar:" U=
RL=20
and having ".." in the path.=A0 If so, then manipulate the path resolving=
 the=20
".." bits to the canonical path without "..".

I wonder if Java 1.4+ URI class might do this for you without extra manua=
l=20
manipulation?=A0 You might want to look into that.=A0 You also might want=
 to=20
report this as a bug or feature request against JarURLConnection to Oracl=
e (I=20
wanted to say Sun).


Jake

On Thu, 31 Mar 2011 23:04:41 +0200
=A0Sasa Bojanic <[email protected]> wrote:
> Again...
>=20
> Not sure if having custom DocumentLoader/Classloader can help, since=20
>resolving of SSI happens during "parse" of HTML file...I think this shou=
ld be=20
>corrected in SSIReader class, openSSIInclude method...and I doubt we can=
=20
>simply "customize" it from outside XMLC?
>=20
> Sasa.
>=20
> On 31-Mar-11 21:53, Sasa Bojanic wrote:
>> Yes, when the resource is not within the JAR file (but in the=20
>>WEB-INF\classes folder) the paths with "/../" are working fine...
>>
>> With your help, we gave up from custom classloader for XMLC, and now a=
lso=20
>>use non-singleton DocumentLoader instances (implicitly created by=20
>>XMLCDefferedParsingFactory).
>> However, we will consider your suggestions in order to solve this SSI=20
>>issue...
>>
>> Thanks a lot,
>> Sasa.
>>
>>=A0=A0(since you helped us a lot with thi
>> On 31-Mar-11 21:40, Jacob Kjome wrote:
>>>
>>> I see.=A0=A0That makes more sense, as I don't recall anything having=20
>>>specifically to do with SSI loading having changed between XMLC 2.3.1 =
and=20
>>>2.3.2 (at least nothing that should affect this scenario).
>>>
>>> I suspect, ultimately, that this is a deficiency of JarURLConnection =
in=20
>>>dealing with paths containing "/../", though I have yet to verify this=
.=A0=A0I=20
>>>believe this works fine when it's a non "jar:" URL path, so I think th=
e=20
>>>problem is specific to JarURLConnection.
>>>
>>> You could probably work around this either in your custom classloader=
=20
>>>(where, as I recall, you applied the fix for "jar:" URLs originally) o=
r in a=20
>>>custom document/resource loader.=A0=A0All you'd need to do is re-write=
 the path=20
>>>of the URL to pre-resolve the ".." parts changing, for instance, this.=
..
>>>
>>> jar:file:/D:/apache-tomcat-6.0.29/webapps/airSent/WEB-INF/lib/airSent=
.jar!/com/lutris/airsent/presentation/customer/../media/TopBanner.ssi=20
>>>
>>> ...to this...
>>>
>>> jar:file:/D:/apache-tomcat-6.0.29/webapps/airSent/WEB-INF/lib/airSent=
.jar!/com/lutris/airsent/presentation/media/TopBanner.ssi=20
>>>
>>>
>>> That said, this is probably something that XMLC could take care of=20
>>>internally.=A0=A0I would certainly consider this for the next release =
if my=20
>>>assumptions pan out.
>>>
>>>
>>> Jake
>>>
>>> On Thu, 31 Mar 2011 21:11:06 +0200
>>>=A0=A0Sasa Bojanic <[email protected]> wrote:
>>>> Sorry...it doesn't work with XMLC 2.3-1 as well...
>>>>
>>>> Yes, the com/lutris/airsent/presentation/media/TopBanner.ssi is the =
right=20
>>>>location within the JAR.
>>>>
>>>> You can try with the airSent.war from the ZIP file. However, if you =
use this=20
>>>>WAR as it is, everything works well both with XMLC2.3-1 (which is ori=
ginally=20
>>>>inside the WAR) and with XMLC2.3-2 (when you replace the XMLC/GNUREGE=
XP JAR=20
>>>>files). The problem occurs when you pack everything from WEB-INF\clas=
ses=20
>>>>folder into the JAR file, and then put this JAR file into WEB-INF\lib=
 folder=20
>>>>(and this is the change we are introducing in our new release). So th=
e=20
>>>>problem was here even in XMLC 2.3-1 but we didn't notice it.
>>>>
>>>> Do you think it is an XMLC problem or...?
>>>>
>>>> Sasa.
>>>>
>>>> On 31-Mar-11 19:44, Jacob Kjome wrote:
>>>>>
>>>>> It looks like it's referencing the jar it should exist in, and clea=
rly it=20
>>>>>found the markup file including the SSI, so I don't think this is a=20
>>>>>classloader issue.
>>>>>
>>>>> Does the path seem right to you?=A0=A0That is, does the file in que=
stion exist=20
>>>>>in the following relative path within the airSent.jar file?....
>>>>>
>>>>> com/lutris/airsent/presentation/media/TopBanner.ssi
>>>>>
>>>>> If you can confirm that, I can try to test things out at home tonig=
ht.=A0=A0I=20
>>>>>presume this jar is one of those in the zip file containing all the =
webapps=20
>>>>>which can be deployed under Tomcat Standalone?
>>>>>
>>>>>
>>>>> Jake
>>>>>
>>>>> On Thu, 31 Mar 2011 16:31:32 +0200
>>>>>=A0=A0 Sasa Bojanic <[email protected]> wrote:
>>>>>> Me again :-)
>>>>>>
>>>>>> Just a question...have you changed to XMLC related to Server Side =
Includes=20
>>>>>>from HTML?
>>>>>>
>>>>>> The situation is the following:
>>>>>>
>>>>>> HTML file (processed by XMLC) includes another HTML file via relat=
ive path:
>>>>>>
>>>>>> <!--#include virtual=3D"../media/TopBanner.ssi"-->
>>>>>>
>>>>>> When XMLC parses HTML file, I get the following exception (when al=
l the=20
>>>>>>resources are in the JAR file):
>>>>>>
>>>>>> java.io.FileNotFoundException: JAR entry=20
>>>>>>com/lutris/airsent/presentation/customer/../media/TopBanner.ssi not=
 found in=20
>>>>>>D:\apache-tomcat-6.0.29\webapps\airSent\WEB-INF\lib\airSent.jar
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.=
java:122)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConn=
ection.java:132)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>org.enhydra.xml.io.InputSourceOps.openSystemId(InputSourceOps.java:=
65)=20
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at org.enhydra.xml.io.InputSourceOps=
.open(InputSourceOps.java:85)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>org.enhydra.xml.xmlc.misc.SSIParsedStream.readIntoBuffer(SSIParsedS=
tream.java:198)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>org.enhydra.xml.xmlc.misc.SSIParsedStream.<init>(SSIParsedStream.ja=
va:159)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>org.enhydra.xml.xmlc.misc.SSIReader.openSSIInclude(SSIReader.java:1=
53)=20
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>org.enhydra.xml.xmlc.misc.SSIReader.processSSIInclude(SSIReader.jav=
a:169)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>org.enhydra.xml.xmlc.misc.SSIReader.processSSIDirective(SSIReader.j=
ava:179)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at org.enhydra.xml.xmlc.misc.SSIRead=
er.read(SSIReader.java:228)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>org.cyberneko.html.HTMLScanner$CurrentEntity.load(HTMLScanner.java:=
1772)=20
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>org.cyberneko.html.HTMLScanner.skipNewlines(HTMLScanner.java:1522)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>org.cyberneko.html.HTMLScanner$ContentScanner.scanCharacters(HTMLSc=
anner.java:2227)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.java=
:1964)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:895)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:4=
99)=20
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:4=
52)=20
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at org.apache.xerces.parsers.XMLPars=
er.parse(Unknown Source)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at org.apache.xerces.parsers.DOMPars=
er.parse(Unknown Source)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>org.enhydra.xml.xmlc.parsers.xerces.XercesDOMParser.parse(XercesDOM=
Parser.java:113)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>org.enhydra.xml.xmlc.parsers.xerces.XercesHTMLDOMParser.parse(Xerce=
sHTMLDOMParser.java:64)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at org.enhydra.xml.xmlc.compiler.Par=
se.parse(Parse.java:291)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>org.enhydra.xml.xmlc.deferredparsing.DocumentLoaderImpl.parseDocume=
nt(DocumentLoaderImpl.java:405)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>org.enhydra.xml.xmlc.deferredparsing.DocumentLoaderImpl.getCacheEnt=
ry(DocumentLoaderImpl.java:175)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>org.enhydra.xml.xmlc.deferredparsing.DocumentLoaderImpl.getDocument=
(DocumentLoaderImpl.java:247)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>com.lutris.airsent.presentation.customer.LoginHTML.buildDocument(Un=
known=20
>>>>>>Source)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>com.lutris.airsent.presentation.customer.LoginHTML.<init>(Unknown S=
ource)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>com.lutris.airsent.presentation.customer.LoginHTML.<init>(Unknown S=
ource)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at sun.reflect.NativeConstructorAcce=
ssorImpl.newInstance0(Native=20
>>>>>>Method)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstru=
ctorAccessorImpl.java:39)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Delegatin=
gConstructorAccessorImpl.java:27)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at java.lang.reflect.Constructor.new=
Instance(Constructor.java:513)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>org.enhydra.xml.xmlc.deferredparsing.XMLCDeferredParsingFactory.cre=
ateObject(XMLCDeferredParsingFactory.java:160)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>org.enhydra.xml.xmlc.deferredparsing.XMLCDeferredParsingFactory.doC=
reate(XMLCDeferredParsingFactory.java:185)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>org.enhydra.xml.xmlc.XMLCStdFactory.create(XMLCStdFactory.java:139)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at com.lutris.airsent.presentation.c=
ustomer.Login.showPage(Unknown=20
>>>>>>Source)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>com.lutris.airsent.presentation.customer.Login.handleDefault(Unknow=
n Source)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at com.lutris.airsent.presentation.B=
asePO.handleEvent(Unknown=20
>>>>>>Source)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at com.lutris.airsent.presentation.B=
asePO.run(Unknown Source)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>com.lutris.appserver.server.httpPresentation.HttpPresentationManage=
r.runPresentationObj(Unknown=20
>>>>>>Source)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>com.lutris.appserver.server.httpPresentation.HttpPresentationManage=
r.Run(Unknown=20
>>>>>>Source)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>com.lutris.appserver.server.httpPresentation.servlet.HttpPresentati=
onServlet.serviceDirect(Unknown=20
>>>>>>Source)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>com.lutris.appserver.server.httpPresentation.servlet.HttpPresentati=
onServlet.service(Unknown=20
>>>>>>Source)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at javax.servlet.http.HttpServlet.se=
rvice(HttpServlet.java:717)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Ap=
plicationFilterChain.java:290)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>org.apache.catalina.core.ApplicationFilterChain.doFilter(Applicatio=
nFilterChain.java:206)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrappe=
rValve.java:233)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>org.apache.catalina.core.StandardContextValve.invoke(StandardContex=
tValve.java:191)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve=
.java:127)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve=
.java:102)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineV=
alve.java:109)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.j=
ava:298)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProces=
sor.java:861)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.=
process(Http11AprProtocol.java:579)
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at=20
>>>>>>org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:=
1584)=20
>>>>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 at java.lang.Thread.run(Thread.java:=
662)
>>>>>> org.enhydra.xml.xmlc.XMLCError: Couldn't load XMLC class
>>>>>>
>>>>>>
>>>>>> Just to mention, like always with XMLC2.3-1 it worked...maybe beca=
use our=20
>>>>>>"magical" classloader...but can't be sure.
>>>>>>
>>>>>> Greetings,
>>>>>> Sasa.
>>>>>
>>>>
>>>
>>
>=20


------------=_1301607257-30467-16295
Content-Type: text/plain; charset="UTF-8"; name="message-footer.txt"
Content-Disposition: inline; filename="message-footer.txt"
Content-Transfer-Encoding: quoted-printable


--
You receive this message as a subscriber of the [email protected] mailing list=
.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=3Dhelp
OW2 mailing lists service home page: http://www.ow2.org/wws

------------=_1301607257-30467-16295--