You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Peter Beshai <pe...@gmail.com> on 2007/07/26 00:40:03 UTC

T5 - Access configured application default value from component

In my application, people can upload files. What is the best way to
configure the root of the location the files go to?

I thought I'd contribute to ApplicationDefaults like so:

public static void contributeApplicationDefaults(
            MappedConfiguration<String, String> configuration)
    {
        configuration.add("tutor.file-system-root", "/Users/pbeshai/tmproot/");
        configuration.add("tapestry.supported-locales", "en");
        configuration.add("tapestry.start-page-name", "Login");
    }


And hopefully be able to inject that value into components where
necessary. Is there a more advised way of doing this?

Unfortunately, I am unable to retrieve this value in my component
(from simple lack of know-how).

I thought it might be similar to
@Inject
@Value("${tutor.file-system-root}")
private String _fileSystemRoot;

public String getFileSystemRoot() { return _fileSystemRoot; }

But I've had no such luck.

Does anyone know the correct way to do this?

Thanks,
-- 
Peter Beshai

CS 134 Tutor
University of Waterloo

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


Re: T5 - Access configured application default value from component

Posted by Peter Beshai <pe...@gmail.com>.
No unordinary log messages (I switched on debug logging ... oo boy...
but nothing stood out) and no exceptions. I put ${filesystemroot} in
my template and it renders blank.



On 7/25/07, Howard Lewis Ship <hl...@gmail.com> wrote:
> Off the top of my head, that should work.  What behavior are you seeing? Any
> log messages or exceptions?
>
> On 7/25/07, Peter Beshai <pe...@gmail.com> wrote:
> >
> > In my application, people can upload files. What is the best way to
> > configure the root of the location the files go to?
> >
> > I thought I'd contribute to ApplicationDefaults like so:
> >
> > public static void contributeApplicationDefaults(
> >             MappedConfiguration<String, String> configuration)
> >     {
> >         configuration.add("tutor.file-system-root",
> > "/Users/pbeshai/tmproot/");
> >         configuration.add("tapestry.supported-locales", "en");
> >         configuration.add("tapestry.start-page-name", "Login");
> >     }
> >
> >
> > And hopefully be able to inject that value into components where
> > necessary. Is there a more advised way of doing this?
> >
> > Unfortunately, I am unable to retrieve this value in my component
> > (from simple lack of know-how).
> >
> > I thought it might be similar to
> > @Inject
> > @Value("${tutor.file-system-root}")
> > private String _fileSystemRoot;
> >
> > public String getFileSystemRoot() { return _fileSystemRoot; }
> >
> > But I've had no such luck.
> >
> > Does anyone know the correct way to do this?
> >
> > Thanks,
> > --
> > Peter Beshai
> >
> > CS 134 Tutor
> > University of Waterloo
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
> --
> Howard M. Lewis Ship
> TWD Consulting, Inc.
> Independent J2EE / Open-Source Java Consultant
> Creator and PMC Chair, Apache Tapestry
> Creator, Apache HiveMind
>
> Professional Tapestry training, mentoring, support
> and project work.  http://howardlewisship.com
>


-- 
Peter Beshai

CS 134 Tutor
University of Waterloo

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


Re: T5 - Access configured application default value from component

Posted by Howard Lewis Ship <hl...@gmail.com>.
Off the top of my head, that should work.  What behavior are you seeing? Any
log messages or exceptions?

On 7/25/07, Peter Beshai <pe...@gmail.com> wrote:
>
> In my application, people can upload files. What is the best way to
> configure the root of the location the files go to?
>
> I thought I'd contribute to ApplicationDefaults like so:
>
> public static void contributeApplicationDefaults(
>             MappedConfiguration<String, String> configuration)
>     {
>         configuration.add("tutor.file-system-root",
> "/Users/pbeshai/tmproot/");
>         configuration.add("tapestry.supported-locales", "en");
>         configuration.add("tapestry.start-page-name", "Login");
>     }
>
>
> And hopefully be able to inject that value into components where
> necessary. Is there a more advised way of doing this?
>
> Unfortunately, I am unable to retrieve this value in my component
> (from simple lack of know-how).
>
> I thought it might be similar to
> @Inject
> @Value("${tutor.file-system-root}")
> private String _fileSystemRoot;
>
> public String getFileSystemRoot() { return _fileSystemRoot; }
>
> But I've had no such luck.
>
> Does anyone know the correct way to do this?
>
> Thanks,
> --
> Peter Beshai
>
> CS 134 Tutor
> University of Waterloo
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com