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

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

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

Request.getTarget介绍

暂无

代码示例

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

  1. private URI getRequestUri(final Request request, final URI baseUri) {
  2. try {
  3. final String serverAddress = getServerAddress(baseUri);
  4. String uri = ContainerUtils.getHandlerPath(request.getTarget());
  5. final String queryString = request.getQuery().toString();
  6. if (queryString != null) {
  7. uri = uri + "?" + ContainerUtils.encodeUnsafeCharacters(queryString);
  8. }
  9. return new URI(serverAddress + uri);
  10. } catch (URISyntaxException ex) {
  11. throw new IllegalArgumentException(ex);
  12. }
  13. }

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

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

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

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

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

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

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

  1. /**
  2. * Returns the full request URI.
  3. *
  4. * @return The full request URI.
  5. */
  6. @Override
  7. public String getRequestUri() {
  8. return this.request.getTarget();
  9. }

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

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

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

  1. public static String getUndecodedPath(Request request) {
  2. String path = request.getTarget();
  3. int queryIndex = path.indexOf('?');
  4. if (queryIndex != -1) {
  5. path = path.substring(0, queryIndex);
  6. }
  7. return path;
  8. }
  9. }

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

  1. public SimpleRestxRequest(HttpSettings httpSettings, String apiPath, Request request) {
  2. super(httpSettings);
  3. this.apiPath = apiPath;
  4. this.request = request;
  5. String path = request.getTarget().substring(apiPath.length());
  6. if (path.indexOf("?") != -1) {
  7. path = path.substring(0, path.indexOf("?"));
  8. }
  9. this.restxPath = path;
  10. }

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

  1. public SimpleRestxRequest(HttpSettings httpSettings, String apiPath, Request request) {
  2. super(httpSettings);
  3. this.apiPath = apiPath;
  4. this.request = request;
  5. String path = request.getTarget().substring(apiPath.length());
  6. if (path.indexOf("?") != -1) {
  7. path = path.substring(0, path.indexOf("?"));
  8. }
  9. this.restxPath = path;
  10. }

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

  1. private void checkTasks() {
  2. long l;
  3. for( Task t : this.dispatchStage.queue ) {
  4. // check enqueue time
  5. l = System.currentTimeMillis() - t.enqueueTime;
  6. if( l > maxQueueTimeMillis ) {
  7. // bif it
  8. log.warn( "XXX task is too long in queue: " + l + "ms. " + t );
  9. log.warn( "Queue Size: " + dispatchStage.queue.size() );
  10. log.warn( "listing contents of queue -" );
  11. for( Task q : dispatchStage.queue ) {
  12. log.warn( " - " + q.request.getTarget() );
  13. }
  14. log.warn( "---" );
  15. this.dispatchStage.queue.remove( t );
  16. respondError( t );
  17. } else {
  18. if( t.startTime > 0 ) {
  19. // check process time
  20. l = System.currentTimeMillis() - t.startTime;
  21. if( l > maxProcessTimeMillis ) {
  22. log.warn( "**** task is too long being processed: " + l + "ms. " + t );
  23. t.thisThread.interrupt();
  24. }
  25. }
  26. }
  27. }
  28. }

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

  1. private void checkTasks() {
  2. long l;
  3. for (Task t : this.dispatchStage.queue) {
  4. // check enqueue time
  5. l = System.currentTimeMillis() - t.enqueueTime;
  6. if (l > maxQueueTimeMillis) {
  7. // bif it
  8. log.warn("XXX task is too long in queue: " + l + "ms. " + t);
  9. log.warn("Queue Size: " + dispatchStage.queue.size());
  10. log.warn("listing contents of queue -");
  11. for (Task q : dispatchStage.queue) {
  12. log.warn(" - " + q.request.getTarget());
  13. }
  14. log.warn("---");
  15. this.dispatchStage.queue.remove(t);
  16. respondError(t);
  17. } else {
  18. if (t.startTime > 0) {
  19. // check process time
  20. l = System.currentTimeMillis() - t.startTime;
  21. if (l > maxProcessTimeMillis) {
  22. log.warn("**** task is too long being processed: " + l + "ms. " + t);
  23. t.thisThread.interrupt();
  24. }
  25. }
  26. }
  27. }
  28. }
  29. }

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

  1. @Override
  2. public void handle(Request request, Response response) {
  3. try {
  4. if (request.getTarget().startsWith(routerPath)) {
  5. router.route(
  6. new SimpleRestxRequest(httpSettings, routerPath, request), new SimpleRestxResponse(response));
  7. } else {
  8. response.getPrintStream().print("Not found...");
  9. response.getPrintStream().close();
  10. }
  11. } catch (IOException e) {
  12. throw new RuntimeException(e);
  13. }
  14. }
  15. };

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

  1. @Override
  2. public void run() {
  3. thisThread = Thread.currentThread();
  4. startTime = System.currentTimeMillis();
  5. try {
  6. httpManager.process(getMiltonRequest(), getMiltonResponse());
  7. //response.commit();
  8. //response.getOutputStream().flush();
  9. miltonResponse.close();
  10. } catch (Exception e) {
  11. log.error("exception processing request: " + request.getTarget(), e);
  12. try {
  13. respondFinalError(this);
  14. } catch (Exception e2) {
  15. log.error("exception was thrown in processing, and again an exception was thrown generating error content", e2);
  16. }
  17. }
  18. }

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

  1. @Override
  2. public void handle(Request request, Response response) {
  3. try {
  4. if (request.getTarget().startsWith(routerPath)) {
  5. router.route(
  6. new SimpleRestxRequest(httpSettings, routerPath, request), new SimpleRestxResponse(response));
  7. } else {
  8. response.getPrintStream().print("Not found...");
  9. response.getPrintStream().close();
  10. }
  11. } catch (IOException e) {
  12. throw new RuntimeException(e);
  13. }
  14. }
  15. };

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

  1. private URI getRequestUri(final Request request, final URI baseUri) {
  2. try {
  3. final String serverAddress = getServerAddress(baseUri);
  4. String uri = ContainerUtils.getHandlerPath(request.getTarget());
  5. final String queryString = request.getQuery().toString();
  6. if (queryString != null) {
  7. uri = uri + "?" + ContainerUtils.encodeUnsafeCharacters(queryString);
  8. }
  9. return new URI(serverAddress + uri);
  10. } catch (URISyntaxException ex) {
  11. throw new IllegalArgumentException(ex);
  12. }
  13. }

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

  1. SDFSLogger.getLog().debug("unable to process get request " + req.getTarget(), e);
  2. result.setAttribute("status", "failed");
  3. result.setAttribute("msg", e.toString());
  4. SDFSLogger.getLog().debug("unable to process get request " + req.getTarget(), e);
  5. rsp.setCode(500);
  6. result.setAttribute("status", "failed");
  7. rsString = XMLUtils.toXMLString(doc);
  8. } catch (TransformerException e) {
  9. SDFSLogger.getLog().debug("unable to process get request " + req.getTarget(), e);
  10. rsp.close();

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

  1. SDFSLogger.getLog().debug("unable to process get request " + req.getTarget(), err);
  2. result.setAttribute("status", "failed");
  3. result.setAttribute("msg", err.toString());
  4. rsString = XMLUtils.toXMLString(doc);
  5. } catch (TransformerException e2) {
  6. SDFSLogger.getLog().debug("unable to process get request " + req.getTarget(), e2);
  7. try {
  8. rsp.close();
  9. } catch (IOException e) {
  10. SDFSLogger.getLog().debug("unable to process get request " + req.getTarget(), e);
  11. rsp.close();
  12. } catch (IOException e) {
  13. SDFSLogger.getLog().debug("unable to process get request " + req.getTarget(), e);

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

  1. @Override
  2. public String getAbsoluteUrl() {
  3. String s = baseRequest.getTarget();
  4. s = s + ":" + a.getPort();
  5. s = s + baseRequest.getTarget();

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

  1. SDFSLogger.getLog().debug("unable to process get request " + req.getTarget(), e);
  2. result.setAttribute("status", "failed");
  3. result.setAttribute("msg", e.toString());
  4. SDFSLogger.getLog().debug("unable to process get request " + req.getTarget(), e);
  5. rsp.setCode(500);
  6. result.setAttribute("status", "failed");
  7. rsString = XMLUtils.toXMLString(doc);
  8. } catch (TransformerException e) {
  9. SDFSLogger.getLog().debug("unable to process get request " + req.getTarget(), e);
  10. rsp.close();

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

  1. public void handle(Request request, Response response) {
  2. WebApplication target = application;
  3. final URI baseUri = getBaseUri(request);
  4. final URI requestUri = baseUri.resolve(request.getTarget());
  5. try {
  6. final ContainerRequest cRequest = new ContainerRequest(
  7. target,
  8. request.getMethod(),
  9. baseUri,
  10. requestUri,
  11. getHeaders(request),
  12. request.getInputStream());
  13. target.handleRequest(cRequest, new Writer(request, response));
  14. } catch (Exception ex) {
  15. throw new RuntimeException(ex);
  16. } finally {
  17. close(response);
  18. }
  19. }

相关文章