Hi everybody,
Looking for help again, this time with the image servlet.
---
Intro:
I've got a portal under Jetspeed 1.5 that is feeded from MMBase 1.7, the
Jetspeed portlets look into MMBase through the remote bridge and display the
requested information.
Each portlet has different "display modes" with different behaviours,
showing only some fields, a given number of items, etc. Each portlet is
configured through the Jetspeed config engine, which accesses a special
"selector" which shows lists of MMBase nodes in order to select which ones
to display. These operations are made by the portal admin.
---
Now, the problem is:
The user/pass info is stored in a config file which is used by the Java code
to retrieve the nodes and its fields. However, the images seem to have a
different way. Basically, my code to retrieve an image is as follows:
if (imagen != null) {
out.println("<img src=\"" + imagen.getFunctionValue("servletpath", null)
+"\" alt=\""+ imagen.getStringValue("title") +"\" name=\"" +
imagen.getStringValue("title") +"\" align=\""+"right"+"\" title=\""+
imagen.getStringValue("title") +"\"/>");
}
Or this one for a thumbnail:
if (imagen != null) {
List argumentos = new ArrayList();
argumentos.add("geometry(100x100)");
Node thumbnail = imagen.getFunctionValue("cache", argumentos).toNode();
out.println("<img src=\"" + thumbnail.getFunctionValue("servletpath",
null) +"\" alt=\""+ imagen.getStringValue("title") +"\" name=\"" +
imagen.getStringValue("title") +"\" align=\""+"left"+"\"
style=\""+"margin-right: 10px; margin-bottom: 5px;"+"\" title=\"" +
imagen.getStringValue("title") +"\"/>");
}
But this way I don't retrieve an image, I simply get the servlet path to
that image. That value is used for the IMG SRC attribute, which invokes the
servlet and really retrieves the image.
So this "two layer" approach to the images suggests me questions about
validation:
a) My validation is done through he following code:
// Establecemos los par�metros de conexi�n a la nube del CMS
CloudContext cloudContext =
ContextProvider.getCloudContext(configuracion.getString("cloud.url"));
HashMap credenciales = new HashMap();
credenciales.put("username",
configuracion.getString("cloud.username"));
credenciales.put("password",
configuracion.getString("cloud.password"));
// Y nos conectamos a ella, guardando el 'handle' de la misma
cloud = cloudContext.getCloud("mmbase", "name/password",
credenciales);
// Establecemos el n�mero de elementos a recuperar por defecto
en las queries
numElementosPorDefecto =
configuracion.getInt("cloud.numelementos");
So I think it's only valid for the JSP pages that use -that cloud handle-,
but not for the IMG SRC ImageServlet servlet request (done from the client
browser).
If I store the login credentials in session, any anoymous visitor could get
into the MMBase installation without login. I don't want that at all.
If not, how can I pass the 'cloud' handle to the ImageServlet? Or should I
pass user/password info? How? Should I use the "anonymous" user in MMBase to
get the images for the portal? Should I use a special user?
Thanks a million.
Ignacio Renuncio.-