MCPcopy Index your code
hub / github.com/HtmlUnit/htmlunit / parseRequest

Method parseRequest

src/test/java/org/htmlunit/util/MiniServer.java:204–231  ·  view source on GitHub ↗
(final String request)

Source from the content-addressed store, hash-verified

202 }
203
204 private WebRequest parseRequest(final String request) {
205 final int firstSpace = request.indexOf(' ');
206 final int secondSpace = request.indexOf(' ', firstSpace + 1);
207
208 HttpMethod submitMethod = HttpMethod.GET;
209 final String methodText = request.substring(0, firstSpace);
210 if ("OPTIONS".equalsIgnoreCase(methodText)) {
211 submitMethod = HttpMethod.OPTIONS;
212 }
213 else if ("POST".equalsIgnoreCase(methodText)) {
214 submitMethod = HttpMethod.POST;
215 }
216
217 final String requestedPath = request.substring(firstSpace + 1, secondSpace);
218 if ("/favicon.ico".equals(requestedPath)) {
219 LOG.debug("Skipping /favicon.ico");
220 return null;
221 }
222 try {
223 final URL url = new URL("http://localhost:" + port_ + requestedPath);
224 lastRequest_ = request;
225 return new WebRequest(url, submitMethod);
226 }
227 catch (final MalformedURLException e) {
228 LOG.error(e);
229 return null;
230 }
231 }
232
233 /**
234 * @return the last received request

Callers 4

runMethod · 0.95
doPostMethod · 0.80
doPostMethod · 0.80
doPostMethod · 0.80

Calls 5

substringMethod · 0.80
debugMethod · 0.65
errorMethod · 0.65
indexOfMethod · 0.45
equalsMethod · 0.45

Tested by

no test coverage detected