Ah.. so it is even worse... I need the "http://www.mycompany.com"; -part.

**
Martin

2009/5/18 Marat Radchenko <slonopotamusor...@gmail.com>:
> http://tomcat.apache.org/tomcat-5.5-doc/servletapi/javax/servlet/http/HttpServletRequest.html#getContextPath()
>
> 2009/5/18 Martin Makundi <martin.maku...@koodaripalvelut.com>:
>>> Just use getServletContextPath on ServletRequest.
>>
>> I do not want the installation path, I want the request path. The
>> installation path is localhost:xxx and the request path is
>> mydomain.com
>>
>> **
>> Martin
>>
>>>
>>> 2009/5/17, Martin Makundi <martin.maku...@koodaripalvelut.com>:
>>>> That is my question.. whether I am stupid or someone baptized
>>>>  "toAbsoluteUrl" wrong ;)
>>>>
>>>>  I had to devise this:
>>>>
>>>>   public static String getRootURL() {
>>>>     StringBuffer requestURL = ((Request) ((WebRequest)
>>>>  RequestCycle.get().getRequest()).getHttpServletRequest()).getRequestURL();
>>>>     int cutIndex = requestURL.indexOf("/", requestURL.indexOf("//")+2);
>>>>     if (0 < cutIndex) {
>>>>       return requestURL.substring(0, cutIndex);
>>>>     }
>>>>     return requestURL.toString();
>>>>
>>>>   }
>>>>
>>>>  **
>>>>  Martin
>>>>
>>>>  2009/5/17 Marat Radchenko <slonopotamusor...@gmail.com>:
>>>>  > Hmm... are you sure you want to use that method at all? It uses given
>>>>  > path as relative to _current reqest path_.
>>>>  > 2009/5/17, Martin Makundi <martin.maku...@koodaripalvelut.com>:
>>>>  >> No, there is no code in RequestUtils that would care about a leading
>>>>  >>  slash ... it will just result in
>>>>  >>
>>>>  >>  
>>>> "http://www.mydomain.com/BookmarkablePage/Parameter1/Value1/Parameter2//images/Image.png";
>>>>  >>
>>>>  >>  Note a typo in my previous email, normally it returns:
>>>>  >>
>>>>  >>  
>>>> "http://www.mydomain.com/BookmarkablePage/Parameter1/Value1/Parameter2/images/Image.png";
>>>>  >>  without the double-slash.
>>>>  >>
>>>>  >>  **
>>>>  >>  Martin
>>>>  >>
>>>>  >>  2009/5/17 Marat Radchenko <slonopotamusor...@gmail.com>:
>>>>  >>
>>>>  >> > Maybe RequestUtils.toAbsolutePath("/images/Image.png") (note leading 
>>>> slash)?
>>>>  >>  >
>>>>  >>  > 2009/5/17 Martin Makundi <martin.maku...@koodaripalvelut.com>:
>>>>  >>  >> Hi!
>>>>  >>  >>
>>>>  >>  >> I have a dynamic image which resides in
>>>>  >>  >> "http://www.mydomain.com/images/Image.png"; (the filename itself 
>>>> might
>>>>  >>  >> vary). In order for the image to be visible in downloaded 
>>>> documents,
>>>>  >>  >> the path must be absolute.
>>>>  >>  >>
>>>>  >>  >> RequestUtils.toAbsolutePath("images/Imange.png"); works most of the
>>>>  >>  >> time, except in situations where the user is on a bookmarkable page
>>>>  >>  >> that has parameters:
>>>>  >>  >>
>>>>  >>  >> 
>>>> http://www.mydomain.com/BookmarkablePage/Parameter1/Value1/Parameter2/Value2
>>>>  >>  >>
>>>>  >>  >> In such situations the
>>>>  >>  >> RequestUtils.toAbsolutePath("images/Imange.png") returns:
>>>>  >>  >> 
>>>> "http://www.mydomain.com/BookmarkablePage/Parameter1/Value1/Parameter2/Image.png";
>>>>  >>  >>
>>>>  >>  >> So it assumes the last parameter value was a page... is this a 
>>>> stupid
>>>>  >>  >> user bug or a real bug?
>>>>  >>  >>
>>>>  >>  >> **
>>>>  >>  >> Martin
>>>>  >>  >>
>>>>  >>  >> 
>>>> ---------------------------------------------------------------------
>>>>  >>  >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>>  >>  >> For additional commands, e-mail: users-h...@wicket.apache.org
>>>>  >>  >>
>>>>  >>  >>
>>>>  >>  >
>>>>  >>  > 
>>>> ---------------------------------------------------------------------
>>>>  >>  > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>>  >>  > For additional commands, e-mail: users-h...@wicket.apache.org
>>>>  >>  >
>>>>  >>  >
>>>>  >>
>>>>  >>  ---------------------------------------------------------------------
>>>>  >>  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>>  >>  For additional commands, e-mail: users-h...@wicket.apache.org
>>>>  >>
>>>>  >>
>>>>  >
>>>>  > ---------------------------------------------------------------------
>>>>  > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>>  > For additional commands, e-mail: users-h...@wicket.apache.org
>>>>  >
>>>>  >
>>>>
>>>>  ---------------------------------------------------------------------
>>>>  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>>  For additional commands, e-mail: users-h...@wicket.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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

Reply via email to