Re: Replacement for 1.2's IApplicationSettings.getContextPath()?

2008-01-14 Thread Eelco Hillenius
The context path should automatically be resolved for you. Could you
give just using relative paths a try?

Eelco

On Jan 14, 2008 1:35 PM, Scott Sauyet [EMAIL PROTECTED] wrote:
 I'm finally converting from 1.2 to 1.3 and have gotten down to one
 compilation error!

 I need to find a way to replace a call to

  IApplicationSettings.getContextPath()

 I understand that all URLs are now relative, but I'm using this to pass
 to Javascript, something like this:

 HTML:

script...
var contextPath = ;
// ...
// inside an onLoad:
img.location = waitImage: contextPath + /images/wait.gif;
// ...
/script

 And in Java:

  String contextPath = Application.get().getApplicationSettings()
  .getContextPath();
  add(new StringHeaderContributor(script type='text/javascript'
  + contextPath = ' + contextPath + /';/script));


 This allows my Javascript to work in the HTML files and in the deployed
 application.  Is there a simple substitute for this?

 Thanks,

-- Scott

 -
 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]



Re: Replacement for 1.2's IApplicationSettings.getContextPath()?

2008-01-14 Thread Igor Vaynberg
see ContextImage and how it builds a context relative url

-igor


On Jan 14, 2008 7:59 PM, Scott Sauyet [EMAIL PROTECTED] wrote:
 Scott Sauyet wrote:
  I'm finally converting from 1.2 to 1.3 and have gotten down to one
  compilation error!
 
  I need to find a way to replace a call to
 
  IApplicationSettings.getContextPath()
 

 Never mind.  It really isn't that hard:

  (WebApplication) Application.get()).getServletContext()
  .getContextPath();

 Of course I'd still love to hear if there is a better way to do this!


-- Scott

 -
 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]



Re: Replacement for 1.2's IApplicationSettings.getContextPath()?

2008-01-14 Thread Scott Sauyet

Scott Sauyet wrote:
I'm finally converting from 1.2 to 1.3 and have gotten down to one 
compilation error!


I need to find a way to replace a call to

IApplicationSettings.getContextPath()



Never mind.  It really isn't that hard:

(WebApplication) Application.get()).getServletContext()
.getContextPath();

Of course I'd still love to hear if there is a better way to do this!

  -- Scott

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



Re: Replacement for 1.2's IApplicationSettings.getContextPath()?

2008-01-14 Thread Scott Sauyet

Igor Vaynberg wrote:

see ContextImage and how it builds a context relative url


That yields this:

getRequest().getRelativePathPrefixToContextRoot()

I'm not sure if this is a better approach or not, but it's at least some 
characters shorter!  To use it, I'd still have to put it in some 
Javascript, but since that's no change from the current solution, I'm 
not particularly bothered by it.


I think I'd prefer this relative path to my absolute, context path, 
based one, but I'd have to think hard to figure out why.  And it's too 
late in the evening to think hard.  I'll try this and see which I like.


Thanks for your help,

  -- Scott

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