Loading Images

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

Loading Images

BitByter
Hi folks,

I'm running Orbeon Forms in a "seperate deployment" within a JSP/JSF
application. As a starting point for my XForms page, I've taken an already
existing and properly working JSP page, where I'd just like to add some
XForms.

The JSP page for example has got the following content:

<body background="images/background.gif" ... />

When the JSP pages is loaded without involving Orbeon Forms, the Tomcat
access log prints:

127.0.0.1 - - [14/May/2007:12:10:45 +0100] "GET /my-webapp/images/background.gif HTTP/1.1" 304 -

When the same page is loaded, involving the Orbeon Forms processor, Tomcat
access log prints:

127.0.0.1 - - [14/May/2007:12:12:05 +0100] "GET /my-webapp/xforms/quiz/images/background.gif HTTP/1.1" 302 -

When I change the path to the image like this:

<body background="../../../images/background.gif" ... />

and then load the JSP so that it is not processed by Orbeon Forms, Tomcat's
access log says:

127.0.0.1 - - [14/May/2007:12:22:27 +0100] "GET /images/background.gif HTTP/1.1" 404 1042

But when I load the same page so that it is processed by Orbeon Forms,
Tomcat's access log prints:

127.0.0.1 - - [14/May/2007:12:24:11 +0100] "GET /my-webapp/images/background.gif HTTP/1.1" 304 -


On status code 304 the background image is loaded and shown successfully, on
status code 302 or 404 it is not.

So  I'm  currently wondering how it comes to the different path resolutions?
Currently this is confusing me.

Is there a path that I can use so the image is loaded whether Orbeon Forms
is used or not.

I already posted a similar thread to this list:
http://mail-archive.objectweb.org/ops-users/2007-04/msg00155.html, but
without getting a satisfying solution.

Could someone explain the differernt path resolutions for the image to me?


- bitbyter





--
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: Loading Images

Erik Bruchez
Administrator
How is your XForms filter configured? Does it also catch images under
/my-webapp/images/?

-Erik

BitByter wrote:

> Hi folks,
>
> I'm running Orbeon Forms in a "seperate deployment" within a JSP/JSF
> application. As a starting point for my XForms page, I've taken an already
> existing and properly working JSP page, where I'd just like to add some
> XForms.
>
> The JSP page for example has got the following content:
>
> <body background="images/background.gif" ... />
>
> When the JSP pages is loaded without involving Orbeon Forms, the Tomcat
> access log prints:
>
> 127.0.0.1 - - [14/May/2007:12:10:45 +0100] "GET /my-webapp/images/background.gif HTTP/1.1" 304 -
>
> When the same page is loaded, involving the Orbeon Forms processor, Tomcat
> access log prints:
>
> 127.0.0.1 - - [14/May/2007:12:12:05 +0100] "GET /my-webapp/xforms/quiz/images/background.gif HTTP/1.1" 302 -
>
> When I change the path to the image like this:
>
> <body background="../../../images/background.gif" ... />
>
> and then load the JSP so that it is not processed by Orbeon Forms, Tomcat's
> access log says:
>
> 127.0.0.1 - - [14/May/2007:12:22:27 +0100] "GET /images/background.gif HTTP/1.1" 404 1042
>
> But when I load the same page so that it is processed by Orbeon Forms,
> Tomcat's access log prints:
>
> 127.0.0.1 - - [14/May/2007:12:24:11 +0100] "GET /my-webapp/images/background.gif HTTP/1.1" 304 -
>
>
> On status code 304 the background image is loaded and shown successfully, on
> status code 302 or 404 it is not.
>
> So  I'm  currently wondering how it comes to the different path resolutions?
> Currently this is confusing me.
>
> Is there a path that I can use so the image is loaded whether Orbeon Forms
> is used or not.
>
> I already posted a similar thread to this list:
> http://mail-archive.objectweb.org/ops-users/2007-04/msg00155.html, but
> without getting a satisfying solution.
>
> Could someone explain the differernt path resolutions for the image to me?
>
>
> - bitbyter
>
>
>
>

--
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
Reply | Threaded
Open this post in threaded view
|

Re[2]: Loading Images

BitByter
Hi Erik,

no, the filter does not catch the images. The filter mapping in my web app's
web.xml looks like this:

   <filter-mapping>
      <filter-name>ops-xforms-filter</filter-name>
      <url-pattern>/xforms/*</url-pattern>
   </filter-mapping>

And the JSP page containing the images is located at /xforms/quiz/quiz.jsp.

I even tried setting a base path:

<base href="<%= basePath %>" /> , where "basePath" is defined as follows:

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

Can you explain the different way of resolving image locations between
normal JSP and Orbeon Forms?

- bitbyter



Monday, May 14, 2007, 9:12:06 PM, you wrote:

> How is your XForms filter configured? Does it also catch images under
> /my-webapp/images/?

> -Erik

> BitByter wrote:
>> Hi folks,
>>
>> I'm running Orbeon Forms in a "seperate deployment" within a JSP/JSF
>> application. As a starting point for my XForms page, I've taken an already
>> existing and properly working JSP page, where I'd just like to add some
>> XForms.
>>
>> The JSP page for example has got the following content:
>>
>> <body background="images/background.gif" ... />
>>
>> When the JSP pages is loaded without involving Orbeon Forms, the Tomcat
>> access log prints:
>>
>> 127.0.0.1 - - [14/May/2007:12:10:45 +0100] "GET /my-webapp/images/background.gif HTTP/1.1" 304 -
>>
>> When the same page is loaded, involving the Orbeon Forms processor, Tomcat
>> access log prints:
>>
>> 127.0.0.1 - - [14/May/2007:12:12:05 +0100] "GET /my-webapp/xforms/quiz/images/background.gif HTTP/1.1" 302 -
>>
>> When I change the path to the image like this:
>>
>> <body background="../../../images/background.gif" ... />
>>
>> and then load the JSP so that it is not processed by Orbeon Forms, Tomcat's
>> access log says:
>>
>> 127.0.0.1 - - [14/May/2007:12:22:27 +0100] "GET /images/background.gif HTTP/1.1" 404 1042
>>
>> But when I load the same page so that it is processed by Orbeon Forms,
>> Tomcat's access log prints:
>>
>> 127.0.0.1 - - [14/May/2007:12:24:11 +0100] "GET /my-webapp/images/background.gif HTTP/1.1" 304 -
>>
>>
>> On status code 304 the background image is loaded and shown successfully, on
>> status code 302 or 404 it is not.
>>
>> So  I'm  currently wondering how it comes to the different path resolutions?
>> Currently this is confusing me.
>>
>> Is there a path that I can use so the image is loaded whether Orbeon Forms
>> is used or not.
>>
>> I already posted a similar thread to this list:
>> http://mail-archive.objectweb.org/ops-users/2007-04/msg00155.html, but
>> without getting a satisfying solution.
>>
>> Could someone explain the differernt path resolutions for the image to me?
>>
>>
>> - bitbyter
>>
>>
>>
>>







--
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: Loading Images

Erik Bruchez
Administrator
BitByter wrote:

> Hi Erik,
>
> no, the filter does not catch the images. The filter mapping in my web app's
> web.xml looks like this:
>
>    <filter-mapping>
>       <filter-name>ops-xforms-filter</filter-name>
>       <url-pattern>/xforms/*</url-pattern>
>    </filter-mapping>
>
> And the JSP page containing the images is located at /xforms/quiz/quiz.jsp.
>
> I even tried setting a base path:
>
> <base href="<%= basePath %>" /> , where "basePath" is defined as follows:
>
> <%
> String path = request.getContextPath();
> String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
> %>
>
> Can you explain the different way of resolving image locations between
> normal JSP and Orbeon Forms?
When going through JSP, Orbeon Forms does not do any rewriting of URLs
in your HTML. This was done because usually in JSP, no URL rewriting occurs.

It may be as simple as that, right?

We did enter a while ago an RFE to support rewriting in separate
deployment as well:

http://forge.objectweb.org/tracker/index.php?func=detail&aid=306956&group_id=168&atid=350207

-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
Reply | Threaded
Open this post in threaded view
|

Re[2]: Loading Images

BitByter
Hello Erik,

Tuesday, May 15, 2007, 3:13:02 PM, you wrote:

> When going through JSP, Orbeon Forms does not do any rewriting of URLs
> in your HTML. This was done because usually in JSP, no URL rewriting occurs.
>
> It may be as simple as that, right?

Well, the page is always processed by the JSP/servlet engine through a
servlet filter chain, whether Orbeon Forms is involved or not. And what
makes me thinking is the fact, that the image URLs differ when the JSP page
additionaly is processed by Orbeon Forms. So this makes me think that either
Orbeon Forms does rewrite certain URLs, or it does not where it should.

> We did enter a while ago an RFE to support rewriting in separate
> deployment as well:
>
> http://forge.objectweb.org/tracker/index.php?func=detail&aid=306956&group_id=168&atid=350207

Yes, I remember. Just wanted to mention that IMHO the usage of URLs should
be transparent. I mean there should be no differences between the standard
servlet/HTML references and the ones used in Orbeon Forms/XForms.


- bitbyter





--
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: Loading Images

Erik Bruchez
Administrator
BitByter wrote:

> Hello Erik,
>
> Tuesday, May 15, 2007, 3:13:02 PM, you wrote:
>
>> When going through JSP, Orbeon Forms does not do any rewriting of URLs
>> in your HTML. This was done because usually in JSP, no URL rewriting occurs.
>>
>> It may be as simple as that, right?
>
> Well, the page is always processed by the JSP/servlet engine through a
> servlet filter chain, whether Orbeon Forms is involved or not. And what
> makes me thinking is the fact, that the image URLs differ when the JSP page
> additionaly is processed by Orbeon Forms. So this makes me think that either
> Orbeon Forms does rewrite certain URLs, or it does not where it should.
It's easy to check: just look at source of the resulting HTML page in
your browser, and check if your image URLs are different from the ones
you write in your JSP. If not, then no rewriting occurred.

>> We did enter a while ago an RFE to support rewriting in separate
>> deployment as well:
>>
>> http://forge.objectweb.org/tracker/index.php?func=detail&aid=306956&group_id=168&atid=350207
>
> Yes, I remember. Just wanted to mention that IMHO the usage of URLs should
> be transparent. I mean there should be no differences between the standard
> servlet/HTML references and the ones used in Orbeon Forms/XForms.

It depends what the audience is:

If Java/JSP developers not used to URL rewriting who are only going to
use Orbeon Forms for XForms post-processing, introducing URL rewriting
may be confusing. That was the reasoning.

For people going back and forth between the two deployment methods, on
the other hand, it makes sense to be consistent.

-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
Reply | Threaded
Open this post in threaded view
|

Re[2]: Loading Images

BitByter
Hello Erik,

Wednesday, May 16, 2007, 11:16:55 AM, you wrote:

> It's easy to check: just look at source of the resulting HTML page in
> your browser, and check if your image URLs are different from the ones
> you write in your JSP. If not, then no rewriting occurred.

Well, I did check this. And it seems as if certain JSF tags like
<h:graphicImage> automatically prepend the web app's context path. It seems
it even doesn't matter if it's an absolute (starting with /) or relative
path.

So I'd like to say "sorry" for suspecting Orbeon Forms.  :)


- bitbyter





--
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: Loading Images

Erik Bruchez
Administrator
BitByter wrote:

> Hello Erik,
>
> Wednesday, May 16, 2007, 11:16:55 AM, you wrote:
>
>> It's easy to check: just look at source of the resulting HTML page in
>> your browser, and check if your image URLs are different from the ones
>> you write in your JSP. If not, then no rewriting occurred.
>
> Well, I did check this. And it seems as if certain JSF tags like
> <h:graphicImage> automatically prepend the web app's context path. It seems
> it even doesn't matter if it's an absolute (starting with /) or relative
> path.
>
> So I'd like to say "sorry" for suspecting Orbeon Forms.  :)
Don't be sorry! In many cases such suspicions are founded ;-)

This is interesting though. It seems that URL rewriting is not foreign
to JSP tag libs then.

-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