[opencms-dev] Help required for URL rewriting in OpenCms
Michael Emmerich
m.emmerich at alkacon.com
Fri Jun 17 09:08:15 CEST 2011
Hello Raghu,
> We have a requirement that user selected country and language should be
> appended to the url. For eg the url
> http://www.domain.com/cms/airports/airportlounges.htmlshould be shown as
> http://www.domain.com/cms/in/en/airports/airportlounges.html. For this
> purpose i m using the tuckey URL rewrite filter and rewriting the
> url.The OpenCmsServlet url pattern is "/_cms_/*" and hence the url
> posted to cms will be /in/en/airports/airportlounges.html . Since the
> path "/in/en" is not physically exist in the cms, the
> CmsObject.getRequestContext().getSiteRoot() is null and the
> cms.getRequestContext().getUri()looks like
> /sites/default/in/en/airports/airportlounges.html .
> To correct this, i m removing the "/in/en/" from the uri and setting it
> back to the cms.getRequestContext().setUri(uri) and also setting
> thecms.getRequestContext().setSiteRoot("/sites/default"). However the
> CmsResource resource.getRootPath()is null and the resources related to
> the uri are not read using cms.readPath(tempUri,
> CmsResourceFilter./ALL/); . This is resulting in page not found exception.
> Can anyone please advise me ,how is the CmsResource parameters are set
> for a request and also is it possible to modify the CmsResource
> parameters ?
Maybe a resource init hander could help you. Basically, it allows to
read a different resource than the one shown in the URI. And this is
what actually is what you want.
I have attached a few slides from a presentation I made during the
OpenCms Days 2009 explaining the basic concept and a little example.
Hope this helps.
--
Kind Regards,
Michael.
-------------------
Michael Emmerich
Alkacon Software GmbH - The OpenCms Experts
http://www.alkacon.com - http://www.opencms.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: resourceinithandler.pdf
Type: application/pdf
Size: 172344 bytes
Desc: not available
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20110617/1e3fb8e2/attachment.pdf>
More information about the opencms-dev
mailing list