Velocity URL Resource Loader: Resource Not Found

View: New views
2 Messages — Rating Filter:   Alert me  

Velocity URL Resource Loader: Resource Not Found

by Mark Swinson-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi,

I'm having trouble access a template using URLResourceLoader using
something similar to the following code:

Properties p1 = new Properties();
p1.put("resource.loader","url");
p1.put("url.resource.loader.class",
       "org.apache.velocity.runtime.resource.loader.URLResourceLoader");
p1.put("url.resource.loader.root",
      "http://www.internalwebserver.co.uk/");
       
VelocityEngine ve = new VelocityEngine();
ve.init(p1);

Template t = ve.getTemplate("test.html");



but I'm getting a Resource Not Found Exception.

Has anyone had a similar experience , when accessing a URL through a
resource.

One thing I thought of was that the receiving machine is behind a
firewall and needs to go through a proxy.
Is velocity proxy aware , can it check for proxy settings. And if so
how?


Thanks for any help






Mark





http://www.bbc.co.uk/
This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.
                                       

Re: Velocity URL Resource Loader: Resource Not Found

by Jason Tesser-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

can you within your environment hit the url directly by adding a port
without going through a proxy.  if so ad the port to your root URL.  I think
eliminating the proxy is your best answer if possible.

if not you will need the following java system properties

props.put("http.proxyHost", "proxyhostname");
props.put("http.proxyPort", "proxyhostport")

You can pass these system properties in when you start the JVM also.

Thanks,
Jason Tesser
dotCMS Lead Development Manager
1-305-858-1422


On Tue, Aug 11, 2009 at 12:47 PM, Mark Swinson <Mark.Swinson@...>wrote:

>
> Hi,
>
> I'm having trouble access a template using URLResourceLoader using
> something similar to the following code:
>
> Properties p1 = new Properties();
> p1.put("resource.loader","url");
> p1.put("url.resource.loader.class",
>       "org.apache.velocity.runtime.resource.loader.URLResourceLoader");
> p1.put("url.resource.loader.root",
>        "http://www.internalwebserver.co.uk/");
>
> VelocityEngine ve = new VelocityEngine();
> ve.init(p1);
>
> Template t = ve.getTemplate("test.html");
>
>
>
> but I'm getting a Resource Not Found Exception.
>
> Has anyone had a similar experience , when accessing a URL through a
> resource.
>
> One thing I thought of was that the receiving machine is behind a
> firewall and needs to go through a proxy.
> Is velocity proxy aware , can it check for proxy settings. And if so
> how?
>
>
> Thanks for any help
>
>
>
>
>
>
> Mark
>
>
>
>
>
> http://www.bbc.co.uk/
> This e-mail (and any attachments) is confidential and may contain personal
> views which are not the views of the BBC unless specifically stated.
> If you have received it in error, please delete it from your system.
> Do not use, copy or disclose the information in any way nor act in reliance
> on it and notify the sender immediately.
> Please note that the BBC monitors e-mails sent or received.
> Further communication will signify your consent to this.
>
>