tapestry-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Casey" <patca...@adelphia.net>
Subject RE: TAP4 upload path?
Date Thu, 01 Sep 2005 17:19:24 GMT

	How about putting this line in your servlet:
public void init(ServletConfig config) throws ServletException {
		super.init(config);
		String temp =
config.getServletContext().getRealPath("work");
		fWorkDirectory = temp;
		if (fDebug) {
			Log.info("NOT starting scheduler because we're in
debug mode");
			return;
		}
		ScheduleReader run = new ScheduleReader();
		run.setDaemon(true);
		run.setName("Schedule Reader");
		run.start();

	}

	public static String getWorkDirectory() {
		return fWorkDirectory;
	}

	Then whenever you need the work directory just do a
MyServlet.getWorkDirector() to access the static.

	--- Pat

> -----Original Message-----
> From: Nick Stuart [mailto:baredok@gmail.com]
> Sent: Thursday, September 01, 2005 9:48 AM
> To: Tapestry users
> Subject: TAP4 upload path?
> 
> Hi all, did some digging and all I can find are references that will
> work 3.0 but not for 4. So, what is the best way to get the actually
> full path in your webcontext to upload files to? In 3 you could do
> something like:
> String path =
> getRequestCycle().getRequestContext().getServlet().getServletContext().get
> RealPath("/");
> 
> But in 4 the getRequestContext() is deprecated and there is no more
> getServlet in the context. My first question was how does one get
> ahold of the requestContext, or what seems to have replaced it,
> 'WebRequest'. and once you have it can you do anything with it to get
> the actual path?
> 
> Thanks!
> -Nick
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org




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


Mime
View raw message