• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How can I make a friendly URL like www.example.com/username ?

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I am new to JSF and this is my first JSF project.

I have written some friendly URL like "www.eample.com/customer/name" for this project, which is working great. But the URL like "www.example.com/username" just makes me headache.

For the "www.eample.com/customer/name" URL, what I need to do is writting a CustomerRedirectFilter class and add

<filter>
<filter-name>customer-redirect-filter</filter-name>
<filter-class>org.my.richfaces.CustomerRedirectFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>customer-redirect-filter</filter-name>
<url-pattern>/customer/*</url-pattern>
</filter-mapping>

into web.xml.

Now, I have written a UsernameRedirectFilter class, but do not know how to set the <url-pattern> in the web.xml.

Apparently, I can not set it as

<filter-mapping>
<filter-name>username-redirect-filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

because /* includes all the other url-pattern i already have. So how should I figure out this problem?

Any helps will be appreciated.

Sam
 
ice is for people that are not already cool. Chill with this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic