[opencms-dev] isInsideProject() returns always true for me

Achim Westermann achim.westermann at questico.de
Tue Feb 9 17:01:12 CET 2010


Hi Vaclav,

that method does something different: Checks whether the resource is in a subpath of the configured project (thus belongs to it). I know 
this is somewhat "weird" that projects on the one hand have path semantics and on the other hand there is a "special" Online project which 
is standing for the published resources...

You should try something like:

myCmsJspActionElement.getRequestContext().currentProject().isOnlineProject()

HTH,

Achim

Vaclav Balak wrote:
> Hi,
>   I have following piece of code to deciding that resource is or is
> not inside online project:
> 
> CmsProject onlineProject =
> cmsObject.readProject(CmsProject.ONLINE_PROJECT_NAME);
> CmsResourceUtil resUtil = new CmsResourceUtil(cmsObject);
> resUtil.setReferenceProject(onlineProject);
> resUtil.setResource(resource);
> boolean isInside = resUtil.isInsideProject();
> 
> Problem is that I get always "true", but when I browse to Online
> project in Explorer, that resource is not there :-(. Where can be
> problem?
> 
> Thanks in advance
> Vaclav Balak
> 
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
> 



More information about the opencms-dev mailing list