This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 182359

Summary: Image are not shown in CSS editor with Rails project
Product: web Reporter: ehartmann <ehartmann>
Component: CSS Visual ToolsAssignee: Marek Fukala <mfukala>
Status: VERIFIED FIXED    
Severity: normal CC: jkovalsky
Priority: P3 Keywords: NETFIX
Version: 6.x   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:
Bug Depends on: 182357    
Bug Blocks:    
Attachments: Small patch

Description ehartmann 2010-03-19 10:37:27 UTC
Using the visual CSS editor with Rails project, images are not shown (in fact, there is an exception without the trunk version of xhtmlrenderer).

I use absolute path for the image, "url(/images/rails.png)" for instance. For a Rails project it refers to the file public/images/rails.png.

It would be great to set the root path of every absolute references to the public directory of the rails project.

For the moment, the path seems to be incorrect :

WARNING [plumbing.exception]: item at URI file:/home/eric/Projets/mr10percent/maquette/public/application/private/stylesheets//application/private/stylesheets/img/offre_sprite.png not found

For url(/application/private/stylesheets/img/offre_sprite.png), the file in my project is public/application/private/stylesheets/img/offre_sprite.png
Comment 1 Marek Fukala 2010-03-23 12:29:16 UTC
Similar issue as the 182357. Once the ProjectWebRootProvider impl is available for rails project, I'll try to plug somehow to the Flying Saucer and do some resources resolving.
Comment 2 Marek Fukala 2010-03-25 20:59:57 UTC
The FS's XHTMLPanel component is currently set to use an URL as a base to resolve relative links. I haven't found a simple way how to force FS to resolve absolute links to another (different URL). In case of an absolute link FS tries to resolve it against the given URL which of course doesn't work if the resource is not underneath the rendered files's folder.
Comment 3 ehartmann 2010-03-26 09:09:02 UTC
Created attachment 95893 [details]
Small patch

Start some implementation of a workaround
Comment 4 ehartmann 2010-03-26 09:13:10 UTC
Hi Marek,

I may have found a workaround. I've attached a patch for it (this is for trunk version of flying saucer).
I spent one hour trying to understand why "edited" variable is null in my code :

FileObject edited = FileUtil.toFileObject(FileUtil.normalizeFile(new File(getBaseURL())));

where getBaseURL is the url for the current editing css.

But I did not find a clue. Do you have an idea ?
Comment 5 Marek Fukala 2010-03-29 09:13:22 UTC
ehartmann, thanks for the patch and the investigations. You helped me a lot!

I've reimplemented the resolveURI(...) method from your patch, but the you pointed me to the correct place!

I would also appreciate if you verify the change.

Thank you very much again! 

fixed in web-main: http://hg.netbeans.org/web-main/rev/20f64c202d4d
Comment 6 ehartmann 2010-03-29 11:42:43 UTC
Hi Marek,

I've just tested your modifications.
Works fine for me with Rails projects (so I updated the status).

If you plan to upgrade flying saucer to trunk version, the fix does not work as the path does not contains //. For instance, the uri given is : 

for r7 : file:/home/eric/Projets/mr10percent/maquette/public/application/admin/stylesheets//application/admin/stylesheets/images/elbow-minus-nl.gif

for trunk : /application/admin/stylesheets/images/elbow-minus-nl.gif

-éric
Comment 7 Marek Fukala 2010-03-29 12:09:57 UTC
Thanks Eric for the information. I'm not sure if I'll update the FS to the newest version or not for now (6.9), more likely I wont. Once FS is updated in next release I'll use your patch.
Comment 8 Jiri Kovalsky 2010-04-01 11:20:04 UTC
Community contributed patch. Marking with appropriate keyword.
Comment 9 Quality Engineering 2010-04-02 04:55:29 UTC
Integrated into 'main-golden', will be available in build *201004020200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/20f64c202d4d
User: Marek Fukala <mfukala@netbeans.org>
Log: #182359 -  Image are not shown in CSS editor with Rails project