org.eclipse.jetty.server.Request.setPathInfo()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(17.1k)|赞(0)|评价(0)|浏览(190)

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

Request.setPathInfo介绍

暂无

代码示例

代码示例来源:origin: works.lmz.common/common-runnable-war

  1. @Override
  2. public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
  3. super.handle(target, baseRequest, request, response);
  4. if (isStarted() && url.equals(target)) {
  5. Handler nested = getHandler();
  6. if (nested instanceof ContextHandler){
  7. target = ((ContextHandler) nested).getContextPath() + url;
  8. baseRequest.setRequestURI(target);
  9. baseRequest.setPathInfo(target);
  10. }
  11. }
  12. }
  13. }

代码示例来源:origin: org.onebusaway/onebusaway-quickstart-mains

  1. @Override
  2. public void handle(String target, Request baseRequest,
  3. HttpServletRequest request, HttpServletResponse response)
  4. throws IOException, ServletException {
  5. String[] welcomeFiles = _context.getWelcomeFiles();
  6. if (welcomeFiles != null && target.endsWith("/")) {
  7. for (String welcomeFile : welcomeFiles) {
  8. String path = target;
  9. path += welcomeFile;
  10. Context context = _context.getServletContext();
  11. URL resource = context.getResource(path);
  12. if (resource != null) {
  13. target = path;
  14. baseRequest.setPathInfo(target);
  15. _context.handle(target, baseRequest, request, response);
  16. return;
  17. }
  18. }
  19. }
  20. }
  21. }

代码示例来源:origin: OneBusAway/onebusaway-application-modules

  1. @Override
  2. public void handle(String target, Request baseRequest,
  3. HttpServletRequest request, HttpServletResponse response)
  4. throws IOException, ServletException {
  5. String[] welcomeFiles = _context.getWelcomeFiles();
  6. if (welcomeFiles != null && target.endsWith("/")) {
  7. for (String welcomeFile : welcomeFiles) {
  8. String path = target;
  9. path += welcomeFile;
  10. Context context = _context.getServletContext();
  11. URL resource = context.getResource(path);
  12. if (resource != null) {
  13. target = path;
  14. baseRequest.setPathInfo(target);
  15. _context.handle(target, baseRequest, request, response);
  16. return;
  17. }
  18. }
  19. }
  20. }
  21. }

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server

  1. String uri=outerRequest.getQueryString()==null?outerRequest.getRequestURI():(outerRequest.getRequestURI()+"?"+outerRequest.getQueryString());
  2. _request.setUri(new HttpURI(uri));
  3. _request.setPathInfo(outerRequest.getRequestURI());
  4. _request.setQueryString(outerRequest.getQueryString());
  5. _request.setProtocol(outerRequest.getProtocol());

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

  1. _request.setRequestURI("");
  2. _request.setPathInfo(info);
  3. _version = version == null ? HttpVersion.HTTP_0_9 : version;
  4. _request.setHttpVersion(_version);

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

  1. _request.setRequestURI("");
  2. _request.setPathInfo(info);
  3. _version = version == null ? HttpVersion.HTTP_0_9 : version;
  4. _request.setHttpVersion(_version);

代码示例来源:origin: jenkinsci/winstone

  1. setPathInfo(encoded==null?"":encoded);
  2. throw new BadMessageException(400,"Bad URI");
  3. setPathInfo(path);

代码示例来源:origin: org.apache.knox/gateway-server

  1. @Override
  2. public void doHandle(final String target, final Request baseRequest,
  3. final HttpServletRequest request, final HttpServletResponse response)
  4. throws IOException, ServletException {
  5. final String newTarget = redirectContext + target;
  6. RequestUpdateHandler.ForwardedRequest newRequest = new RequestUpdateHandler.ForwardedRequest(
  7. request, redirectContext, newTarget);
  8. // if the request already has the /{gatewaypath}/{topology} part then skip
  9. if (!StringUtils.startsWithIgnoreCase(target, redirectContext)) {
  10. baseRequest.setPathInfo(redirectContext + baseRequest.getPathInfo());
  11. baseRequest.setURIPathQuery(redirectContext + baseRequest.getRequestURI());
  12. LOG.topologyPortMappingUpdateRequest(target, newTarget);
  13. nextHandle(newTarget, baseRequest, newRequest, response);
  14. } else {
  15. nextHandle(target, baseRequest, newRequest, response);
  16. }
  17. }

代码示例来源:origin: apache/knox

  1. @Override
  2. public void doHandle(final String target, final Request baseRequest,
  3. final HttpServletRequest request, final HttpServletResponse response)
  4. throws IOException, ServletException {
  5. final String newTarget = redirectContext + target;
  6. RequestUpdateHandler.ForwardedRequest newRequest = new RequestUpdateHandler.ForwardedRequest(
  7. request, redirectContext, newTarget);
  8. // if the request already has the /{gatewaypath}/{topology} part then skip
  9. if (!StringUtils.startsWithIgnoreCase(target, redirectContext)) {
  10. baseRequest.setPathInfo(redirectContext + baseRequest.getPathInfo());
  11. baseRequest.setURIPathQuery(redirectContext + baseRequest.getRequestURI());
  12. LOG.topologyPortMappingUpdateRequest(target, newTarget);
  13. nextHandle(newTarget, baseRequest, newRequest, response);
  14. } else {
  15. nextHandle(target, baseRequest, newRequest, response);
  16. }
  17. }

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server

  1. ((Request)request).setPathInfo(applied);

代码示例来源:origin: jenkinsci/winstone

  1. public void handleAsync(HttpChannel channel) throws IOException, ServletException
  2. {
  3. final HttpChannelState state = channel.getRequest().getHttpChannelState();
  4. final AsyncContextEvent event = state.getAsyncContextEvent();
  5. final Request baseRequest=channel.getRequest();
  6. final String path=event.getPath();
  7. if (path!=null)
  8. {
  9. // this is a dispatch with a path
  10. ServletContext context=event.getServletContext();
  11. String query=baseRequest.getQueryString();
  12. baseRequest.setURIPathQuery(URIUtil.addEncodedPaths(context==null?null:URIUtil.encodePath(context.getContextPath()), path));
  13. HttpURI uri = baseRequest.getHttpURI();
  14. baseRequest.setPathInfo(uri.getDecodedPath());
  15. if (uri.getQuery()!=null)
  16. baseRequest.mergeQueryParameters(query,uri.getQuery(), true); //we have to assume dispatch path and query are UTF8
  17. }
  18. final String target=baseRequest.getPathInfo();
  19. final HttpServletRequest request=(HttpServletRequest)event.getSuppliedRequest();
  20. final HttpServletResponse response=(HttpServletResponse)event.getSuppliedResponse();
  21. if (LOG.isDebugEnabled())
  22. LOG.debug("{} {} {} on {}", request.getDispatcherType(), request.getMethod(), target, channel);
  23. handle(target, baseRequest, request, response);
  24. if (LOG.isDebugEnabled())
  25. LOG.debug("handledAsync={} async={} committed={} on {}", channel.getRequest().isHandled(),request.isAsyncStarted(),response.isCommitted(),channel);
  26. }

代码示例来源:origin: Nextdoor/bender

  1. public void handleAsync(HttpChannel<?> connection) throws IOException, ServletException
  2. {
  3. final HttpChannelState state = connection.getRequest().getHttpChannelState();
  4. final AsyncContextEvent event = state.getAsyncContextEvent();
  5. final Request baseRequest=connection.getRequest();
  6. final String path=event.getPath();
  7. if (path!=null)
  8. {
  9. // this is a dispatch with a path
  10. ServletContext context=event.getServletContext();
  11. HttpURI uri = new HttpURI(URIUtil.addPaths(context==null?null:context.getContextPath(), path));
  12. baseRequest.setUri(uri);
  13. baseRequest.setRequestURI(null);
  14. baseRequest.setPathInfo(uri.getDecodedPath());
  15. if (uri.getQuery()!=null)
  16. baseRequest.mergeQueryParameters(uri.getQuery(), true); //we have to assume dispatch path and query are UTF8
  17. }
  18. final String target=baseRequest.getPathInfo();
  19. final HttpServletRequest request=(HttpServletRequest)event.getSuppliedRequest();
  20. final HttpServletResponse response=(HttpServletResponse)event.getSuppliedResponse();
  21. if (LOG.isDebugEnabled())
  22. {
  23. LOG.debug(request.getDispatcherType()+" "+request.getMethod()+" "+target+" on "+connection);
  24. handle(target, baseRequest, request, response);
  25. LOG.debug("RESPONSE "+target+" "+connection.getResponse().getStatus());
  26. }
  27. else
  28. handle(target, baseRequest, request, response);
  29. }

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.jetty.server

  1. public void handleAsync(HttpChannel connection) throws IOException, ServletException
  2. {
  3. final HttpChannelState state = connection.getRequest().getHttpChannelState();
  4. final AsyncContextEvent event = state.getAsyncContextEvent();
  5. final Request baseRequest=connection.getRequest();
  6. final String path=event.getPath();
  7. if (path!=null)
  8. {
  9. // this is a dispatch with a path
  10. ServletContext context=event.getServletContext();
  11. String query=baseRequest.getQueryString();
  12. baseRequest.setURIPathQuery(URIUtil.addPaths(context==null?null:context.getContextPath(), path));
  13. HttpURI uri = baseRequest.getHttpURI();
  14. baseRequest.setPathInfo(uri.getDecodedPath());
  15. if (uri.getQuery()!=null)
  16. baseRequest.mergeQueryParameters(query,uri.getQuery(), true); //we have to assume dispatch path and query are UTF8
  17. }
  18. final String target=baseRequest.getPathInfo();
  19. final HttpServletRequest request=(HttpServletRequest)event.getSuppliedRequest();
  20. final HttpServletResponse response=(HttpServletResponse)event.getSuppliedResponse();
  21. if (LOG.isDebugEnabled())
  22. {
  23. LOG.debug(request.getDispatcherType()+" "+request.getMethod()+" "+target+" on "+connection);
  24. handle(target, baseRequest, request, response);
  25. LOG.debug("RESPONSE "+target+" "+connection.getResponse().getStatus());
  26. }
  27. else
  28. handle(target, baseRequest, request, response);
  29. }

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-server

  1. public void handleAsync(AbstractHttpConnection connection) throws IOException, ServletException
  2. {
  3. final AsyncContinuation async = connection.getRequest().getAsyncContinuation();
  4. final AsyncContinuation.AsyncEventState state = async.getAsyncEventState();
  5. final Request baseRequest=connection.getRequest();
  6. final String path=state.getPath();
  7. if (path!=null)
  8. {
  9. // this is a dispatch with a path
  10. final String contextPath=state.getServletContext().getContextPath();
  11. HttpURI uri = new HttpURI(URIUtil.addPaths(contextPath,path));
  12. baseRequest.setUri(uri);
  13. baseRequest.setRequestURI(null);
  14. baseRequest.setPathInfo(baseRequest.getRequestURI());
  15. if (uri.getQuery()!=null)
  16. baseRequest.mergeQueryString(uri.getQuery()); //we have to assume dispatch path and query are UTF8
  17. }
  18. final String target=baseRequest.getPathInfo();
  19. final HttpServletRequest request=(HttpServletRequest)async.getRequest();
  20. final HttpServletResponse response=(HttpServletResponse)async.getResponse();
  21. if (LOG.isDebugEnabled())
  22. {
  23. LOG.debug("REQUEST "+target+" on "+connection);
  24. handle(target, baseRequest, request, response);
  25. LOG.debug("RESPONSE "+target+" "+connection.getResponse().getStatus());
  26. }
  27. else
  28. handle(target, baseRequest, request, response);
  29. }

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

  1. public void handleAsync(HttpChannel<?> connection) throws IOException, ServletException
  2. {
  3. final HttpChannelState async = connection.getRequest().getHttpChannelState();
  4. final HttpChannelState.AsyncEventState state = async.getAsyncEventState();
  5. final Request baseRequest=connection.getRequest();
  6. final String path=state.getPath();
  7. if (path!=null)
  8. {
  9. // this is a dispatch with a path
  10. ServletContext context=state.getServletContext();
  11. HttpURI uri = new HttpURI(context==null?path:URIUtil.addPaths(context.getContextPath(),path));
  12. baseRequest.setUri(uri);
  13. baseRequest.setRequestURI(null);
  14. baseRequest.setPathInfo(baseRequest.getRequestURI());
  15. if (uri.getQuery()!=null)
  16. baseRequest.mergeQueryString(uri.getQuery()); //we have to assume dispatch path and query are UTF8
  17. }
  18. final String target=baseRequest.getPathInfo();
  19. final HttpServletRequest request=(HttpServletRequest)async.getRequest();
  20. final HttpServletResponse response=(HttpServletResponse)async.getResponse();
  21. if (LOG.isDebugEnabled())
  22. {
  23. LOG.debug("REQUEST "+target+" on "+connection);
  24. handle(target, baseRequest, request, response);
  25. LOG.debug("RESPONSE "+target+" "+connection.getResponse().getStatus());
  26. }
  27. else
  28. handle(target, baseRequest, request, response);
  29. }

代码示例来源:origin: org.eclipse.jetty/server

  1. public void handleAsync(AbstractHttpConnection connection) throws IOException, ServletException
  2. {
  3. final AsyncContinuation async = connection.getRequest().getAsyncContinuation();
  4. final AsyncContinuation.AsyncEventState state = async.getAsyncEventState();
  5. final Request baseRequest=connection.getRequest();
  6. final String path=state.getPath();
  7. if (path!=null)
  8. {
  9. // this is a dispatch with a path
  10. final String contextPath=state.getServletContext().getContextPath();
  11. HttpURI uri = new HttpURI(URIUtil.addPaths(contextPath,path));
  12. baseRequest.setUri(uri);
  13. baseRequest.setRequestURI(null);
  14. baseRequest.setPathInfo(baseRequest.getRequestURI());
  15. if (uri.getQuery()!=null)
  16. baseRequest.mergeQueryString(uri.getQuery()); //we have to assume dispatch path and query are UTF8
  17. }
  18. final String target=baseRequest.getPathInfo();
  19. final HttpServletRequest request=(HttpServletRequest)async.getRequest();
  20. final HttpServletResponse response=(HttpServletResponse)async.getResponse();
  21. if (LOG.isDebugEnabled())
  22. {
  23. LOG.debug("REQUEST "+target+" on "+connection);
  24. handle(target, baseRequest, request, response);
  25. LOG.debug("RESPONSE "+target+" "+connection.getResponse().getStatus());
  26. }
  27. else
  28. handle(target, baseRequest, request, response);
  29. }

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server

  1. public void handleAsync(AbstractHttpConnection connection) throws IOException, ServletException
  2. {
  3. final AsyncContinuation async = connection.getRequest().getAsyncContinuation();
  4. final AsyncContinuation.AsyncEventState state = async.getAsyncEventState();
  5. final Request baseRequest=connection.getRequest();
  6. final String path=state.getPath();
  7. if (path!=null)
  8. {
  9. // this is a dispatch with a path
  10. final String contextPath=state.getServletContext().getContextPath();
  11. HttpURI uri = new HttpURI(URIUtil.addPaths(contextPath,path));
  12. baseRequest.setUri(uri);
  13. baseRequest.setRequestURI(null);
  14. baseRequest.setPathInfo(baseRequest.getRequestURI());
  15. if (uri.getQuery()!=null)
  16. baseRequest.mergeQueryString(uri.getQuery()); //we have to assume dispatch path and query are UTF8
  17. }
  18. final String target=baseRequest.getPathInfo();
  19. final HttpServletRequest request=(HttpServletRequest)async.getRequest();
  20. final HttpServletResponse response=(HttpServletResponse)async.getResponse();
  21. if (LOG.isDebugEnabled())
  22. {
  23. LOG.debug("REQUEST "+target+" on "+connection);
  24. handle(target, baseRequest, request, response);
  25. LOG.debug("RESPONSE "+target+" "+connection.getResponse().getStatus());
  26. }
  27. else
  28. handle(target, baseRequest, request, response);
  29. }

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-plus

  1. public void handleAsync(AbstractHttpConnection connection) throws IOException, ServletException
  2. {
  3. final AsyncContinuation async = connection.getRequest().getAsyncContinuation();
  4. final AsyncContinuation.AsyncEventState state = async.getAsyncEventState();
  5. final Request baseRequest=connection.getRequest();
  6. final String path=state.getPath();
  7. if (path!=null)
  8. {
  9. // this is a dispatch with a path
  10. final String contextPath=state.getServletContext().getContextPath();
  11. HttpURI uri = new HttpURI(URIUtil.addPaths(contextPath,path));
  12. baseRequest.setUri(uri);
  13. baseRequest.setRequestURI(null);
  14. baseRequest.setPathInfo(baseRequest.getRequestURI());
  15. if (uri.getQuery()!=null)
  16. baseRequest.mergeQueryString(uri.getQuery()); //we have to assume dispatch path and query are UTF8
  17. }
  18. final String target=baseRequest.getPathInfo();
  19. final HttpServletRequest request=(HttpServletRequest)async.getRequest();
  20. final HttpServletResponse response=(HttpServletResponse)async.getResponse();
  21. if (LOG.isDebugEnabled())
  22. {
  23. LOG.debug("REQUEST "+target+" on "+connection);
  24. handle(target, baseRequest, request, response);
  25. LOG.debug("RESPONSE "+target+" "+connection.getResponse().getStatus());
  26. }
  27. else
  28. handle(target, baseRequest, request, response);
  29. }

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-webapp

  1. public void handleAsync(AbstractHttpConnection connection) throws IOException, ServletException
  2. {
  3. final AsyncContinuation async = connection.getRequest().getAsyncContinuation();
  4. final AsyncContinuation.AsyncEventState state = async.getAsyncEventState();
  5. final Request baseRequest=connection.getRequest();
  6. final String path=state.getPath();
  7. if (path!=null)
  8. {
  9. // this is a dispatch with a path
  10. final String contextPath=state.getServletContext().getContextPath();
  11. HttpURI uri = new HttpURI(URIUtil.addPaths(contextPath,path));
  12. baseRequest.setUri(uri);
  13. baseRequest.setRequestURI(null);
  14. baseRequest.setPathInfo(baseRequest.getRequestURI());
  15. if (uri.getQuery()!=null)
  16. baseRequest.mergeQueryString(uri.getQuery()); //we have to assume dispatch path and query are UTF8
  17. }
  18. final String target=baseRequest.getPathInfo();
  19. final HttpServletRequest request=(HttpServletRequest)async.getRequest();
  20. final HttpServletResponse response=(HttpServletResponse)async.getResponse();
  21. if (LOG.isDebugEnabled())
  22. {
  23. LOG.debug("REQUEST "+target+" on "+connection);
  24. handle(target, baseRequest, request, response);
  25. LOG.debug("RESPONSE "+target+" "+connection.getResponse().getStatus());
  26. }
  27. else
  28. handle(target, baseRequest, request, response);
  29. }

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

  1. public void handleAsync(HttpChannel<?> connection) throws IOException, ServletException
  2. {
  3. final HttpChannelState async = connection.getRequest().getHttpChannelState();
  4. final HttpChannelState.AsyncEventState state = async.getAsyncEventState();
  5. final Request baseRequest=connection.getRequest();
  6. final String path=state.getPath();
  7. if (path!=null)
  8. {
  9. // this is a dispatch with a path
  10. ServletContext context=state.getServletContext();
  11. HttpURI uri = new HttpURI(context==null?path:URIUtil.addPaths(context.getContextPath(),path));
  12. baseRequest.setUri(uri);
  13. baseRequest.setRequestURI(null);
  14. baseRequest.setPathInfo(baseRequest.getRequestURI());
  15. if (uri.getQuery()!=null)
  16. baseRequest.mergeQueryString(uri.getQuery()); //we have to assume dispatch path and query are UTF8
  17. }
  18. final String target=baseRequest.getPathInfo();
  19. final HttpServletRequest request=(HttpServletRequest)async.getRequest();
  20. final HttpServletResponse response=(HttpServletResponse)async.getResponse();
  21. if (LOG.isDebugEnabled())
  22. {
  23. LOG.debug("REQUEST "+target+" on "+connection);
  24. handle(target, baseRequest, request, response);
  25. LOG.debug("RESPONSE "+target+" "+connection.getResponse().getStatus());
  26. }
  27. else
  28. handle(target, baseRequest, request, response);
  29. }

相关文章

Request类方法