You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Chantal Ackermann <ch...@btelligent.de> on 2010/02/15 14:47:59 UTC

VelocityResponseWriter: Image References

Hi all,

Google didn't come up with any helpful hits, so I'm wondering whether
this is either too simple for me to grok, or I've got some obvious
mistake in my code.


Problem:

Images that I want to load in the velocity templates (including those
referenced in CSS/JS files) for the VelocityResponseWriter do not show
up. (CSS/JS files are loaded!)

I am using the following URL (the same as for CSS/JS files (which work
fine)):


http://server:port/solr/core/admin/file?file=[path to
image]&contentType=image/png



When I try that URL in my browser (Firefox or Safari on Windows) they do
not return the image correctly. Firefox states that something is wrong
with the image, Safari simply displays the [?] icon.
When I download the file (removing the parameter contentType to get the
download dialog), something is downloaded (> 0KB) but it's a different
format (my image viewer fails to load it).

Has anyone managed to load images that are stored in the SOLR config
directory? Or do I need to move those resources to the webapps solr
folder (I'd rather avoid that)?

Thanks!
Chantal



Re: VelocityResponseWriter: Image References

Posted by Lance Norskog <go...@gmail.com>.
You can add a static content container to the jetty example.  This is
a patch against example/etc/jetty.xml. You then make a directory
example/webapp/ROOT. This works the same as ROOT in tomcat:
http://localhost:8983/image.png comes from webapp/ROOT/image.png. It
is static and the files are not copied anywhere. I suppose if you make
a ROOT/solr you can then get the image paths to match up with the
velocity URLs. I haven't taken it that far.

http://localhost:9963/solr/select/?q=%7B%21frange+l%3D2010-01-12T10%3A00%3A00Z++u%3D2010-01-12T16%3A00%3A00Z%7Dtimestamp&version=2.2&start=0&rows=10&indent=on&sort=timestamp+asc



$ svn diff etc/jetty.xml
Index: etc/jetty.xml
===================================================================
--- etc/jetty.xml       (revision 908339)
+++ etc/jetty.xml       (working copy)
@@ -110,10 +110,16 @@
            <Item>
              <New id="RequestLog"
class="org.mortbay.jetty.handler.RequestLogHandler"/>
            </Item>
+          <Item>
+               <New id="ResourceHandler"
class="org.mortbay.jetty.handler.ResourceHandler">
+                       <Set name="resourceBase">webapps/ROOT</Set>
+               </New>
+          </Item>
          </Array>
         </Set>
       </New>
     </Set>
+

     <!-- =========================================================== -->
     <!-- Configure the context deployer                              -->

On Mon, Feb 15, 2010 at 5:47 AM, Chantal Ackermann
<ch...@btelligent.de> wrote:
> Hi all,
>
> Google didn't come up with any helpful hits, so I'm wondering whether
> this is either too simple for me to grok, or I've got some obvious
> mistake in my code.
>
>
> Problem:
>
> Images that I want to load in the velocity templates (including those
> referenced in CSS/JS files) for the VelocityResponseWriter do not show
> up. (CSS/JS files are loaded!)
>
> I am using the following URL (the same as for CSS/JS files (which work
> fine)):
>
>
> http://server:port/solr/core/admin/file?file=[path to
> image]&contentType=image/png
>
>
>
> When I try that URL in my browser (Firefox or Safari on Windows) they do
> not return the image correctly. Firefox states that something is wrong
> with the image, Safari simply displays the [?] icon.
> When I download the file (removing the parameter contentType to get the
> download dialog), something is downloaded (> 0KB) but it's a different
> format (my image viewer fails to load it).
>
> Has anyone managed to load images that are stored in the SOLR config
> directory? Or do I need to move those resources to the webapps solr
> folder (I'd rather avoid that)?
>
> Thanks!
> Chantal
>
>
>



-- 
Lance Norskog
goksron@gmail.com

Re: VelocityResponseWriter: Image References

Posted by Erik Hatcher <er...@gmail.com>.
Unfortunately the file request handler does not support bindary file  
types (yet).

Lance's suggestion of hosting static content in another servlet  
container context is the best solution for now.

	Erik

On Feb 15, 2010, at 8:47 AM, Chantal Ackermann wrote:

> Hi all,
>
> Google didn't come up with any helpful hits, so I'm wondering whether
> this is either too simple for me to grok, or I've got some obvious
> mistake in my code.
>
>
> Problem:
>
> Images that I want to load in the velocity templates (including those
> referenced in CSS/JS files) for the VelocityResponseWriter do not show
> up. (CSS/JS files are loaded!)
>
> I am using the following URL (the same as for CSS/JS files (which work
> fine)):
>
>
> http://server:port/solr/core/admin/file?file=[path to
> image]&contentType=image/png
>
>
>
> When I try that URL in my browser (Firefox or Safari on Windows)  
> they do
> not return the image correctly. Firefox states that something is wrong
> with the image, Safari simply displays the [?] icon.
> When I download the file (removing the parameter contentType to get  
> the
> download dialog), something is downloaded (> 0KB) but it's a different
> format (my image viewer fails to load it).
>
> Has anyone managed to load images that are stored in the SOLR config
> directory? Or do I need to move those resources to the webapps solr
> folder (I'd rather avoid that)?
>
> Thanks!
> Chantal
>
>