You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@roller.apache.org by Adib Saikali <ad...@programmingmastery.com> on 2007/10/28 21:46:14 UTC

How does roller compute $url.absoluteSite

Hello Roller Developers,

I am wondering how $url.absoluteSite works in roller 3.1. I have a strange
bug on my roller implementation which I have tracked down to
$url.absoluteSite not working correctly, but I have not been able to find
why.

How the problem shows up:

1. on my site $url.absoluteSite keeps returning test.sereneambition.com
rather than www.sereneambition.com for a while I ran the roller 3.1 on
test.sereneambiton.com while I was testing it but now that I have switched
to production it still shows up. for example, when I log in as admin all the
URLs to the roller site show up as test.sereneambition.com, 


So far I have done the following.

1. Searched all the data in the database for test.sereneambition.com. I did
this by doing a pg_dump and then doing a search on the dump, so I know that
I searched all tables.

2. I turned on debug on the org.apache.roller.ui.core.filters.InitFilter and
the debug file shown that the filter was calculating the site
$url.absoluteSite correctly 

3. As I was reading various sources I got to the following method
RollerRuntimeConfig.getAbsoluteContextURL() and ended searching my whole
generated war file to see if site.absoluteurl is set to anything and I did
not change it from the defaults.

 public static String getAbsoluteContextURL() {
        
        // db prop takes priority if it exists
        String absURL = getProperty("site.absoluteurl");
        if(absURL != null && absURL.trim().length() > 0) {
            return absURL;
        }
        
        return absoluteContextURL;
    }
    
So how does this method work how does the db prop take priority. Is the
absolute URL somehow encoded in the database so that when I searched for it
did not show up. What could cause it to consistently return
test.sereneambition.com jut because I created the blog on a test server that
was hosted on that url?

Any help is appreciated 
Adib 


RE: How does roller compute $url.absoluteSite

Posted by Adib Saikali <ad...@programmingmastery.com>.
Thank you I think I will be setting an absolute URL tonight.  

-----Original Message-----
From: Dave [mailto:snoopdave@gmail.com] 
Sent: Monday, October 29, 2007 1:16 PM
To: dev@roller.apache.org
Subject: Re: How does roller compute $url.absoluteSite

On 10/29/07, Adib Saikali <ad...@programmingmastery.com> wrote:
> Thanks Dave, that was very helpful, I think I have solved the problem it
may
> have been related to some issues with DNS and my tomcat configuration, I
> have moved servers again and problem appears to have gone away.
>
> Is it a roller best practice to setup the absoulte URL propert? Can you
give
> an example of what situations you should set it up under?

Here is an example: If visitors to your site come via both
www.example.com and example.com and you prefer the example.com, then
you might want to set the absolute URL to http://example.com/ to
ensure that all links that Roller generates use the same URL.

- Dave


Re: How does roller compute $url.absoluteSite

Posted by Dave <sn...@gmail.com>.
On 10/29/07, Adib Saikali <ad...@programmingmastery.com> wrote:
> Thanks Dave, that was very helpful, I think I have solved the problem it may
> have been related to some issues with DNS and my tomcat configuration, I
> have moved servers again and problem appears to have gone away.
>
> Is it a roller best practice to setup the absoulte URL propert? Can you give
> an example of what situations you should set it up under?

Here is an example: If visitors to your site come via both
www.example.com and example.com and you prefer the example.com, then
you might want to set the absolute URL to http://example.com/ to
ensure that all links that Roller generates use the same URL.

- Dave

RE: How does roller compute $url.absoluteSite

Posted by Adib Saikali <ad...@programmingmastery.com>.
Thanks Dave, that was very helpful, I think I have solved the problem it may
have been related to some issues with DNS and my tomcat configuration, I
have moved servers again and problem appears to have gone away.

Is it a roller best practice to setup the absoulte URL propert? Can you give
an example of what situations you should set it up under?

Thanks
Adib
-----Original Message-----
From: Dave [mailto:snoopdave@gmail.com] 
Sent: Monday, October 29, 2007 7:42 AM
To: dev@roller.apache.org
Subject: Re: How does roller compute $url.absoluteSite

This should give you the value set in the database.
   select value from roller_properties where name='site.absoluteurl'

If the value is not set in the database, then Roller determines the
site URL by examining the requestURL that comes from the first request
that hits the system.

- Dave


On 10/28/07, Adib Saikali <ad...@programmingmastery.com> wrote:
> Hello Roller Developers,
>
> I am wondering how $url.absoluteSite works in roller 3.1. I have a strange
> bug on my roller implementation which I have tracked down to
> $url.absoluteSite not working correctly, but I have not been able to find
> why.
>
> How the problem shows up:
>
> 1. on my site $url.absoluteSite keeps returning test.sereneambition.com
> rather than www.sereneambition.com for a while I ran the roller 3.1 on
> test.sereneambiton.com while I was testing it but now that I have switched
> to production it still shows up. for example, when I log in as admin all
the
> URLs to the roller site show up as test.sereneambition.com,
>
>
> So far I have done the following.
>
> 1. Searched all the data in the database for test.sereneambition.com. I
did
> this by doing a pg_dump and then doing a search on the dump, so I know
that
> I searched all tables.
>
> 2. I turned on debug on the org.apache.roller.ui.core.filters.InitFilter
and
> the debug file shown that the filter was calculating the site
> $url.absoluteSite correctly
>
> 3. As I was reading various sources I got to the following method
> RollerRuntimeConfig.getAbsoluteContextURL() and ended searching my whole
> generated war file to see if site.absoluteurl is set to anything and I did
> not change it from the defaults.
>
>  public static String getAbsoluteContextURL() {
>
>         // db prop takes priority if it exists
>         String absURL = getProperty("site.absoluteurl");
>         if(absURL != null && absURL.trim().length() > 0) {
>             return absURL;
>         }
>
>         return absoluteContextURL;
>     }
>
> So how does this method work how does the db prop take priority. Is the
> absolute URL somehow encoded in the database so that when I searched for
it
> did not show up. What could cause it to consistently return
> test.sereneambition.com jut because I created the blog on a test server
that
> was hosted on that url?
>
> Any help is appreciated
> Adib
>
>


Re: How does roller compute $url.absoluteSite

Posted by Dave <sn...@gmail.com>.
This should give you the value set in the database.
   select value from roller_properties where name='site.absoluteurl'

If the value is not set in the database, then Roller determines the
site URL by examining the requestURL that comes from the first request
that hits the system.

- Dave


On 10/28/07, Adib Saikali <ad...@programmingmastery.com> wrote:
> Hello Roller Developers,
>
> I am wondering how $url.absoluteSite works in roller 3.1. I have a strange
> bug on my roller implementation which I have tracked down to
> $url.absoluteSite not working correctly, but I have not been able to find
> why.
>
> How the problem shows up:
>
> 1. on my site $url.absoluteSite keeps returning test.sereneambition.com
> rather than www.sereneambition.com for a while I ran the roller 3.1 on
> test.sereneambiton.com while I was testing it but now that I have switched
> to production it still shows up. for example, when I log in as admin all the
> URLs to the roller site show up as test.sereneambition.com,
>
>
> So far I have done the following.
>
> 1. Searched all the data in the database for test.sereneambition.com. I did
> this by doing a pg_dump and then doing a search on the dump, so I know that
> I searched all tables.
>
> 2. I turned on debug on the org.apache.roller.ui.core.filters.InitFilter and
> the debug file shown that the filter was calculating the site
> $url.absoluteSite correctly
>
> 3. As I was reading various sources I got to the following method
> RollerRuntimeConfig.getAbsoluteContextURL() and ended searching my whole
> generated war file to see if site.absoluteurl is set to anything and I did
> not change it from the defaults.
>
>  public static String getAbsoluteContextURL() {
>
>         // db prop takes priority if it exists
>         String absURL = getProperty("site.absoluteurl");
>         if(absURL != null && absURL.trim().length() > 0) {
>             return absURL;
>         }
>
>         return absoluteContextURL;
>     }
>
> So how does this method work how does the db prop take priority. Is the
> absolute URL somehow encoded in the database so that when I searched for it
> did not show up. What could cause it to consistently return
> test.sereneambition.com jut because I created the blog on a test server that
> was hosted on that url?
>
> Any help is appreciated
> Adib
>
>