You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-user@jakarta.apache.org by Dmitry Beransky <db...@ucsd.edu> on 2001/11/17 06:43:17 UTC

getting content's mime

Hi,

Now that I got my index page to work, I've modified it to display 
thumbnails of jpegs that happen to reside in that directory.  Is this the 
correct way of getting to the mime info of a node:

                org.apache.slide.taglib.bean.NodeBean servletNodeBean = 
ns.getNode("/files"+request.getServletPath(),true);
                org.apache.slide.taglib.bean.NodeBean currentDir = 
servletNodeBean.getParent();
                java.util.Vector children = currentDir.getChildren();

                for( int i=0; i<children.size(); i++ )
                {
                   org.apache.slide.taglib.bean.NodeBean node = 
(org.apache.slide.taglib.bean.NodeBean)children.elementAt(i);
                   String uri = 
request.getContextPath()+node.getUri().substring(6);
                   String mime = 
node.getLatestRevision().getProperty("getcontenttype",null).getValue();

                   if( !mime.equals("image/jpeg") )
                      continue;
                %>
                   <a href="<%=uri%>"><img src="<%=uri%>" width="100"></a>
                <%
                }


Thanks
Dmitry


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>