[opencms-dev] using jstl import from another context to access OC pages
Stephan Hartmann
hartmann at metamesh.de
Fri Dec 1 10:42:05 CET 2006
Hi Rob,
the problem is that opencms extracts the path of the requested resource from
the requests path info (HttpServletRequest.getPathInfo()). This is normally
the path portion behind /opencms/opencms.
But for an including request (and this is what is done behind the scenes of
the import tag) this method returns the path info of the original request and
not the one of the included resource (opencms servlet). If your including
page is a jsp this might alway be null.
The servlet container instead puts the path info of the included resource into
a request attribute "javax.servlet.include.path_info".
Now the bad news is that there is no way around the problem without patching
opencms.
The reason why it works for an absolute URL is that this is not done by an
include but with an URLConnection.
Forwarding should also work (therefor you need to get hold of opencms'
ServletContext and then fetch a request dispatcher for the opencms resource).
Regards,
Stephan
--
Stephan Hartmann
#metamesh
Lippstädter Str. 22
44143 Dortmund
Email: hartmann at metamesh.de
WWW: www.metamesh.de
Fon: 0231 / 496 32 34
Fax: 0231 / 496 32 35
Am Donnerstag 30 November 2006 02:39 schrieb Rob Wunderlich:
> I'm trying to include OC content in another webapp, "webappA". I've enabled
> crossContext=true for both apps. In my "webappA" page, I use an import
> statement like:
> <c:import url="/opencms/foo.jsp" context="/opencms"/>
>
> The import executes but the content written is the "Welcome to CMS" page --
> the same page seen when using only the servlet name in a URL like
> http://localhost/opencms/opencms.
>
> The import works correctly if I use an absolute URL like:
> <c:import url="http://localhost/opencms/opencms/foo.jsp"
> context="/opencms"/> However, using the absolute URL is not acceptable.
>
> The behavior I'm seeing when using the relative URL is that everything
> after /opencms/ seems to be ignored. If I use a non-existent page, I also
> get the welcome screen instead of a status 404.
>
> Has anyone done this successfully?
>
> Thanks,
> Rob
>
>
>
> ___________________________________________________________________________
>_________ Do you Yahoo!?
> Everyone is raving about the all-new Yahoo! Mail beta.
> http://new.mail.yahoo.com
>
> _______________________________________________
> 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
>
> !DSPAM:456e36c440822031819218!
More information about the opencms-dev
mailing list