org.simpleframework.http.Request.getPath()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(269)

本文整理了Java中org.simpleframework.http.Request.getPath方法的一些代码示例,展示了Request.getPath的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.getPath方法的具体详情如下:
包路径:org.simpleframework.http.Request
类名称:Request
方法名:getPath

Request.getPath介绍

暂无

代码示例

代码示例来源:origin: SonarSource/sonarqube

  1. public void handle(Request req, Response resp) {
  2. try {
  3. if (req.getPath().getPath().contains("/redirect/")) {
  4. resp.setCode(303);
  5. resp.add("Location", "/");
  6. } else {
  7. if (req.getPath().getPath().contains("/timeout/")) {
  8. try {
  9. Thread.sleep(500);
  10. if (req.getPath().getPath().contains("/gzip/")) {
  11. if (!"gzip".equals(req.getValue("Accept-Encoding"))) {
  12. throw new IllegalStateException("Should accept gzip");

代码示例来源:origin: mpetazzoni/ttorrent

  1. public void handle(Request request, final Response response) {
  2. if (!Tracker.ANNOUNCE_URL.equals(request.getPath().toString())) {
  3. response.setCode(404);
  4. response.setText("Not Found");

代码示例来源:origin: org.simpleframework/simple

  1. /**
  2. * This is used to acquire the path as extracted from the HTTP
  3. * request URI. The <code>Path</code> object that is provided by
  4. * this method is immutable, it represents the normalized path
  5. * only part from the request uniform resource identifier.
  6. *
  7. * @return this returns the normalized path for the request
  8. */
  9. public Path getPath() {
  10. return request.getPath();
  11. }

代码示例来源:origin: ngallagher/simpleframework

  1. /**
  2. * This is used to acquire the path as extracted from the HTTP
  3. * request URI. The <code>Path</code> object that is provided by
  4. * this method is immutable, it represents the normalized path
  5. * only part from the request uniform resource identifier.
  6. *
  7. * @return this returns the normalized path for the request
  8. */
  9. public Path getPath() {
  10. return request.getPath();
  11. }

代码示例来源:origin: org.simpleframework/simple-http

  1. /**
  2. * This is used to acquire the path as extracted from the HTTP
  3. * request URI. The <code>Path</code> object that is provided by
  4. * this method is immutable, it represents the normalized path
  5. * only part from the request uniform resource identifier.
  6. *
  7. * @return this returns the normalized path for the request
  8. */
  9. public Path getPath() {
  10. return request.getPath();
  11. }

代码示例来源:origin: CodeStory/fluent-http

  1. @Override
  2. public String uri() {
  3. return request.getPath().getPath();
  4. }

代码示例来源:origin: lantunes/fixd

  1. public String getPath() {
  2. return request.getPath().getPath();
  3. }

代码示例来源:origin: lantunes/fixd

  1. public String getPath() {
  2. return request.getPath().getPath();
  3. }

代码示例来源:origin: openpreserve/pagelyzer

  1. String home = System.getProperty("user.dir");
  2. String contentType = "text/plain";
  3. Path path=request.getPath();
  4. if(path.getPath().substring(path.getPath().length()-3).equals(".js")) contentType = "application/javascript";
  5. if(path.getPath().substring(path.getPath().length()-3).equals("css")) contentType = "text/css";

代码示例来源:origin: tdelenikas/smslib

  1. String path = request.getPath().toString();
  2. logger.debug(String.format("IP: %s, PATH: %s", ip, path));
  3. IHttpRequestHandler h = this.httpServer.getHttpRequestHandlers().get(path);

代码示例来源:origin: opendedup/sdfs

  1. SDFSLogger.getLog().error("invalid path " + req.getPath());
  2. body.close();

代码示例来源:origin: ngallagher/simpleframework

  1. List<String> protocols = request.getValues(SEC_WEBSOCKET_PROTOCOL);
  2. String version = request.getValue(SEC_WEBSOCKET_VERSION);
  3. Path path = request.getPath();
  4. String normal = path.getPath();

代码示例来源:origin: org.simpleframework/simple-http

  1. List<String> protocols = request.getValues(SEC_WEBSOCKET_PROTOCOL);
  2. String version = request.getValue(SEC_WEBSOCKET_VERSION);
  3. Path path = request.getPath();
  4. String normal = path.getPath();

代码示例来源:origin: opendedup/sdfs

  1. try {
  2. Path reqPath = request.getPath();
  3. String[] parts = request.getTarget().split("\\?");
  4. Map<String, String> qry = null;

代码示例来源:origin: kristofa/mock-http-server

  1. public static FullHttpRequest convert(final Request request) {
  2. byte[] data = null;
  3. try {
  4. final InputStream inputStream = request.getInputStream();
  5. try {
  6. data = IOUtils.toByteArray(inputStream);
  7. } finally {
  8. inputStream.close();
  9. }
  10. } catch (final IOException e) {
  11. LOGGER.error("IOException when getting request content.", e);
  12. }
  13. final FullHttpRequestImpl httpRequest = new FullHttpRequestImpl();
  14. httpRequest.domain(request.getAddress().getDomain());
  15. httpRequest.port(request.getAddress().getPort());
  16. httpRequest.method(Method.valueOf(request.getMethod()));
  17. httpRequest.path(request.getPath().getPath());
  18. if (data.length > 0) {
  19. httpRequest.content(data);
  20. }
  21. for (final String headerField : request.getNames()) {
  22. for (final String headerFieldValue : request.getValues(headerField)) {
  23. httpRequest.httpMessageHeader(headerField, headerFieldValue);
  24. }
  25. }
  26. for (final Entry<String, String> entry : request.getQuery().entrySet()) {
  27. httpRequest.queryParameter(entry.getKey(), entry.getValue());
  28. }
  29. return httpRequest;
  30. }

相关文章