On Tue, 08 Nov 2011 18:11:59 -0200, BrianBurnett <brian.burn...@acision.com> wrote:

Hi!

It does not work when I use an absolute URL to the filesystem:

body {
    margin: 0;
    padding: 0;
    background: url( file:///opt/user/webapp/background1.gif )repeat-x;
}

Firebug reports: Failed to load given URL.

This isn't a Tapestry problem at all: the file protocol in URLs point to the machine at which the browser is running, not the server running the webapp.

Is there a setting or something that I may have overlooked that will
instruct tapestry to resolve the filesystem url?

No, for the reason above.

Just in-case it matters, this is the line in Layout.tml:

<link href=”${layoutCss}” rel=”stylesheet” type=”text/css”/>

And in Layout.java

public  Link getLayoutCss() throws Exception {
return resources.createFormEventLink( “GET_LAYOUT_CSS_STREAM_EVENT” );
 }

@OnEvent( “GET_LAYOUT_CSS_STREAM_EVENT” )
private StreamResponse getLayoutCssStream() throws Exception {
    StreamResponse css = null;
    …
     // details for converting filesystem url into StreamResponse
    return css;
}

Better yet:

<link href=”${layoutCss}” rel=”stylesheet” type=”text/css”/>

@Inject
private PageRenderLinkSource pageRenderLinkSource;

public  Link getLayoutCss() throws Exception {
return pageRenderLinkSource.createPageRenderLinkWithContext(FileStreamer.class, "path to file");
}

Then create a separate page:

public class FileStreamer {

        public StreamResponse onActivate(String path) {
                // get file from filesystem
                // return a StreamResponse from it
                // pay attention to security
        }

}

--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to