/** * reads and parses the request line * * @param in the input to be read * @throws java.io.IOException if an exception is thrown */ private void readRequestLine(final DataInput in) throws IOException { final String line; try { line = in.readLine(); // System.out.println(line); } catch (final Exception e) { throw new IOException("Could not read the HTTP Request Line :" + e.getClass().getName() + " : " + e.getMessage()); } final StringTokenizer lineParts = new StringTokenizer(line, " "); /* [1] Parse the method */ parseMethod(lineParts); /* [2] Parse the URI */ parseURI(lineParts); }
/** * reads and parses the request line * * @param in the input to be read * @throws java.io.IOException if an exception is thrown */ private void readRequestLine(DataInput in) throws IOException { String line; try { line = in.readLine(); // System.out.println(line); } catch (Exception e) { throw new IOException("Could not read the HTTP Request Line :" + e.getClass().getName() + " : " + e.getMessage()); } StringTokenizer lineParts = new StringTokenizer(line, " "); /* [1] Parse the method */ parseMethod(lineParts); /* [2] Parse the URI */ parseURI(lineParts); }
/** * reads and parses the request line * * @param in the input to be read * @throws java.io.IOException if an exception is thrown */ private boolean readRequestLine(DataInput in) throws IOException { String line; try { line = in.readLine(); // System.out.println(line); } catch (Exception e) { throw new IOException("Could not read the HTTP Request Line :" + e.getClass().getName() + " : " + e.getMessage()); } if (line == null) { return false; } StringTokenizer lineParts = new StringTokenizer(line, " "); /* [1] Parse the method */ parseMethod(lineParts); /* [2] Parse the URI */ parseURI(lineParts); return true; }
try { mockRequest = new HttpRequestImpl(new URI("http://mock/")); mockRequest.parseURI(new StringTokenizer("mock\n")); // will do http://mock/mock, we don't really care mock = mockRequest; } catch (final Exception e) {