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

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

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

Request.getPath介绍

暂无

代码示例

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

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");

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

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

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

/**
* 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();
}

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

/**
* 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();
}

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

/**
* 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();
}

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

@Override
public String uri() {
 return request.getPath().getPath();
}

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

public String getPath() {
  
  return request.getPath().getPath();
}

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

public String getPath() {
  
  return request.getPath().getPath();
}

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

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";

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

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

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

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

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

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

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

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

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

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

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

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;
}

相关文章