Re: Standalone pages
Erik Hatcher <[email protected]> Thu, 9 Oct 2014 08:57:48 -0400
| Newsgroups | gmane.comp.jakarta.velocity.user |
|---|---|
| Message-ID | <[email protected]> |
Philippe -
Here’s how I do it:
- Define a request handler matching the end-point url you want. /test in your case:
<requestHandler name="/matcher" class="solr.DumpRequestHandler" >
<lst name="invariants">
<str name="wt">velocity</str>
<str name="v.template”>test</str>
</lst>
</requestHandler>
I use DumpRequestHandler if I don’t really need the page to render results directly (though even in this “static”/standalone sense it could Ajax back for results through another handler). If you need results like /browse, then clone/adjust that into your own custom request handler definition.
- Then create conf/velocity/test.vm
You mentioned displaying the image, so I’m curious where that is coming from. You can see how the /browse handler does this with images from the velocity/ directory, in header.vm:
<img src="#{url_for_solr}/admin/file?file=/velocity/se-logo.png&contentType=image/png" id="logo”/>, so maybe you want something like this too? Or, of course, you can refer to a different URL for the image.
Erik
On Oct 9, 2014, at 4:19 AM, [email protected] 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: [email protected]
> For additional commands, e-mail: [email protected]
>