RE: Xinclude and absolute paths

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

RE: Xinclude and absolute paths

Alex Brown-5
Alex hi

Yes, to reproduce this I:

1. Grabbed the latest nightly build.

2. Created a simple JSP (hello.jsp) and placed it in the xforms-jsp
folder

------------------snip
<%
    // Set content type to XML. By default it will be HTML, and OPS will
tidy it.
    response.setContentType("application/xml");
%>
<time><%= "" + System.currentTimeMillis() %></time>
------------------snip

3. Verified this worked by browsing to
http://localhost:8080/ops/xforms-jsp/hello.jsp

4. Modified the OPS welcome/view.xhtml to include in the title text:

------------------snip
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href='http://localhost:8080/ops/xforms-jsp/hello.jsp'/>
------------------snip

5. Navigated to  http://localhost:8080/ops/ and verified that the JSP
works and has its output included in-page

6. Modified the href of the Xinclude to be "/ops/xforms-jsp/hello.jsp"
and got the following error from Orbeon Forms: "Cannot load
"/ops/xforms-jsp/hello.jsp" with webapp loader".

Hope this is enough to go on ...

- Alex.

> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf
> Of Alessandro Vernet
> Sent: 21 December 2006 01:57
> To: [hidden email]
> Subject: Re: [ops-users] Xinclude and absolute paths
>
> Alex,
>
> On 12/20/06, Alex Brown <[hidden email]> wrote:
> > > Just to make I understand your question, you would like
> to be able
> > > to write:
> > >
> > > <xi:include href='/xforms-jsp/my.jsp'/>
> >
> > Yes please!
>
> So right now you can't do that, because your <xi:include
> href='/xforms-jsp/my.jsp'/> will be replaced by what is at
> http://localhost:8080/xforms-jsp/my.jsp. This fails as your
> JSP is at http://localhost:8080/your-app/xforms-jsp/my.jsp.
> To make this work the way you want, you will have to modify
> some Java code in Orbeon Forms.
>
> > > <xi:include href='/your-app/xforms-jsp/my.jsp'/>
> >
> > That doesn't work for me: I get a "cannot load ... with
> webapp loader"
> > error for that kind of path.
>
> That should work. At least I think had the other day an
> example where this worked :). Can you create a reproducible
> use case with 2 JSP files that I can drop in xforms-jsp to see this?
>
> Now, where do you need this? Is it to have an initial
> instance generated by another JSP file?
>
> Alex
> --
> Blog (XML, Web apps, Open Source):
> http://www.orbeon.com/blog/
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Xinclude and absolute paths

Erik Bruchez
Administrator
Alex Brown wrote:
 > Alex hi
 >
 > Yes, to reproduce this I:
 >
 > 1. Grabbed the latest nightly build.
 >
 > 2. Created a simple JSP (hello.jsp) and placed it in the xforms-jsp
 > folder
 >
 > ------------------snip
 > <%
 >     // Set content type to XML. By default it will be HTML, and OPS will
 > tidy it.
 >     response.setContentType("application/xml");
 > %>
 > <time><%= "" + System.currentTimeMillis() %></time>
 > ------------------snip
 >
 > 3. Verified this worked by browsing to
 > http://localhost:8080/ops/xforms-jsp/hello.jsp
 >
 > 4. Modified the OPS welcome/view.xhtml to include in the title text:
 >
 > ------------------snip
 > <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
 > href='http://localhost:8080/ops/xforms-jsp/hello.jsp'/>
 > ------------------snip
 >
 > 5. Navigated to  http://localhost:8080/ops/ and verified that the JSP
 > works and has its output included in-page
 >
 > 6. Modified the href of the Xinclude to be "/ops/xforms-jsp/hello.jsp"
 > and got the following error from Orbeon Forms: "Cannot load
 > "/ops/xforms-jsp/hello.jsp" with webapp loader".
 >
 > Hope this is enough to go on ...

This makes sense, because the base URI for your XInclude is
oxf:/apps/welcome/view.xhtml. Resolving your absolute path against
this returns "oxf:/ops/xforms-jsp/hello.jsp", which clearly won't
work.

I fear that you will have to keep using an absolute URL if you want to
use XInclude in a page view.

Note that this applies to page models and page views, but the XForms
engine has a different behavior for its own URLs: it sets a special
base URI on XForms pages, which is the external URL used to request
the XForms page.

So if you were to perform the inclusion using the
oxf:xforms-submission processor instead, then you could write
something like this in a page model:

<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
     xmlns:oxf="http://www.orbeon.com/oxf/processors">

     <p:param name="data" type="output"/>

     <!-- Execute REST submission -->
     <p:processor name="oxf:xforms-submission">
         <p:input name="submission">
             <xforms:submission
xmlns:xforms="http://www.w3.org/2002/xforms" serialize="false"
                                method="get"
action="/xforms-jsp/hello.jsp"/>
         </p:input>
         <p:input name="request"><dummy/></p:input>
         <p:output name="response" ref="data"/>
     </p:processor>

</p:config>

-Erik

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/




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