I had not seen a reply to this thread and just happened to need to do the 
same exact thing.

here are my results...

I am also still using TDK 2.1 and when trying to do some complicated work 
on the back end to create a Grid object that was comprised of many 
different images, I needed to grab the URI info to build the contents of 
the variable I was going to plug back into the context for my velocity 
page.

I was looking at the standard ServletInfo.vm and ServletInfo.java files 
that ship with TDK 2.1 and they don't seem to work by calling 
TurbineServlet directly either.

What I ended up doing and what worked for me was passing the RunData 
object down through my grid compilation scheme and then using the 
ContentURI class to pull the info I needed.

I am providing a small portion of the code to show you how to do this.

I hope that this info helps...

btw, I am still working on creating documentation for the facade pattern 
and use with turbine for manipulating large amounts of complex forms.

I am in the process of trying to deflate my schema as much as possible 
before I get into it ;)


Jeff Painter
[EMAIL PROTECTED]



code follows:

the last piece of my grid (the GridSquare's) are where the images where 
needed... I'm only showing the blank image in this instance.

.....
import org.apache.turbine.util.RunData;
import org.apache.turbine.util.Log;
import org.apache.turbine.util.ContentURI;

public class GridSquare {

 public String getGridSquare( RunData data ) 
 {
    String unit = "\n\t\t\t <td bgcolor=\"" + this.color + "\" valign=\"middle\" 
align=\"center\">";
               unit = unit + "<img src=\"" + blankBubble(data) + "\"> </td> \n";
        return unit;
 }


 private String blankBubble( RunData data ) 
 {

      try {

        ContentURI content = new ContentURI();
        content.init(data);
        return content.getURI("images/grid_graphics/bubble_blank.gif");

      } catch ( Exception e ) {

        Log.error("Could not fetch uri: " + e.toString() );
        return "";

      }

 }

}



------------------------------------------------------------------------

Eric,
thanks for the reply.  At the moment I am in the final stages of a project
(last couple of weeks) and would prefer to avoid any uneccesary delays 
right
now.  I will try the site with 2.2 Monday, but if it doesn't work I won't
persevere (will certainly upgrade in a few weeks, anyway).
My direct problem is with the UIManager class. I introduced skins last 
week,
but the image URLs were coming up as 
null://null:nullnull//resources/ui/...
in the generated HTML. A quick check in the code showed me that
UIManager.image() uses TurbineServlet for this.  I then tested
TurbineServlet directly using the API with the results as described.  I 
have
seen no instance of anything similar on this list previously, so I reckon
it's probably something peculiar to my setup.  If I have to do something
nasty and short term to get around this, I would put a wrapper around the
UIManager class and add it into the pull service as $ui, but I'd rather 
not.

Thanks,
Matt

Matt Innes, Consultant ([EMAIL PROTECTED])
Madeye Software Ltd. (http://company.madeye.com)
Tel : +44 7977 415 773 / Fax : +44 870 8316749

----- Original Message -----
From: "Eric Emminger" <[EMAIL PROTECTED]>
To: "Turbine Users List" <[EMAIL PROTECTED]>
Sent: Saturday, March 22, 2003 5:35 PM
Subject: Re: TurbineServlet


> Matt
>
> > I am currently struggling with the TurbineServlet class using vanilla
> > TDK2.1 (including the version of Tomcat shipped and Turbine 2.1).  All
>
> I'll try to help you with 2.1 if you *need* to use 2.1, but if you can
> use the current 2.2, please do.
>
>
http://jakarta.apache.org/builds/jakarta-turbine/tdk/release/2.2/tdk-2.2_01.
tar.gz
>
> Sorry that the correct link isn't on the site. We're working on the 
docs.
:)
>
> > values for such as getServerName() and getServerPort() return null.  
In
>
> Could you explain how/why you're accessing this information in this
> manner? I've never used the TurbineServlet class directly, although you
> may have a special need, which is why it would help for you to explain
> what you're doing.
>
> Eric
>



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

Reply via email to