I'm sorry, I inadvertently sent the mail, but I wasn't finished writing yet :(

continued:
> For example: 
 
public class Foo extends _Foo {
   
   @Inject @Symbol(value="baseDir")  // not possible
   String baseDir;

   public String getAbsoluteLocalFilepath() {
       
       return baseDir + "/" + toUser.getId() + "/" + getFilename();
     }
}

The return value is a path to a file. The files get uploaded by users and each 
user has their own folder inside of baseDir. Each foo object has a relation to 
a user object and a field filename. 

baseDir is a symbol read from myApp.properties. On the production server it 
could be /var/myApp/userfiles/, on another machine it could be 
/home/username/myApp/userfiles, set in eclipse as VM argument -DbaseDir=...

getAbsoluteLocalFilepath() is called in page classes, e. g. to store a file 
under this path. Another example for a method in Foo could be 
public InlineFileStreamResponse getImageAsStream() ...
where we also need the baseDir.

The files are uploaded by users. They can't be Assets and we don't want blobs 
in the database.


> > The other approach would be to use a servlet filter, which is much
> > more complex.  You'd probably have to register a thread local to bind
> > your Tapestry symbol values into and then retrieve them inside your
> > CayenneDataObject subclasses (Foo, Bar, etc) using a lifecycle
> > callback.  I think this approach would be more work and more magic
> > (harder to implement and understand/maintain later), but if you would
> > like to explore this avenue instead of a Tapestry service, just ask.

There are few methods like the example above and the baseDir and a second value 
are injected in page classes since the example with the Inject doesn't work. 
Then the baseDir is passed to the method:
getAbsoluteLocalFilepath(baseDir);


If I wrote a TapestryCayenneService, would I have to use it for the creation of 
every Cayenne object? There are 13 classes and only two of them would use two 
injected symbol values.
Would it still be possible to use BeanEditForm to create objects?



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

Reply via email to