You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Thijs <cr...@mytweakers.net> on 2007/08/16 20:25:08 UTC

full path/url to page using wicket.servlet

I'm migrating my app from 1.2.2 to 1.3 And the only real problem I have 
is getting my rss feed up.
I'm adding the rss to the page head

<link title="foo.com" rel="alternate" type="application/rss+xml"...

I need the full path to the bookmarkable page to get this working (and 
generate the all links inside the rss xml)
What I used to do was:
private String getFullUrl(
          final String pageMapName,
          final Class pageClass,
          final PageParameters parameters)
  {
   
  HttpServletRequest 
request=((ServletWebRequest)getRequest()).getHttpServletRequest();
  final StringBuffer url = new StringBuffer();
    url.append(getProtocolHeader(request.getProtocol()));
    url.append(request.getServerName());
    if(request.getServerPort()!=80)
    {
      url.append(":");
      url.append(String.valueOf(request.getServerPort()));
    }
    url.append(urlFor(
            pageClass,
            parameters));
  }
 
  private String getProtocolHeader(String protocol)
  {
    if(protocol.equals("HTTP/1.1"))
      return "http://";
    else
      return "";
  }
Basically what is described on the wiki page (search for rss)
But using the Filter instead of the Servlet I'm missing part of the url.

urlFor only returns the last bit of the bookmarkable part for example:
Rss.class is mounted as /rss
and urlFor(Rss.class, new PageParameters()); returns 'rss' instead of 
'/servlet/app/rss' (what it used to do in 1.2.x)

What do I have to change to get this working again?

cheers

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


Re: full path/url to page using wicketfilter

Posted by Thijs <cr...@mytweakers.net>.
Subject has to be wicketfilter of cource

Thijs wrote:
> I'm migrating my app from 1.2.2 to 1.3 And the only real problem I 
> have is getting my rss feed up.
> I'm adding the rss to the page head
>
> <link title="foo.com" rel="alternate" type="application/rss+xml"...
>
> I need the full path to the bookmarkable page to get this working (and 
> generate the all links inside the rss xml)
> What I used to do was:
> private String getFullUrl(
>          final String pageMapName,
>          final Class pageClass,
>          final PageParameters parameters)
>  {
>    HttpServletRequest 
> request=((ServletWebRequest)getRequest()).getHttpServletRequest();
>  final StringBuffer url = new StringBuffer();
>    url.append(getProtocolHeader(request.getProtocol()));
>    url.append(request.getServerName());
>    if(request.getServerPort()!=80)
>    {
>      url.append(":");
>      url.append(String.valueOf(request.getServerPort()));
>    }
>    url.append(urlFor(
>            pageClass,
>            parameters));
>  }
>
>  private String getProtocolHeader(String protocol)
>  {
>    if(protocol.equals("HTTP/1.1"))
>      return "http://";
>    else
>      return "";
>  }
> Basically what is described on the wiki page (search for rss)
> But using the Filter instead of the Servlet I'm missing part of the url.
>
> urlFor only returns the last bit of the bookmarkable part for example:
> Rss.class is mounted as /rss
> and urlFor(Rss.class, new PageParameters()); returns 'rss' instead of 
> '/servlet/app/rss' (what it used to do in 1.2.x)
>
> What do I have to change to get this working again?
>
> cheers
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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


Re: full path/url to page using wicket.servlet

Posted by Thijs <cr...@mytweakers.net>.
Thnx Al

I'll do what you suggest as a temp fix (maybe store them in a db for 
easy redeployment) Hope you fix this though :)

Thijs

Al Maw wrote:
> Thijs wrote:
>> I need the full path to the bookmarkable page to get this working
>>
>> What do I have to change to get this working again?
>
> I need to fix WICKET-609 to make this easy for you. ;-)
>
> The reason this has become difficult in Wicket 1.3 is that we now 
> generate relative URLs so sitting behind a mod_proxy Just Works(tm).
>
> However, that now means that Wicket doesn't really know or care about 
> the servlet context path bit of your deployment, or the domain name 
> it's all sitting on.
>
> This is a good thing, as relying on those when you're behind a 
> mod_proxy breaks everything.
>
> The only way to make this work until I've fixed WICKET-609 is to use 
> the urlFor() method and manually add the appropriate domain name and 
> path on to the front of your URL.
>
> Regards,
>
> Al
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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


Re: full path/url to page using wicket.servlet

Posted by Al Maw <wi...@almaw.com>.
Thijs wrote:
> I need the full path to the bookmarkable page to get this working
> 
> What do I have to change to get this working again?

I need to fix WICKET-609 to make this easy for you. ;-)

The reason this has become difficult in Wicket 1.3 is that we now 
generate relative URLs so sitting behind a mod_proxy Just Works(tm).

However, that now means that Wicket doesn't really know or care about 
the servlet context path bit of your deployment, or the domain name it's 
all sitting on.

This is a good thing, as relying on those when you're behind a mod_proxy 
breaks everything.

The only way to make this work until I've fixed WICKET-609 is to use the 
urlFor() method and manually add the appropriate domain name and path on 
to the front of your URL.

Regards,

Al

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