Ok.  I think I see what you're trying to do.

One approach would be to specify a configuration class that can be passed
to the business object(s).  Then within your Action class, use
Struts/Servlet specific methods to construct the configuration object from
your files (if you use XML to specify the configuration, Commons-Digester
will greatly simplify this process).

Then, if you decide to move to a different deployment environment (such as
a local command-line driven environment) all you have to do is provide a
new class to build the configuration object.  No need to change the
business object(s) at all.


HTH,
Ian

Ian D. Stewart
Open Systems Engineer II
Enterprise Midrange - Bank One Infrastructure & Operations
[EMAIL PROTECTED]
(614) 213-6100




"Simon Kelly" <[EMAIL PROTECTED]> on 07/30/2003 09:47:55 AM

Please respond to "Struts Users Mailing List"
      <[EMAIL PROTECTED]>

To:   "Struts Users Mailing List" <[EMAIL PROTECTED]>
cc:

Subject:  Re: [OT] Best super-class for context handling.



Ah, right.

Not sure whether that's what I'm after.

Here's a better explination.

I am using files that are contained within the /WEB-INF/ dir within the web
application to hold information required by the business logic. These files
are not part of the controller or view but are required to generate the
content data for the action classes. So I need something that will get the
paths regardless of the enviroment they are in. I have chosen to pass all
file names within the business logic in the form /WEB-INF/dir/file.x and
have been using context.getRealPath() [or the correct method if that's
wrong] to get the path name (which I had thought would be ok as it will
always return the correct path regardless of where the webapp is deployed).

Is this wrong, and is there a better way to do it?

Cheers

Simon


----- Original Message -----
From: <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Wednesday, July 30, 2003 3:16 PM
Subject: Re: [OT] Best super-class for context handling.


>
>
> Ideally your business objects shouldn't know anything about the
deployment
> environment.  Not only is this good design, but it also allows you to
> migrate between (or support multiple) deployment environments with
minimal
> hassle.
>
> If all you want to do is convert between relative paths and URI's, you
> should be able to use the facilities provided by java.io.File and
> java.net.URI, regardless of deployment context.  Or am I missing
something?
>
>
> Ian
>
> Ian D. Stewart
> Open Systems Engineer II
> Enterprise Midrange - Bank One Infrastructure & Operations
> [EMAIL PROTECTED]
> (614) 213-6100
>
>
>
>
> "Simon Kelly" <[EMAIL PROTECTED]> on 07/30/2003 08:49:57 AM
>
> Please respond to "Struts Users Mailing List"
>       <[EMAIL PROTECTED]>
>
> To:   "Struts Users Mailing List" <[EMAIL PROTECTED]>
> cc:
>
> Subject:  Re: [OT] Best super-class for context handling.
>
>
>
> It's not for the actions (sorry I should have stated it in my original
> post)
> it's for the business logic and auxillary classes.
>
> Cheers
>
> Simon.
>
>
> ----- Original Message -----
> From: <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Wednesday, July 30, 2003 2:52 PM
> Subject: Re: [OT] Best super-class for context handling.
>
>
> >
> >
> > There shouldn't be a need to pass the ServletContext around.  Just call
> > servlet.getServletContext() within your action.
> >
> >
> > Ian
> >
> > Ian D. Stewart
> > Open Systems Engineer II
> > Enterprise Midrange - Bank One Infrastructure & Operations
> > [EMAIL PROTECTED]
> > (614) 213-6100
> >
> >
> >
> >
> > "Simon Kelly" <[EMAIL PROTECTED]> on 07/30/2003 08:31:25 AM
> >
> > Please respond to "Struts Users Mailing List"
> >       <[EMAIL PROTECTED]>
> >
> > To:   "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > cc:
> >
> > Subject:  [OT] Best super-class for context handling.
> >
> >
> >
> > Hi all,
> >
> > Bit off topic, sorry.
> >
> > But. What is the recommended super class to extend for a static class
> that
> > could handle URL resolving?
> >
> > I want to put any code from all my other classes into one single class
so
> I
> > don't have to keep passing the ServletContext around when a class needs
> to
> > resolve an absolute path or resolve a URL within the context.
> >
> > Any help appreciated.
> >
> > Cheers
> >
> > Simon
> >
> > 'My Friend sent me a postcard with a picture of the Earth.
> > On the back he wrote: "Wish you were here"'
> > - Steven Wright
> >
> > Institut fuer
> > Prozessdatenverarbeitung
> > und Elektronik,
> > Forschungszentrum Karlsruhe GmbH,
> > Postfach 3640,
> > D-76021 Karlsruhe,
> > Germany.
> >
> > Tel: (+49)/7247 82-4042
> > E-mail : [EMAIL PROTECTED]
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > This transmission may contain information that is privileged,
> confidential
> and/or exempt from disclosure under applicable law. If you are not the
> intended recipient, you are hereby notified that any disclosure, copying,
> distribution, or use of the information contained herein (including any
> reliance thereon) is STRICTLY PROHIBITED. If you received this
transmission
> in error, please immediately contact the sender and destroy the material
in
> its entirety, whether in electronic or hard copy format. Thank you.
> >
> >
> > ---------------------------------------------------------------------
> > 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]
>
>
>
>
>
>
>
>
>
> This transmission may contain information that is privileged,
confidential
and/or exempt from disclosure under applicable law. If you are not the
intended recipient, you are hereby notified that any disclosure, copying,
distribution, or use of the information contained herein (including any
reliance thereon) is STRICTLY PROHIBITED. If you received this transmission
in error, please immediately contact the sender and destroy the material in
its entirety, whether in electronic or hard copy format. Thank you.
>
>
> ---------------------------------------------------------------------
> 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]









This transmission may contain information that is privileged, confidential and/or 
exempt from disclosure under applicable law. If you are not the intended recipient, 
you are hereby notified that any disclosure, copying, distribution, or use of the 
information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. 
If you received this transmission in error, please immediately contact the sender and 
destroy the material in its entirety, whether in electronic or hard copy format. Thank 
you.


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

Reply via email to