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

x33g5p2x  于2022-01-17 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(150)

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

Address.getPath介绍

[英]This is used to retrieve the path of this URI. The path part is the most fundamental part of the URI. This will return the value of the path. If there is no path part then this will return a Path implementation that represents the root path represented by /.
[中]这用于检索此URI的路径。路径部分是URI最基本的部分。这将返回路径的值。如果没有路径部分,则将返回一个路径实现,该实现表示由/表示的根路径。

代码示例

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

/**
* This is used to acquire the path as extracted from the
* 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 URI.
* 
* @return this returns the normalized path for the request
*/      
public Path getPath() {
 return getAddress().getPath();
}

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

/**
* This is used to acquire the path as extracted from the
* 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 URI.
* 
* @return this returns the normalized path for the request
*/      
public Path getPath() {
 return getAddress().getPath();
}

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

/**
* This is used to acquire the path as extracted from the
* 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 URI.
* 
* @return this returns the normalized path for the request
*/      
public Path getPath() {
 return getAddress().getPath();
}

代码示例来源:origin: zanata/zanata-platform

@Override
public void handle(Request request, Response response) {
  try {
    PrintStream body = response.getPrintStream();
    long time = System.currentTimeMillis();
    response.setValue("Content-Type", "text/plain");
    response.setContentType("application/xml;charset=utf-8");
    response.setDate("Date", time);
    response.setDate("Last-Modified", time);
    String path = request.getAddress().getPath().getPath();
    log.trace("request path is {}", path);
    StatusAndContent statusAndContent = tryMatchPath(path);
    Status status = statusAndContent.status;
    response.setStatus(status);
    String content = statusAndContent.content;
    log.trace("mock container returning: status [{}], content [{}]",
        status, content);
    body.println(content);
    body.close();
  } catch (Exception e) {
    e.printStackTrace();
    response.setStatus(Status.INTERNAL_SERVER_ERROR);
    try {
      response.close();
    } catch (IOException e1) {
      throw new RuntimeException(e1);
    }
  }
}

相关文章