Hi guys, so I've managed to find a someone challenging task. I'm creating
profiles and I'd like to create profile domains and do a url rewrite so
those domains appear directly after the baseUrl.
Example domain.com/profile/profiledomain
to
domain.com/profile
now the profiledomain will actually be the context of the profile page and
the context will be stored in the database, so that will need to be
dynamic.
Now I was able to get it to work with this code, but it's a really bad way
of doing it do to the fact a query would take place on every single page in
the app.
if (path.startsWith("/")) {
String profileDomain = path.substring(path.lastIndexOf("/") +
1, path.length());
UserProfile userprofile = null;
if (profileDomain != null) {
userprofile = crudDAO.getFindByProperty(Profile.class,
"profileDomain", profileDomain);
if (userprofile == null) {
return null;
return new PageRenderRequestParameters(
"profile",
new URLEventContext(contextValueEncoder, new
String[]{userprofile.getProfileDomain()}),
false);
So other than ignoring every package and page, how else could I dynamically
do this?
profiles and I'd like to create profile domains and do a url rewrite so
those domains appear directly after the baseUrl.
Example domain.com/profile/profiledomain
to
domain.com/profile
now the profiledomain will actually be the context of the profile page and
the context will be stored in the database, so that will need to be
dynamic.
Now I was able to get it to work with this code, but it's a really bad way
of doing it do to the fact a query would take place on every single page in
the app.
if (path.startsWith("/")) {
String profileDomain = path.substring(path.lastIndexOf("/") +
1, path.length());
UserProfile userprofile = null;
if (profileDomain != null) {
userprofile = crudDAO.getFindByProperty(Profile.class,
"profileDomain", profileDomain);
if (userprofile == null) {
return null;
return new PageRenderRequestParameters(
"profile",
new URLEventContext(contextValueEncoder, new
String[]{userprofile.getProfileDomain()}),
false);
So other than ignoring every package and page, how else could I dynamically
do this?