Project

General

Profile

Defect #844

css file cannot be found

Added by Tom Parry about 9 years ago. Updated about 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
velocity
Target version:
-
Start date:
03/13/2015
Due date:
% Done:

0%

Estimated time:
Browser (if web client):

Description

I upgrade VR to 3.5.2 after not updating for a year.
The rendering is no longer the same.
There is an error showing in the Servoy server log (trying this in developer) like this:
"item at URI http://127.0.0.1:8080/eastwood/reports/C:/VelocityReport_crir/css/crir_styles.css not found"

So for some reason VR maybe looking under the eastwood folder - but there is nothing there in this folder.

I have specified the VR folder as "C:/VelocityReport_crir" in the admin section for plugins.

Why is this behaviour different?
Have I missed any other files to be obtained?

Only tried in developer for smart client so far.


Files

eastwood.war (2.16 MB) eastwood.war Patrick Talbot, 03/13/2015 11:37 PM

History

#1

Updated by Patrick Talbot about 9 years ago

  • Status changed from New to In Progress

What is the url of the styles in your template?

Is should be "css/crir_styles.css".

And you also need to add @baseHREF inside the <head> tag.

This should fix the issue.

#2

Updated by Tom Parry about 9 years ago

AS mentioned this template has not changed only the VR version.
I do have the $baseHREF and the style sheet as you mentioned.
I also have an images folder and the image is not being shown either.
So I think it has something to do with VR not putting the velocity report folder into the proper context - it should not be appended to the localhost:8080 etc.
Shall I delve into the code?

Here is the beginning of the template:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Account Listing - Test</title>
$baseHREF
<style type="text/css" media="print">
div.header { display: none }
div.header { display: block; position: running(header); }

#set($orient = "portrait")
#if($orientation)
#set($orient = $orientation)
#end
@page {
size: letter $orient;
@top-left { content: element(header); }
@bottom-right { content: "Page " counter(page) " of " counter(pages);
font-family: Helvetica, Arial, Sans-Serif; font-size: 10pt; background-color: #E9E9E9; padding: 5px, 15px, 5px, 15px;}
@bottom-left { content: "Prospect IT Consulting Inc, Inc. Tel : 613.253.1746 ";
font-family:helvetica, arial, sans-serif; font-size: 10pt; background-color: #E9E9E9; padding: 5px, 15px, 5px, 15px; vertical-align: middle;}
margin: 1.25in 0.75in 0.5in 0.5in;
}
table {
-fs-table-paginate: paginate;
}
td.RecordObject {
text-align:center;
margin-top:0 auto;
page-break-inside: avoid;
}
&lt;/style&gt;
&lt;link rel="stylesheet" type="text/css" media="all" href="css/crir_styles.css"/&gt;
&lt;/head&gt;
&lt;body&gt;...&lt;/body&gt;
#3

Updated by Patrick Talbot about 9 years ago

Did you update the eastwood.war that comes with Velocity as well?
I think the problem is there.
When you do, make sure you deleted the eastwood folder that is located in /application_server/server/webapps as well as replace the war, upon startup of Servoy the eastwood folder will be deployed from the war again.

#4

Updated by Tom Parry about 9 years ago

I had not deleted the eastwood folder. (You might want to add that to the installation instructions).

However after I did delete the folder and run the report from developer I get the exact same message.
I not that the template file is being read from the VelocityReport folder.
So there is some mistake in interpreting what to pre-pend to the path for the "css/crir_styles.css"

The error for the image is as follow:
Can't find page on classpath using URI: res/500.xml

#5

Updated by Patrick Talbot about 9 years ago

Weird, I tried the same kind of template (using @baseHREF and

<link rel="stylesheet" type="text/css" media="all" href="css/styles.css"/>
) with 3.5.3 in Servoy 7.4.3 / win 7 / Java 7 and didn't have any issue with the CSS being in the reports folder (D:/reports in my case) at the related location.

The $baseHREF translated to http://127.0.0.1:8080/eastwood/reports/D:/reports/css/styles.css which is used by the static servlet in the eastwood war, which serves the CSS file.

Where did you get the
"Can't find page on classpath using URI: res/500.xml" error? It looks like an internal error.

#6

Updated by Tom Parry about 9 years ago

The error
"Can't find page on classpath using URI: res/500.xml" error? It looks like an internal error.
was in the Servoy server log - it was in between two errors each of which is same as:
"item at URI http://127.0.0.1:8080/eastwood/reports/C:/VelocityReport_crir/css/crir_styles.css not found"

I will re-install all the Velocity Reports (now 3.5.3 I see) files and try again.

#7

Updated by Patrick Talbot about 9 years ago

Could you also try to access
http://127.0.0.1:8080/eastwood/reports/C:/VelocityReport_crir/css/crir_styles.css
When servoy is running (and eastwood is installed)?

This should be rewritten internally to
http://127.0.0.1:8080/eastwood/static?file=C:/VelocityReport_crir/css/crir_styles.css
which should return the css.

#8

Updated by Tom Parry about 9 years ago

Trying to access that url gives me a 404 file not found page.

I ran the report with
#set ($A =$baseHREF)
<p>A = $A</p>

And got an empty string (so the report looks like: "A = "

I seem to recall some instruction or other to do with baseHREF but cannot find it now in the wiki.

#9

Updated by Patrick Talbot about 9 years ago

$baseHREF is a simple String that should contain:

<base href="http://127.0.0.1:8080/eastwood/reports/"/>

If you do var html = plugins.VelocityReport.renderTemplate(yourTemplate, context);
You should be able to see the HTML generated by Velocity, which should have replaced $baseHREF in the head tag with that base tag. It will never show in the rendered page though, it's a non displayable tag.

Have you set the velocityreport.serverURL server property in servoy-admin?

#10

Updated by Tom Parry about 9 years ago

I did a render and got this response
<p>A=<base href="http://127.0.0.1:8080/eastwood/reports/"/></p>

#11

Updated by Patrick Talbot about 9 years ago

This is correct.

BTW, the reference to $baseHREF is in the FAQ: https://www.servoyforge.net/projects/velocity-report/wiki/FAQ#14-What-is-the-meaning-of-baseHREF-in-the-sample-templates-and-where-does-it-come-from

The only issue you might have is when you are using templates for Velocity to serve Velocity web clients, in this case, it's better to leave it off because the Velocity servlet will find the files in the report folder www/solution folder according to the config.json specs. But this doesn't concern reporting at all.

Have you tried accessing the URL for the css in a browser? Do you get a file back?

#12

Updated by Tom Parry about 9 years ago

Yes I can access in a browser using:
file:///C:/VelocityReport_crir/css/crir_styles.css

I also use DreamWeaver to edit the template and it finds the css from the internal link. The image is also found. Dreamweaver properly renders (what it can).

Is there any cache that needs to be zapped?

#13

Updated by Patrick Talbot about 9 years ago

I'm not asking if you can access with a file: protocol.

Can you access:
http://127.0.0.1:8080/eastwood/reports/C:/VelocityReport_crir/css/crir_styles.css
or
http://127.0.0.1:8080/eastwood/static?file=C:/VelocityReport_crir/css/crir_styles.css

Both should work in a browser (when Servoy is launched of course)

#14

Updated by Tom Parry about 9 years ago

Interestingly enough I viewed the rendered file in a browser and the image is shown.
However in the Velocity Reports preview it is not - so in the print preview setup should we look there?

I call for a preview using:
var viewer = plugins.VelocityReport.previewReport(template, velocity_context, "HTML");

but I do nothing with the viewer (in Smart Client from developer).

#15

Updated by Patrick Talbot about 9 years ago

Have you tried accessing these URLS?
When you say the image is not showing in smart, is that file declared in the CSS as a URL?

#16

Updated by Tom Parry about 9 years ago

When I do these from a browser
http://127.0.0.1:8080/eastwood/reports/C:/VelocityReport_crir/css/crir_styles.css
or
http://127.0.0.1:8080/eastwood/static?file=C:/VelocityReport_crir/css/crir_styles.css
I get HTTP status 404 - file not found when developer running the application in debug.

The css does not contain any reference to any image.

The image is referenced by the code that does the running header:
<div class="header">
<table width="100%" border="1">
<tr>
<td width="13%" rowspan="2"><img src="images/crir_logo.jpg" border="1" /></td>
<td width="51%" rowspan="2"><p class="titlelisting">Account Listing </p>
<p class="titlelisting"> </p></td>
<td width="36%" align="right"><span class="filterLabel">From Last PM Start Date:</span> <span class="filter">$!filteredByStart</span></td>
</tr>
<tr>
<td align="right"><span class="filterLabel">To Last PM Start Date:</span> <span class="filter">$!filteredByEnd</span></td>
</tr>
</table>
</div>

does that help?

#17

Updated by Patrick Talbot about 9 years ago

Yes that helps! Because it means that the problem is in the eastwood.war
I'm going to check what can happen here, will be back on monday hopefully with a fix.

#18

Updated by Patrick Talbot about 9 years ago

Actually, I've found the issue. You will find a workaround in the eastwood.war attached.
Try it (delete the eastwood folder and replace the war in your application_server/server/webapps) and let me know if this works for your too. I'll release an updated package on monday if you confirm in the meantime.

#19

Updated by Tom Parry about 9 years ago

Yeah!
Now the css and the image are found and rendered.

In the Servoy log file there is only one message remaining:
"Can't find page on classpath using URI: res/500.xml "

So your fix seems ok.Thanks Patrick!
Cheers,
Tom

#20

Updated by Patrick Talbot about 9 years ago

Yeah, that URI res/500.xml I've found in the plugin, it's more a warning than anything though, you can ignore it - Will fix that in monday's release as well. Thanks for the confirmation!

#21

Updated by Patrick Talbot about 9 years ago

  • Status changed from In Progress to Closed

Fixed in v3.5.4

Also available in: Atom PDF