Re: Standalone pages

2014-10-10 Thread phiroc
Hi,

in my test.vm template, I would like to dynamically display all images in the 
server's directory.

Can this be done in Velocity, or are system calls nonos?

Many thanks.

Philippe





- Mail original -
De: Erik Hatcher erik.hatc...@gmail.com
À: Velocity Users List user@velocity.apache.org
Envoyé: Jeudi 9 Octobre 2014 19:15:33
Objet: Re: Standalone pages

Interestingly, if you don’t even need to add a template to the server 
(filesystem) at all with Solr’s VelocityResponseWriter:


http://localhost:8983/solr/select?wt=velocityv.template=tv.template.t=template%20from%20thin%20air

;)

But even with /browse, you can override bits and pieces (thanks to Velocity’s 
resource loader trickery) of a template (from thin air):

 http://localhost:8983/solr/browse?v.template.header=Solritas!

And maybe more to your liking, you could leverage /browse as-is, and switch the 
template, even dynamically (this time you’d save it to the file system or pass 
the whole template in as a HTTP parameter like above):

 http://localhost:8983/solr/browse?v.template=test - which will use your 
test.vm file.  Your template gets all the data that is presented in /browse 
should you choose to render it.

While I love hammers, if all you wanted was Velocity “server pages”, Solr’s 
VelocityResponseWriter admittedly is overkill.  *I’d* still do it that way :), 
but that’s just me (Mr. VrW).  However, I’m all for your data being in Solr, 
and having it be immediately navigable with straightforward Velocity templating 
is a real treat!

Erik



On Oct 9, 2014, at 9:13 AM, phi...@free.fr wrote:

 Hi Erik,
 
 thank you for your reply.
 
 However, come to think of it, my question is not SOLR-specific.
 
 I would like to know if it is possible to create lightweight Web pages with 
 Velocity, in Tomcat, without resorting to servlets, JSP, etc.
 
 In other words, can you add a Velocity template to a Tomcat server as easily 
 as you can drop a .php file in an Apache server's DocumentRoot directory.
 
 Many thanks.
 
 Philippe
 
 
 
 - Mail original -
 De: Erik Hatcher erik.hatc...@gmail.com
 À: Velocity Users List user@velocity.apache.org
 Envoyé: Jeudi 9 Octobre 2014 14:59:02
 Objet: Re: Standalone pages
 
 Philiippe - I just noticed you posted this to the velocity user list.  How 
 Solr uses Velocity is perhaps a bit niche/different, so best to ask over on 
 the Solr user list for future questions about the Solr/Velocity integration.  
 But I’m on both lists :)
 
   Erik
 
 On Oct 9, 2014, at 4:19 AM, phi...@free.fr wrote:
 
 Hello,
 
 I am using currently the Velocity templates that come with the example 
 provided with SOLR, in Tomcat 7.
 
 I would like to add a Velocity template called test.vm, in the 
 example/solr/mycollection directory, to display an HTML page containing an 
 image.
 
 Unfortunately, the following URL
 
 http://myserver:8983/solr/mycollection/test
 
 returns a 404 error.
 
 http://myserver:8983/solr/mycollection/browse
 
 works, though.
 
 How does one create standalone Velocity pages, such as test.vm?
 
 Many thanks.
 
 Philippe
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
 For additional commands, e-mail: user-h...@velocity.apache.org
 
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
 For additional commands, e-mail: user-h...@velocity.apache.org
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
 For additional commands, e-mail: user-h...@velocity.apache.org
 


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


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



Re: Standalone pages

2014-10-09 Thread Erik Hatcher
Philiippe - I just noticed you posted this to the velocity user list.  How Solr 
uses Velocity is perhaps a bit niche/different, so best to ask over on the Solr 
user list for future questions about the Solr/Velocity integration.  But I’m on 
both lists :)

Erik

On Oct 9, 2014, at 4:19 AM, phi...@free.fr wrote:

 Hello,
 
 I am using currently the Velocity templates that come with the example 
 provided with SOLR, in Tomcat 7.
 
 I would like to add a Velocity template called test.vm, in the 
 example/solr/mycollection directory, to display an HTML page containing an 
 image.
 
 Unfortunately, the following URL
 
 http://myserver:8983/solr/mycollection/test
 
 returns a 404 error.
 
 http://myserver:8983/solr/mycollection/browse
 
 works, though.
 
 How does one create standalone Velocity pages, such as test.vm?
 
 Many thanks.
 
 Philippe
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
 For additional commands, e-mail: user-h...@velocity.apache.org
 


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



Re: Standalone pages

2014-10-09 Thread phiroc
Hi Erik,

thank you for your reply.

However, come to think of it, my question is not SOLR-specific.

I would like to know if it is possible to create lightweight Web pages with 
Velocity, in Tomcat, without resorting to servlets, JSP, etc.

In other words, can you add a Velocity template to a Tomcat server as easily as 
you can drop a .php file in an Apache server's DocumentRoot directory.

Many thanks.

Philippe



- Mail original -
De: Erik Hatcher erik.hatc...@gmail.com
À: Velocity Users List user@velocity.apache.org
Envoyé: Jeudi 9 Octobre 2014 14:59:02
Objet: Re: Standalone pages

Philiippe - I just noticed you posted this to the velocity user list.  How Solr 
uses Velocity is perhaps a bit niche/different, so best to ask over on the Solr 
user list for future questions about the Solr/Velocity integration.  But I’m on 
both lists :)

Erik

On Oct 9, 2014, at 4:19 AM, phi...@free.fr wrote:

 Hello,
 
 I am using currently the Velocity templates that come with the example 
 provided with SOLR, in Tomcat 7.
 
 I would like to add a Velocity template called test.vm, in the 
 example/solr/mycollection directory, to display an HTML page containing an 
 image.
 
 Unfortunately, the following URL
 
 http://myserver:8983/solr/mycollection/test
 
 returns a 404 error.
 
 http://myserver:8983/solr/mycollection/browse
 
 works, though.
 
 How does one create standalone Velocity pages, such as test.vm?
 
 Many thanks.
 
 Philippe
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
 For additional commands, e-mail: user-h...@velocity.apache.org
 


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


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



RE: Standalone pages

2014-10-09 Thread Logan Stinger
It depends on the contents of your velocity file. 

 If your velocity file contains no variables that need replaced by the velocity 
engine and is simply an html page then the answer is yes.  You simply need to 
place the file in a directory that is accessible via url.  I'm assuming you 
have an images folder or some other folder where you can currently access image 
from e.g. img src=myserver:8983/images/myimage.png/  You would simply put 
your velocity file in a similar directory and reference it 
http://myserver:8983/static/velocityfile.vm.  You would also need to make sure 
your server is configured to send the proper content-type headers for such a 
request (map .vm extensions to content-type text/html).  

If your velocity file is not static and has variables or velocity code that 
needs processed then your best bet might be to create a filter such that urls 
of *.vm get processed by this filter and the results spit out.


-Original Message-
From: phi...@free.fr [mailto:phi...@free.fr] 
Sent: Thursday, October 09, 2014 8:13 AM
To: Velocity Users List
Subject: Re: Standalone pages

Hi Erik,

thank you for your reply.

However, come to think of it, my question is not SOLR-specific.

I would like to know if it is possible to create lightweight Web pages with 
Velocity, in Tomcat, without resorting to servlets, JSP, etc.

In other words, can you add a Velocity template to a Tomcat server as easily as 
you can drop a .php file in an Apache server's DocumentRoot directory.

Many thanks.

Philippe



- Mail original -
De: Erik Hatcher erik.hatc...@gmail.com
À: Velocity Users List user@velocity.apache.org
Envoyé: Jeudi 9 Octobre 2014 14:59:02
Objet: Re: Standalone pages

Philiippe - I just noticed you posted this to the velocity user list.  How Solr 
uses Velocity is perhaps a bit niche/different, so best to ask over on the Solr 
user list for future questions about the Solr/Velocity integration.  But I’m on 
both lists :)

Erik

On Oct 9, 2014, at 4:19 AM, phi...@free.fr wrote:

 Hello,
 
 I am using currently the Velocity templates that come with the example 
 provided with SOLR, in Tomcat 7.
 
 I would like to add a Velocity template called test.vm, in the 
 example/solr/mycollection directory, to display an HTML page containing an 
 image.
 
 Unfortunately, the following URL
 
 http://myserver:8983/solr/mycollection/test
 
 returns a 404 error.
 
 http://myserver:8983/solr/mycollection/browse
 
 works, though.
 
 How does one create standalone Velocity pages, such as test.vm?
 
 Many thanks.
 
 Philippe
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
 For additional commands, e-mail: user-h...@velocity.apache.org
 


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


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



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



Re: Standalone pages

2014-10-09 Thread Nathan Bubna
The VelocityTools project provides several servlets that make it easy to
serve up dynamic Velocity pages. http://velocity.apache.org/tools/devel/

On Thu, Oct 9, 2014 at 6:56 AM, Logan Stinger lstin...@bluelid.com wrote:

 It depends on the contents of your velocity file.

  If your velocity file contains no variables that need replaced by the
 velocity engine and is simply an html page then the answer is yes.  You
 simply need to place the file in a directory that is accessible via url.
 I'm assuming you have an images folder or some other folder where you can
 currently access image from e.g. img
 src=myserver:8983/images/myimage.png/  You would simply put your
 velocity file in a similar directory and reference it
 http://myserver:8983/static/velocityfile.vm.  You would also need to make
 sure your server is configured to send the proper content-type headers for
 such a request (map .vm extensions to content-type text/html).

 If your velocity file is not static and has variables or velocity code
 that needs processed then your best bet might be to create a filter such
 that urls of *.vm get processed by this filter and the results spit out.


 -Original Message-
 From: phi...@free.fr [mailto:phi...@free.fr]
 Sent: Thursday, October 09, 2014 8:13 AM
 To: Velocity Users List
 Subject: Re: Standalone pages

 Hi Erik,

 thank you for your reply.

 However, come to think of it, my question is not SOLR-specific.

 I would like to know if it is possible to create lightweight Web pages
 with Velocity, in Tomcat, without resorting to servlets, JSP, etc.

 In other words, can you add a Velocity template to a Tomcat server as
 easily as you can drop a .php file in an Apache server's DocumentRoot
 directory.

 Many thanks.

 Philippe



 - Mail original -
 De: Erik Hatcher erik.hatc...@gmail.com
 À: Velocity Users List user@velocity.apache.org
 Envoyé: Jeudi 9 Octobre 2014 14:59:02
 Objet: Re: Standalone pages

 Philiippe - I just noticed you posted this to the velocity user list.  How
 Solr uses Velocity is perhaps a bit niche/different, so best to ask over on
 the Solr user list for future questions about the Solr/Velocity
 integration.  But I’m on both lists :)

 Erik

 On Oct 9, 2014, at 4:19 AM, phi...@free.fr wrote:

  Hello,
 
  I am using currently the Velocity templates that come with the example
 provided with SOLR, in Tomcat 7.
 
  I would like to add a Velocity template called test.vm, in the
 example/solr/mycollection directory, to display an HTML page containing an
 image.
 
  Unfortunately, the following URL
 
  http://myserver:8983/solr/mycollection/test
 
  returns a 404 error.
 
  http://myserver:8983/solr/mycollection/browse
 
  works, though.
 
  How does one create standalone Velocity pages, such as test.vm?
 
  Many thanks.
 
  Philippe
 
 
  -
  To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
  For additional commands, e-mail: user-h...@velocity.apache.org
 


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


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



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




Re: Standalone pages

2014-10-09 Thread Erik Hatcher
Interestingly, if you don’t even need to add a template to the server 
(filesystem) at all with Solr’s VelocityResponseWriter:


http://localhost:8983/solr/select?wt=velocityv.template=tv.template.t=template%20from%20thin%20air

;)

But even with /browse, you can override bits and pieces (thanks to Velocity’s 
resource loader trickery) of a template (from thin air):

 http://localhost:8983/solr/browse?v.template.header=Solritas!

And maybe more to your liking, you could leverage /browse as-is, and switch the 
template, even dynamically (this time you’d save it to the file system or pass 
the whole template in as a HTTP parameter like above):

 http://localhost:8983/solr/browse?v.template=test - which will use your 
test.vm file.  Your template gets all the data that is presented in /browse 
should you choose to render it.

While I love hammers, if all you wanted was Velocity “server pages”, Solr’s 
VelocityResponseWriter admittedly is overkill.  *I’d* still do it that way :), 
but that’s just me (Mr. VrW).  However, I’m all for your data being in Solr, 
and having it be immediately navigable with straightforward Velocity templating 
is a real treat!

Erik



On Oct 9, 2014, at 9:13 AM, phi...@free.fr wrote:

 Hi Erik,
 
 thank you for your reply.
 
 However, come to think of it, my question is not SOLR-specific.
 
 I would like to know if it is possible to create lightweight Web pages with 
 Velocity, in Tomcat, without resorting to servlets, JSP, etc.
 
 In other words, can you add a Velocity template to a Tomcat server as easily 
 as you can drop a .php file in an Apache server's DocumentRoot directory.
 
 Many thanks.
 
 Philippe
 
 
 
 - Mail original -
 De: Erik Hatcher erik.hatc...@gmail.com
 À: Velocity Users List user@velocity.apache.org
 Envoyé: Jeudi 9 Octobre 2014 14:59:02
 Objet: Re: Standalone pages
 
 Philiippe - I just noticed you posted this to the velocity user list.  How 
 Solr uses Velocity is perhaps a bit niche/different, so best to ask over on 
 the Solr user list for future questions about the Solr/Velocity integration.  
 But I’m on both lists :)
 
   Erik
 
 On Oct 9, 2014, at 4:19 AM, phi...@free.fr wrote:
 
 Hello,
 
 I am using currently the Velocity templates that come with the example 
 provided with SOLR, in Tomcat 7.
 
 I would like to add a Velocity template called test.vm, in the 
 example/solr/mycollection directory, to display an HTML page containing an 
 image.
 
 Unfortunately, the following URL
 
 http://myserver:8983/solr/mycollection/test
 
 returns a 404 error.
 
 http://myserver:8983/solr/mycollection/browse
 
 works, though.
 
 How does one create standalone Velocity pages, such as test.vm?
 
 Many thanks.
 
 Philippe
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
 For additional commands, e-mail: user-h...@velocity.apache.org
 
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
 For additional commands, e-mail: user-h...@velocity.apache.org
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
 For additional commands, e-mail: user-h...@velocity.apache.org
 


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