[opencms-dev] Problem accesing protected resources from image taglib

Jorge González informatico at hotelparadisepark.com
Tue Aug 23 13:36:03 CEST 2005


Hi list:

This is an urgent issue, so please help me :)


I have a problem accessing protected resources with the jakarta-taglib-image
tags. This tags help to process images .

The problem is:

Using this page from the online project (within OpenCms)

accesing an image from
/system/modules/org.opencms.welcome/resources/logo_alkacon.gif
works well

NOTE: folder /opt/www-test/ is read protected for the guest user

accesing an image from my default web project, located in
/opt/www-test/test.jpg
doesn't work


THE WEIRD thing is, accesing this page directly from the outside world
(http://localhost:8080/opencms/opencms/opt/www-test/test.jpg) Using a fresh
browser to fire the auth process.

First, the browser shows the login box, and then /opt/www-test/test.jpg is
shown correctly

Do you have the same problem ?


I need to show a thumbnail of the protected images...


Thanks












------ file testShowImage.jsp -------

<%@page import="org.opencms.jsp.*, org.opencms.file.*, org.opencms.flex.*"
%>

<%@ taglib prefix="cmstag" uri="http://www.opencms.org/taglib/cms" %>
<%@ taglib prefix="img" uri="/WEB-INF/taglibs-image.tld" %>

<jsp:useBean id="cmsbean" class="org.opencms.jsp.CmsJspActionElement">
  <% cmsbean.init(pageContext, request, response); %>
</jsp:useBean>

<%
	// this one works from inside opencms and outside
	String uri =
"/system/modules/org.opencms.welcome/resources/logo_alkacon.gif";
	// this one only works from outside opencms ?????
	//String uri = "/opt/www-test/test.jpg";
	String x = "200";
	String y = "200";
%>



<p>Project <%=cmsbean.getRequestContext().currentProject()%>
<p>Siteroot <%=cmsbean.getRequestContext().getSiteRoot()%>
<p>URI <%=cmsbean.link(uri)%>
<p>Absolute <%=cmsbean.toAbsolute(uri)%>
	<p> img modif
	<img:image 
		display="false"
		src="<%=cmsbean.link(uri)%>"
		name="<%=x+"x"+y+"_test.jpg" %>"
		dir="generated"
		attributes="">
		
		<img:border width="3" height="3" 
			color="0xffffff"/>		
		<img:resize 
			bestfit="true"
			width="<%=x%>" 
			height="<%=y%>"
			/>
	</img:image>    
	<img border="0" name="thumb"
src="<%="/cms/generated/"+x+"x"+y+"_test.jpg" %>" alt="">
<!-- end of showPhoto  -->

	<p> img normal 
	<img border="0" name="thumb" src="<%=cmsbean.link(uri)%>">
-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 2828 bytes
Desc: not available
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20050823/f596e0ba/attachment.bin>


More information about the opencms-dev mailing list