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

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

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

Request.getTarget介绍

暂无

代码示例

代码示例来源:origin: jersey/jersey

private URI getRequestUri(final Request request, final URI baseUri) {
  try {
    final String serverAddress = getServerAddress(baseUri);
    String uri = ContainerUtils.getHandlerPath(request.getTarget());
    final String queryString = request.getQuery().toString();
    if (queryString != null) {
      uri = uri + "?" + ContainerUtils.encodeUnsafeCharacters(queryString);
    }
    return new URI(serverAddress + uri);
  } catch (URISyntaxException ex) {
    throw new IllegalArgumentException(ex);
  }
}

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

/**
* This can be used to get the URI specified for this HTTP request.
* This corresponds to the either the full HTTP URI or the path
* part of the URI depending on how the client sends the request.
*
* @return the URI address that this HTTP request is targeting
*/ 
public String getTarget() {
 return request.getTarget();
}

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

/**
* This can be used to get the URI specified for this HTTP request.
* This corresponds to the either the full HTTP URI or the path
* part of the URI depending on how the client sends the request.
*
* @return the URI address that this HTTP request is targeting
*/ 
public String getTarget() {
 return request.getTarget();
}

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

/**
* This can be used to get the URI specified for this HTTP request.
* This corresponds to the either the full HTTP URI or the path
* part of the URI depending on how the client sends the request.
*
* @return the URI address that this HTTP request is targeting
*/ 
public String getTarget() {
 return request.getTarget();
}

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

/**
 * Returns the full request URI.
 * 
 * @return The full request URI.
 */
@Override
public String getRequestUri() {
  return this.request.getTarget();
}

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

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

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

public static String getUndecodedPath(Request request) {
    
    String path = request.getTarget();
    int queryIndex = path.indexOf('?');
    if (queryIndex != -1) {
      path = path.substring(0, queryIndex);
    }
    return path;
  }
}

代码示例来源:origin: restx/restx

public SimpleRestxRequest(HttpSettings httpSettings, String apiPath, Request request) {
  super(httpSettings);
  this.apiPath = apiPath;
  this.request = request;
  String path = request.getTarget().substring(apiPath.length());
  if (path.indexOf("?") != -1) {
    path = path.substring(0, path.indexOf("?"));
  }
  this.restxPath = path;
}

代码示例来源:origin: io.restx/restx-server-simple

public SimpleRestxRequest(HttpSettings httpSettings, String apiPath, Request request) {
  super(httpSettings);
  this.apiPath = apiPath;
  this.request = request;
  String path = request.getTarget().substring(apiPath.length());
  if (path.indexOf("?") != -1) {
    path = path.substring(0, path.indexOf("?"));
  }
  this.restxPath = path;
}

代码示例来源:origin: miltonio/milton2

private void checkTasks() {
  long l;
  for( Task t : this.dispatchStage.queue ) {
    // check enqueue time
    l = System.currentTimeMillis() - t.enqueueTime;
    if( l > maxQueueTimeMillis ) {
      // bif it
      log.warn( "XXX task is too long in queue: " + l + "ms. " + t );
      log.warn( "Queue Size: " + dispatchStage.queue.size() );
      log.warn( "listing contents of queue -" );
      for( Task q : dispatchStage.queue ) {
        log.warn( " - " + q.request.getTarget() );
      }
      log.warn( "---" );
      this.dispatchStage.queue.remove( t );
      respondError( t );
    } else {
      if( t.startTime > 0 ) {
        // check process time
        l = System.currentTimeMillis() - t.startTime;
        if( l > maxProcessTimeMillis ) {
          log.warn( "**** task is too long being processed: " + l + "ms. " + t );
          t.thisThread.interrupt();
        }
      }
    }
  }
}

代码示例来源:origin: miltonio/milton2

private void checkTasks() {
    long l;
    for (Task t : this.dispatchStage.queue) {
      // check enqueue time
      l = System.currentTimeMillis() - t.enqueueTime;
      if (l > maxQueueTimeMillis) {
        // bif it
        log.warn("XXX task is too long in queue: " + l + "ms. " + t);
        log.warn("Queue Size: " + dispatchStage.queue.size());
        log.warn("listing contents of queue -");
        for (Task q : dispatchStage.queue) {
          log.warn(" - " + q.request.getTarget());
        }
        log.warn("---");
        this.dispatchStage.queue.remove(t);
        respondError(t);
      } else {
        if (t.startTime > 0) {
          // check process time
          l = System.currentTimeMillis() - t.startTime;
          if (l > maxProcessTimeMillis) {
            log.warn("**** task is too long being processed: " + l + "ms. " + t);
            t.thisThread.interrupt();
          }
        }
      }
    }
  }
}

代码示例来源:origin: io.restx/restx-server-simple

@Override
  public void handle(Request request, Response response) {
    try {
      if (request.getTarget().startsWith(routerPath)) {
        router.route(
            new SimpleRestxRequest(httpSettings, routerPath, request), new SimpleRestxResponse(response));
      } else {
        response.getPrintStream().print("Not found...");
        response.getPrintStream().close();
      }
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
};

代码示例来源:origin: miltonio/milton2

@Override
public void run() {
  thisThread = Thread.currentThread();
  startTime = System.currentTimeMillis();
  try {
    httpManager.process(getMiltonRequest(), getMiltonResponse());
    //response.commit();
    //response.getOutputStream().flush();
    miltonResponse.close();
  } catch (Exception e) {
    log.error("exception processing request: " + request.getTarget(), e);
    try {
      respondFinalError(this);
    } catch (Exception e2) {
      log.error("exception was thrown in processing, and again an exception was thrown generating error content", e2);
    }
  }
}

代码示例来源:origin: restx/restx

@Override
  public void handle(Request request, Response response) {
    try {
      if (request.getTarget().startsWith(routerPath)) {
        router.route(
            new SimpleRestxRequest(httpSettings, routerPath, request), new SimpleRestxResponse(response));
      } else {
        response.getPrintStream().print("Not found...");
        response.getPrintStream().close();
      }
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
};

代码示例来源:origin: org.glassfish.jersey.containers/jersey-container-simple-http

private URI getRequestUri(final Request request, final URI baseUri) {
  try {
    final String serverAddress = getServerAddress(baseUri);
    String uri = ContainerUtils.getHandlerPath(request.getTarget());
    final String queryString = request.getQuery().toString();
    if (queryString != null) {
      uri = uri + "?" + ContainerUtils.encodeUnsafeCharacters(queryString);
    }
    return new URI(serverAddress + uri);
  } catch (URISyntaxException ex) {
    throw new IllegalArgumentException(ex);
  }
}

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

SDFSLogger.getLog().debug("unable to process get request " + req.getTarget(), e);
result.setAttribute("status", "failed");
result.setAttribute("msg", e.toString());
SDFSLogger.getLog().debug("unable to process get request " + req.getTarget(), e);
rsp.setCode(500);
result.setAttribute("status", "failed");
  rsString = XMLUtils.toXMLString(doc);
} catch (TransformerException e) {
  SDFSLogger.getLog().debug("unable to process get request " + req.getTarget(), e);
  rsp.close();

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

SDFSLogger.getLog().debug("unable to process get request " + req.getTarget(), err);
result.setAttribute("status", "failed");
result.setAttribute("msg", err.toString());
  rsString = XMLUtils.toXMLString(doc);
} catch (TransformerException e2) {
  SDFSLogger.getLog().debug("unable to process get request " + req.getTarget(), e2);
  try {
    rsp.close();
  } catch (IOException e) {
    SDFSLogger.getLog().debug("unable to process get request " + req.getTarget(), e);
  rsp.close();
} catch (IOException e) {
  SDFSLogger.getLog().debug("unable to process get request " + req.getTarget(), e);

代码示例来源:origin: miltonio/milton2

@Override
public String getAbsoluteUrl() {
  String s = baseRequest.getTarget();
      s = s + ":" + a.getPort();
    s = s + baseRequest.getTarget();

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

SDFSLogger.getLog().debug("unable to process get request " + req.getTarget(), e);
result.setAttribute("status", "failed");
result.setAttribute("msg", e.toString());
SDFSLogger.getLog().debug("unable to process get request " + req.getTarget(), e);
rsp.setCode(500);
result.setAttribute("status", "failed");
    rsString = XMLUtils.toXMLString(doc);
  } catch (TransformerException e) {
    SDFSLogger.getLog().debug("unable to process get request " + req.getTarget(), e);
    rsp.close();

代码示例来源:origin: com.sun.jersey.contribs/jersey-simple-server

public void handle(Request request, Response response) {
  WebApplication target = application;
  final URI baseUri = getBaseUri(request);
  final URI requestUri = baseUri.resolve(request.getTarget());
  try {
    final ContainerRequest cRequest = new ContainerRequest(
        target,
        request.getMethod(),
        baseUri,
        requestUri,
        getHeaders(request),
        request.getInputStream());
    target.handleRequest(cRequest, new Writer(request, response));
  } catch (Exception ex) {
    throw new RuntimeException(ex);
  } finally {
    close(response);
  }
}

相关文章