public void handle(Request req, Response resp) { try { if (req.getPath().getPath().contains("/redirect/")) { resp.setCode(303); resp.add("Location", "/"); } else { if (req.getPath().getPath().contains("/timeout/")) { try { Thread.sleep(500); if (req.getPath().getPath().contains("/gzip/")) { if (!"gzip".equals(req.getValue("Accept-Encoding"))) { throw new IllegalStateException("Should accept gzip");
public void handle(Request request, final Response response) { if (!Tracker.ANNOUNCE_URL.equals(request.getPath().toString())) { response.setCode(404); response.setText("Not Found");
/** * This is used to acquire the path as extracted from the HTTP * request URI. The <code>Path</code> object that is provided by * this method is immutable, it represents the normalized path * only part from the request uniform resource identifier. * * @return this returns the normalized path for the request */ public Path getPath() { return request.getPath(); }
/** * This is used to acquire the path as extracted from the HTTP * request URI. The <code>Path</code> object that is provided by * this method is immutable, it represents the normalized path * only part from the request uniform resource identifier. * * @return this returns the normalized path for the request */ public Path getPath() { return request.getPath(); }
/** * This is used to acquire the path as extracted from the HTTP * request URI. The <code>Path</code> object that is provided by * this method is immutable, it represents the normalized path * only part from the request uniform resource identifier. * * @return this returns the normalized path for the request */ public Path getPath() { return request.getPath(); }
@Override public String uri() { return request.getPath().getPath(); }
public String getPath() { return request.getPath().getPath(); }
public String getPath() { return request.getPath().getPath(); }
String home = System.getProperty("user.dir"); String contentType = "text/plain"; Path path=request.getPath(); if(path.getPath().substring(path.getPath().length()-3).equals(".js")) contentType = "application/javascript"; if(path.getPath().substring(path.getPath().length()-3).equals("css")) contentType = "text/css";
String path = request.getPath().toString(); logger.debug(String.format("IP: %s, PATH: %s", ip, path)); IHttpRequestHandler h = this.httpServer.getHttpRequestHandlers().get(path);
SDFSLogger.getLog().error("invalid path " + req.getPath()); body.close();
List<String> protocols = request.getValues(SEC_WEBSOCKET_PROTOCOL); String version = request.getValue(SEC_WEBSOCKET_VERSION); Path path = request.getPath(); String normal = path.getPath();
List<String> protocols = request.getValues(SEC_WEBSOCKET_PROTOCOL); String version = request.getValue(SEC_WEBSOCKET_VERSION); Path path = request.getPath(); String normal = path.getPath();
try { Path reqPath = request.getPath(); String[] parts = request.getTarget().split("\\?"); Map<String, String> qry = null;
public static FullHttpRequest convert(final Request request) { byte[] data = null; try { final InputStream inputStream = request.getInputStream(); try { data = IOUtils.toByteArray(inputStream); } finally { inputStream.close(); } } catch (final IOException e) { LOGGER.error("IOException when getting request content.", e); } final FullHttpRequestImpl httpRequest = new FullHttpRequestImpl(); httpRequest.domain(request.getAddress().getDomain()); httpRequest.port(request.getAddress().getPort()); httpRequest.method(Method.valueOf(request.getMethod())); httpRequest.path(request.getPath().getPath()); if (data.length > 0) { httpRequest.content(data); } for (final String headerField : request.getNames()) { for (final String headerFieldValue : request.getValues(headerField)) { httpRequest.httpMessageHeader(headerField, headerFieldValue); } } for (final Entry<String, String> entry : request.getQuery().entrySet()) { httpRequest.queryParameter(entry.getKey(), entry.getValue()); } return httpRequest; }