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

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

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

Request.setURIPathQuery介绍

暂无

代码示例

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

  1. @Override
  2. public void applyURI(Request request, String oldURI, String newURI) throws IOException
  3. {
  4. String uri = request.getRequestURI();
  5. if (uri.startsWith("/"))
  6. uri = URIUtil.compactPath(uri);
  7. request.setURIPathQuery(uri);
  8. }

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

  1. /**
  2. * This method will add _query to the requests's queryString and also combine it with existing queryStrings in
  3. * the request. However it won't take care for duplicate. E.g. if request.getQueryString contains a parameter
  4. * <code>param1 = true</code> and _query will contain <code>param1=false</code> the result will be <code>param1=true&amp;param1=false</code>.
  5. * To cover this use case some more complex pattern matching is necessary. We can implement this if there's use
  6. * cases.
  7. *
  8. * @param request the request
  9. * @param oldURI the old URI
  10. * @param newURI the new URI
  11. * @throws IOException if unable to apply the URI
  12. */
  13. @Override
  14. public void applyURI(Request request, String oldURI, String newURI) throws IOException
  15. {
  16. if (_query == null)
  17. {
  18. request.setURIPathQuery(newURI);
  19. }
  20. else
  21. {
  22. String queryString = request.getQueryString();
  23. if (queryString != null)
  24. queryString = queryString + "&" + _query;
  25. else
  26. queryString = _query;
  27. request.setURIPathQuery(newURI);
  28. request.setQueryString(queryString);
  29. }
  30. }

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

  1. @Override
  2. public void applyURI(Request request, String oldURI, String newURI) throws IOException
  3. {
  4. if (_query==null)
  5. {
  6. request.setURIPathQuery(newURI);
  7. }
  8. else
  9. {
  10. String query=(String)request.getAttribute("org.eclipse.jetty.rewrite.handler.RewriteRegexRule.Q");
  11. if (!_queryGroup && request.getQueryString()!=null)
  12. query=request.getQueryString()+"&"+query;
  13. request.setURIPathQuery(newURI);
  14. request.setQueryString(query);
  15. }
  16. }

代码示例来源: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/jetty-rewrite

  1. ((Rule.ApplyURI)rule).applyURI(baseRequest, baseRequest.getRequestURI(), encoded);
  2. else
  3. baseRequest.setURIPathQuery(encoded);

代码示例来源: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: 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. }

相关文章

Request类方法