-
聽聽聽 public static final String convertToString(HttpServletRequest request) {
聽聽聽聽聽聽聽 StringBuffer msg = new StringBuffer();
聽聽聽聽聽聽聽 try {
聽聽聽聽聽聽聽聽聽聽聽 msg.append("*RequestURI:" + request.getRequestURI() + "\n");
聽聽聽聽聽聽聽聽聽聽聽 msg.append("*ContentType:" + request.getContentType() + "\n");
聽聽聽聽聽聽聽聽聽聽聽 msg.append("== Request Header\n");
聽聽聽聽聽聽聽聽聽聽聽 Enumeration headers = request.getHeaderNames();
聽聽聽聽聽聽聽聽聽聽聽 while (headers.hasMoreElements()) {
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 String headerName = "" + headers.nextElement();
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 msg.append(headerName + ":" + request.getHeader(headerName) + "\n");
聽聽聽聽聽聽聽聽聽聽聽 }
聽聽聽聽聽聽聽聽聽聽聽 msg.append("\n");
聽聽聽聽聽聽聽聽聽聽 聽
聽聽聽聽聽聽聽聽聽聽聽 Enumeration attr = request.getParameterNames();聽聽聽聽聽聽聽聽 聽
聽聽聽聽聽聽聽聽聽聽 聽
聽聽聽聽聽聽聽聽聽聽聽 ArrayList l = new ArrayList();
聽聽聽聽聽聽聽聽聽聽聽 String att;
聽聽聽聽聽聽聽聽聽聽聽 while (attr.hasMoreElements()) {
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 att = (String) attr.nextElement();
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 l.add(att + " -> " + request.getParameter(att));
聽聽聽聽聽聽聽聽聽聽聽 }
聽聽聽聽聽聽聽聽聽聽 聽
聽聽聽聽聽聽聽聽聽聽聽 msg.append("=== Request ( " + l.size() + " ) ===\n");
聽聽聽聽聽聽聽聽聽聽聽 Object a[] = l.toArray();
聽聽聽聽聽聽聽聽聽聽聽 Arrays.sort(a);
聽聽聽聽聽聽聽聽聽聽聽 for (int i = 0; i < a.length; i++) {
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 msg.append((String) a[i]);
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 msg.append("\n");
聽聽聽聽聽聽聽聽聽聽聽 }
聽聽聽聽聽聽聽聽聽聽聽 msg.append("===聽聽 ===聽聽 ===\n");
聽聽聽聽聽聽聽聽聽聽 聽
聽聽聽聽聽聽聽聽聽聽聽 // Process the Session
聽聽聽聽聽聽聽聽聽聽聽 HttpSession session = request.getSession();
聽聽聽聽聽聽聽聽聽聽聽 // msg.append("\n");
聽聽聽聽聽聽聽聽聽聽 聽
聽聽聽聽聽聽聽聽聽聽聽 Enumeration e = session.getAttributeNames();
聽聽聽聽聽聽聽聽聽聽 聽
聽聽聽聽聽聽聽聽聽聽聽 TreeMap t = new TreeMap();
聽聽聽聽聽聽聽聽聽聽聽 String k;
聽聽聽聽聽聽聽聽聽聽聽 while (e.hasMoreElements()) {
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 k = (String) e.nextElement();
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 Object oggetto;
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 try {
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 oggetto = session.getAttribute(k);
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 } catch (Throwable notSerializableException) {
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 oggetto = "NON DESERIALIZZABILE. Chiave:" + k;
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 聽
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 }
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 t.put(k, oggetto);
聽聽聽聽聽聽聽聽聽聽聽 }
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 聽
聽聽聽聽聽聽聽聽聽聽聽 Object orderedKeys[] = t.keySet().toArray();
聽聽聽聽聽聽聽聽聽聽聽 msg.append("=== Session聽 ( " + orderedKeys.length + " " + (usertempz != null ? "+ 1UT" : " NO UT!") + " )===\n");
聽聽聽聽聽聽聽聽聽聽聽 Object elem;
聽聽聽聽聽聽聽聽聽聽聽 for (int i = 0; i < orderedKeys.length; i++) {
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 elem = t.get(orderedKeys[i]);
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 msg.append(orderedKeys[i]);
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 msg.append("\t-> ");
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 if (elem != null) {
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 nicePrintSessionObj(msg, elem);
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 } else {
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 msg.append("null");
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 }
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 msg.append("\n");
聽聽聽聽聽聽聽聽聽聽聽 }
聽聽聽聽聽聽聽聽聽聽聽 return msg.toString();
聽聽聽聽聽聽聽 } catch (RuntimeException e) {
聽聽聽聽聽聽聽聽聽聽聽 return msg + "\nERR: Cannot print session/request!!" + e.getMessage();
聽聽聽聽聽聽聽 }
聽聽聽 }
Read More -
(First published on 2007-01-20)
Hi all, ObjectsRoot now has correct story ordering ontags view!
Read More -
Hi blog readers! Your trip master has just come back from a win trip done in the swap of the year. We have been in Modena in December and in Padova, this month. We have done one-day-trips, fast and furious as usual. I have done about 6 photos to Modena. I liked a bit more Padova, which needs at least two days to be seen. Padova has a lot of beautiful and nice churches to see. Consider only the Scrovengi’s Chapel, very well known.
Read More -
I am very proud to present an Italian comedy called Vampata D'amore (Love's Flush) written by my cusin, Alessandro Bonvini.
Read More -
I have surfed today and I have found two sites worth to see: <a href=“http://www.rocketboom.com/"
Read More -
The trends of this october are about some upcoming products. A clear analisys of <a href=“http://www.roughlydrafted.com/Sept05.Quark.html"
Read More -
I have tried Exupery, the Squeak byte compiler written by Bryce Kampjes. Exupery is still in beta but is usable for experimenting. SqueakWeekly is happy to publish a prime-time FAQ!
聽
Read More