jTracer  1.03
Stack trace visualization tool
Hashtable<String, String> org.libcsdbg.jtracer.Session.getRequest ( ) throws IOException

Read and parse an incoming LDP request.

Returns
the client request, parsed into LDP fields
See Also
LDP (Libcsdbg Debug Protocol)

Definition at line 224 of file Session.java.

Referenced by org.libcsdbg.jtracer.Session.run().

225  {
226  Hashtable<String, String> retval = new Hashtable<String, String>();
227 
228  int cnt = 0;
229  boolean text = false;
230  StringBuffer buffer = new StringBuffer();
231  StringBuffer trace = new StringBuffer();
232 
233  /* Read a line at a time and parse it */
234  do {
235  String ln = rx.readLine();
236  if (ln == null)
237  throw new IOException("The peer disconnected prematurely");
238 
239  cnt++;
240  buffer.append(ln).append("\n");
241  if (ln.length() == 0) {
242  text = true;
243  continue;
244  }
245 
246  if (text) {
247  trace.append(ln).append("\n");
248  continue;
249  }
250 
251  String hdr[] = ln.split(":");
252  if (hdr.length < 2 || hdr[0].trim().length() == 0) {
253  String msg = "LDP request format error (" + cnt + ": " + ln + ")";
254  throw new ProtocolException(msg);
255  }
256 
257  String field = hdr[1];
258  for (int i = 2; i < hdr.length; i++)
259  field += ":" + hdr[i];
260 
261  retval.put(hdr[0].trim(), field.trim());
262  }
263  while (!buffer.toString().endsWith("}\n\n"));
264 
265  retval.put("trace", trace.toString().trim());
266  retval.put("request", buffer.toString().trim());
267  return retval;
268  }

+ Here is the caller graph for this function: