Folks, Going to try this again since I got no reply to my first inquiry. I'd like to log a bug report along the lines of "request getAttributeNames method does not return all request attributes (e.g., org.apache.tomcat.sendfile.support)". Either that or this is a doc issues somewhere. I know in the scheme of things this is not an earth-shattering issue / bug, still it's apparently not working correctly.
I would put this one of two ways, either: 1. The Tomcat HttpRequest getAttributeNames method has a bug and doesn't return the attribute like org.apache.tomcat.sendfile.support (even though I can access that attribute via the getAttribute method); or 2. There's a doc error in the getAttributeNames doc where the cases where it doesn't show all attribute names needs to be explained. My original message on the topic is below. Thanks! Chris On Fri, Jun 5, 2009 at 1:05 AM, Chris Markle<cmar...@comcast.net> wrote: > Hi, > > Probably missing something simple here but I can't figure it out... I > have pretty much just modified a simple hello world servlet as I start > to play around with NIO sendfile support. I am using Tomcat 6.0.20. I > am trying to check for the org.apache.tomcat.sendfile.support which > says I can use the sendfile mode. When I request the request > attributes in the doPut method via getAttributeNames(), I seem to get > back an Enumeration with no attribute names in it. None... But when I > ask for the org.apache.tomcat.sendfile.support attribute specifically > via getAttribute(), I do get the attribute and it is correctly set to > Boolean true/false depending on whether I've configured NIO in > server.xml. > > Here is my code: > > protected void doGet(HttpServletRequest request, HttpServletResponse > response) throws ServletException, > IOException { > Enumeration<String> attrNames = request.getAttributeNames(); > if (attrNames == null) { > System.out.println("getAttributeNames returned null"); > } else { > System.out.println("attrNames: " + > attrNames.toString()); > } > System.out.println("printing any attrs..."); > while (attrNames.hasMoreElements()) { > String attrName = attrNames.nextElement(); > System.out.println("attr: " + attrName); > } > Boolean val = (Boolean) > > request.getAttribute("org.apache.tomcat.sendfile.support"); > if (val != null) { > > System.out.println("org.apache.tomcat.sendfile.support attr found: > value: " + val.toString()); > } else { > > System.out.println("org.apache.tomcat.sendfile.support attr not > found"); > } > > response.getWriter().write("Hello, world!"); > } > > Thanks in advance for any help on this... > > Chris --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org