Hi Peter,

as i wrote back to you i only recalled what i had in memory...

First, for a simple but in my opinion good description of the url-pattern
syntax have a look at:

http://www.roguewave.com/support/docs/leif/leif/html/bobcatug/7-3.html

That leads to the possible Answers for the Question, how to load images and
make the URLīs short. The problem is, you have to map specific urls to your
servlet, Turbine in this case. You want to exclude static resources, of
course. The description above tells clearly, you can only match simple URL
Patterns. It would be nice to match against Regular Expressions (sth. like
/.*?[.]vm.*/ would do the trick, maybe hack sth the like in your Tomcat ;-)
but that is no immediate Solution.

In my opinion the solution is fiddling around with the matching algorithm of
the Servlet Container and the url-patterns. You could do like this:

<url-pattern>/resources/*</url-pattern>

map to a dummy Servlet that just opens the requested File and writes it back
to the browser.

<url-pattern>/*</url-pattern>

maps to the Serlvet of Turbine itself. "Since the container prefers to match
the longest pattern", the first one will succeed for all of your Images, CSS
and stuff thelike whereever the URL is invisible to the user (embedded in
HTML) and all other URLs map transparently to your servlet.

I think i have once seen such a solution, but there are several things to
note:

- I am not sure if this is a major performance drawback. In fact i donīt
think so but you will have to compare...

- You would not want your system security be that easy to break like
/resources/../../conf/server.xml ... so the dummy Servlet has to check.

- I thought there were more possibilities in the url-pattern syntax, but
there are none. In fact, i would love a more understandable and flexible
approach for mapping servlets in servlet containers. How much time i spent
until that d$#m Web.xml file worked...

- This is a hack. Please report any better solutions.

Maybe this helps.

Have a nice day!
martin

----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: "Turbine Users List" <[EMAIL PROTECTED]>
Sent: Tuesday, May 11, 2004 11:50 AM
Subject: Re: beginner... problem displaying images


> Hi Martin,
>
> How would you do that? I had tried doing it before by mapping /*.vm, but
then
> it probably would only look into the root directory of the webapp, so I
> changed it again. I tried *.vm just now, without the leading "/" and that
> doesn't really work either. Only when you really hit a vm file does the
> servlet fire, but then the actions don't get executed since a lot of those
> url's don't end in vm. This probably could be solved by adding a lot of
extra
> mappings I suppose.
> Also all urls except .gif ... would interest me. I was already wondering
what
> is possible as <url-pattern>. Ok I found it in the servlet 2.4
specification,
> but I still don't see how I would go about excluding gifs etc.
>
>
> thx,
> peter
>
>
> On Tuesday 11 May 2004 10:43, Martin Stolz wrote:
> > Hi,
> >
> > i am not shure but you may also map only urls ending in .vm to your
servlet
> > and bang, you dont need servlet in your url any more... It might even be
> > that way you can specify that all urls except .gif, .jpeg et cetera will
> > not go through your servlet and all the others will.
> >
> > Regards,
> > martin
> > ----- Original Message -----
> > From: <[EMAIL PROTECTED]>
> > To: "Turbine Users List" <[EMAIL PROTECTED]>
> > Sent: Tuesday, May 11, 2004 9:51 AM
> > Subject: Re: beginner... problem displaying images
> >
> > > Hi David,
> > >
> > > I found it I guess, thanks to you setting me on the right track.
> > > I previously had this in my web.xml under WEB-INF
> > > ...
> > >   <servlet-mapping>
> > >      <servlet-name>test</servlet-name>
> > >      <url-pattern>/*</url-pattern>
> > >   </servlet-mapping>
> > > ...
> > >
> > > Then everything worked, except the static stuff didn't get loaded,
> >
> > probably
> >
> > > because my servlet can't handle those. When I changed this to:
> > > ...
> > >   <servlet-mapping>
> > >      <servlet-name>test</servlet-name>
> > >      <url-pattern>/servlet/*</url-pattern>
> > >   </servlet-mapping>
> > > ...
> > >
> > > Everything is ok if I do it this way. I'd better read up on tomcat
config
> >
> > I
> >
> > > guess. Why do you actually need the /servlet there, is it the servlet
> > > container specification that dictates it and why does it work at all
with
> > > other mapping? I will have /servlet in each url now of course, which
is a
> > > little ugly also.
> > > But hey! It works and I have been searching a while on this one.
> > >
> > > thanks David
> > >
> > > On Monday 10 May 2004 17:15, David Demner wrote:
> > > > Hi Peter,
> > > >
> > > > Sounds like a tomcat config problem.  Do you have any
> > > > redirects/rewrites that may prevent the browser from getting to the
> > > > image?  Is the image
> >
> > being
> >
> > > > looked for in the correct place (ie: Is the name of your webapp
'app')?
> > > > Can you get anything for a directory other than in /app/servlet/app
(ie
> > > > create webapps/app/blah.txt and see if you can access that via
> > > > http://localhost:8080/app/blah.txt)?
> > > >
> > > > Did you change the Tomcat server.xml or just the web.xml?  Maybe
post
> >
> > your
> >
> > > > web.xml here...?
> > > >
> > > > David
> > > >
> > > >
> > > > -----Original Message-----
> > > > From: peter snauwaert [mailto:[EMAIL PROTECTED]
> > > > Sent: Monday May 10, 2004 1:07 AM
> > > > To: Turbine Users List
> > > > Subject: Re: beginner... problem displaying images
> > > >
> > > >
> > > > Hi David, thanks for the suggestions. The other post was also coming
> >
> > from
> >
> > > > me,
> > > > though it took about four days to arrive in the list, don't know
why.
> > > >
> > > > No I don't get the image in my browser, not even if I first log in
and
> >
> > then
> >
> > > > paste the url in the browser. I do have the impression my css isn't
> > > > functional either. I've set my paragraph font to 24px which should
be
> > > > visible
> > > > enough, but it isn't applied.
> > > > Another thing I noticed is that my image hasn't got :8080 in the
link,
> > > > which
> > > >
> > > > may be due to my tampering with several settings, because I seem to
> > > > remember
> > > >
> > > > it was there previously.
> > > > Anyway if I paste the image link in the DefaultTop.vm literally it
> > > > still doesn't display.
> > > > So I guess I just have found an extra problem: the css isn't applied
> > > > either. If I screw up the web.xml so that turbine isn't run and I
just
> > > > browse the directory structure I can click the image and it gets
> >
> > displayed.
> >
> > > > anybody any idea?
> > > >
> > > > thanks,
> > > > peter
> > > >
> > > > On Saturday 08 May 2004 15:35, David Demner wrote:
> > > > > Hi Peter,
> > > > >
> > > > > Do you get the image when you paste the URL into your browser?
Does
> >
> > your
> >
> > > > > CSS work properly (this uses a similar URL/retrieval technique)?
> > > > >
> > > > > Does a missing image icon display or does nothing (maybe you have
an
> >
> > HTML
> >
> > > > > comment that doesn't end where it should)?
> > > > >
> > > > > Just a few possibilities.
> > > > >
> > > > > Good luck,
> > > > >
> > > > > David
> > > > >
> > > > > -----Original Message-----
> > > > > From: peter snauwaert [mailto:[EMAIL PROTECTED]
> > > > > Sent: Friday May 7, 2004 7:56 AM
> > > > > To: [EMAIL PROTECTED]
> > > > > Subject: beginner... problem displaying images
> > > > >
> > > > >
> > > > > Hi list,
> > > > >
> > > > > Having a problem with a tdk example.
> > > > > The gif that's supposed to show up in the upper right
> > > > > corner isn't being displayed...
> > > > > This is what's found in the DefaultTop.vm in
> > > > > /app/templates/app/navigations dir
> > > > > <img src="$ui.image($ui.logo)">
> > > > > When I check my document source it transforms this
> > > > > into the correct url for the image, but it isn't being
> > > > > displayed. I copied different files, with different
> > > > > permissions, different file formats, checked the
> > > > > permissions to the path to it, got rid of symbolic
> > > > > links, to no avail.
> > > > > Tomcat is 5.0.19 / Turbine 2.3.1 / Velocity 1.3.1
> > > > >
> > > > > This is what is being logged.
> > > > > [DEBUG] ServerData -
> > > > > -setScriptName(resources/ui/skins/default/images/logo.gif)
> > > > > [DEBUG] BaseURI - -No Response Object!
> > > > > [DEBUG] BaseURI - -encodeResponse():
> > > > >
http://localhost:8080/app/resources/ui/skins/default/images/logo.gif
> > > > >
> > > > > Does anyone know what the problem is?
> > > > >
> > > > > thx,
> > > > > peter
> > > > >
> > > > >
> > > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail:
[EMAIL PROTECTED]
> > > > > For additional commands, e-mail:
[EMAIL PROTECTED]
> > > >
> > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail:
[EMAIL PROTECTED]
> > > >
> > > >
> > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail:
[EMAIL PROTECTED]
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to