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

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

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

Request.setRequestURI介绍

暂无

代码示例

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

public void applyURI(Request request, String oldTarget, String newTarget) throws IOException 
{
  String uri = URIUtil.addPaths(_replacement, PathMap.pathInfo(_pattern,request.getRequestURI()));
  request.setRequestURI(uri);
}

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

@Override
public void applyURI(Request request, String oldTarget, String newTarget) throws IOException 
{
  String uri = URIUtil.addPaths(_replacement, PathMap.pathInfo(_pattern,request.getRequestURI()));
  request.setRequestURI(uri);
}

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

@Override
public void applyURI(Request request, String oldTarget, String newTarget) throws IOException 
{
  String uri = URIUtil.addPaths(_replacement, PathMap.pathInfo(_pattern,request.getRequestURI()));
  request.setRequestURI(uri);
}

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

public void applyURI(Request request, String oldTarget, String newTarget) throws IOException
{
  if (_query==null)
  {
    request.setRequestURI(newTarget);
  }
  else
  {
    String query=(String)request.getAttribute("org.eclipse.jetty.rewrite.handler.RewriteRegexRule.Q");
    
    if (!_queryGroup && request.getQueryString()!=null)
      query=request.getQueryString()+"&"+query;
    HttpURI uri=new HttpURI(newTarget+"?"+query);
    request.setUri(uri);
    request.setRequestURI(newTarget);
    request.setQueryString(query);
  }
}

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

@Override
public void applyURI(Request request, String oldTarget, String newTarget) throws IOException
{
  if (_query==null)
  {
    request.setRequestURI(newTarget);
  }
  else
  {
    String query=(String)request.getAttribute("org.eclipse.jetty.rewrite.handler.RewriteRegexRule.Q");
    
    if (!_queryGroup && request.getQueryString()!=null)
      query=request.getQueryString()+"&"+query;
    HttpURI uri=new HttpURI(newTarget+"?"+query);
    request.setUri(uri);
    request.setRequestURI(newTarget);
    request.setQueryString(query);
  }
}

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

@Override
public void applyURI(Request request, String oldTarget, String newTarget) throws IOException
{
  if (_query==null)
  {
    request.setRequestURI(newTarget);
  }
  else
  {
    String query=(String)request.getAttribute("org.eclipse.jetty.rewrite.handler.RewriteRegexRule.Q");
    
    if (!_queryGroup && request.getQueryString()!=null)
      query=request.getQueryString()+"&"+query;
    HttpURI uri=new HttpURI(newTarget+"?"+query);
    request.setUri(uri);
    request.setRequestURI(newTarget);
    request.setQueryString(query);
  }
}

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

@Override
 public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
  super.handle(target, baseRequest, request, response);
  if (isStarted() && url.equals(target)) {
   Handler nested = getHandler();

   if (nested instanceof ContextHandler){
    target = ((ContextHandler) nested).getContextPath() + url;
    baseRequest.setRequestURI(target);
    baseRequest.setPathInfo(target);
   }
  }
 }
}

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

_request.setRequestURI("");

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

_request.setRequestURI("");

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

_request.setRequestURI("");

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

((Rule.ApplyURI)rule).applyURI((Request)request, target, applied);
else
  ((Request)request).setRequestURI(applied);

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

((Rule.ApplyURI)rule).applyURI((Request)request, target, applied);
else
  ((Request)request).setRequestURI(applied);

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

public void handleAsync(HttpChannel<?> connection) throws IOException, ServletException
{
  final HttpChannelState state = connection.getRequest().getHttpChannelState();
  final AsyncContextEvent event = state.getAsyncContextEvent();
  final Request baseRequest=connection.getRequest();
  final String path=event.getPath();
  
  if (path!=null)
  {
    // this is a dispatch with a path
    ServletContext context=event.getServletContext();
    HttpURI uri = new HttpURI(URIUtil.addPaths(context==null?null:context.getContextPath(), path));            
    baseRequest.setUri(uri);
    baseRequest.setRequestURI(null);
    baseRequest.setPathInfo(uri.getDecodedPath());
    if (uri.getQuery()!=null)
      baseRequest.mergeQueryParameters(uri.getQuery(), true); //we have to assume dispatch path and query are UTF8
  }
  final String target=baseRequest.getPathInfo();
  final HttpServletRequest request=(HttpServletRequest)event.getSuppliedRequest();
  final HttpServletResponse response=(HttpServletResponse)event.getSuppliedResponse();
  if (LOG.isDebugEnabled())
  {
    LOG.debug(request.getDispatcherType()+" "+request.getMethod()+" "+target+" on "+connection);
    handle(target, baseRequest, request, response);
    LOG.debug("RESPONSE "+target+"  "+connection.getResponse().getStatus());
  }
  else
    handle(target, baseRequest, request, response);
}

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

public void handleAsync(AbstractHttpConnection connection) throws IOException, ServletException
{
  final AsyncContinuation async = connection.getRequest().getAsyncContinuation();
  final AsyncContinuation.AsyncEventState state = async.getAsyncEventState();
  final Request baseRequest=connection.getRequest();
  final String path=state.getPath();
  if (path!=null)
  {
    // this is a dispatch with a path
    final String contextPath=state.getServletContext().getContextPath();
    HttpURI uri = new HttpURI(URIUtil.addPaths(contextPath,path));
    baseRequest.setUri(uri);
    baseRequest.setRequestURI(null);
    baseRequest.setPathInfo(baseRequest.getRequestURI());
    if (uri.getQuery()!=null)
      baseRequest.mergeQueryString(uri.getQuery()); //we have to assume dispatch path and query are UTF8
  }
  final String target=baseRequest.getPathInfo();
  final HttpServletRequest request=(HttpServletRequest)async.getRequest();
  final HttpServletResponse response=(HttpServletResponse)async.getResponse();
  if (LOG.isDebugEnabled())
  {
    LOG.debug("REQUEST "+target+" on "+connection);
    handle(target, baseRequest, request, response);
    LOG.debug("RESPONSE "+target+"  "+connection.getResponse().getStatus());
  }
  else
    handle(target, baseRequest, request, response);
}

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

public void handleAsync(AbstractHttpConnection connection) throws IOException, ServletException
{
  final AsyncContinuation async = connection.getRequest().getAsyncContinuation();
  final AsyncContinuation.AsyncEventState state = async.getAsyncEventState();
  final Request baseRequest=connection.getRequest();
  final String path=state.getPath();
  if (path!=null)
  {
    // this is a dispatch with a path
    final String contextPath=state.getServletContext().getContextPath();
    HttpURI uri = new HttpURI(URIUtil.addPaths(contextPath,path));
    baseRequest.setUri(uri);
    baseRequest.setRequestURI(null);
    baseRequest.setPathInfo(baseRequest.getRequestURI());
    if (uri.getQuery()!=null)
      baseRequest.mergeQueryString(uri.getQuery()); //we have to assume dispatch path and query are UTF8
  }
  final String target=baseRequest.getPathInfo();
  final HttpServletRequest request=(HttpServletRequest)async.getRequest();
  final HttpServletResponse response=(HttpServletResponse)async.getResponse();
  if (LOG.isDebugEnabled())
  {
    LOG.debug("REQUEST "+target+" on "+connection);
    handle(target, baseRequest, request, response);
    LOG.debug("RESPONSE "+target+"  "+connection.getResponse().getStatus());
  }
  else
    handle(target, baseRequest, request, response);
}

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

public void handleAsync(AbstractHttpConnection connection) throws IOException, ServletException
{
  final AsyncContinuation async = connection.getRequest().getAsyncContinuation();
  final AsyncContinuation.AsyncEventState state = async.getAsyncEventState();
  final Request baseRequest=connection.getRequest();
  final String path=state.getPath();
  if (path!=null)
  {
    // this is a dispatch with a path
    final String contextPath=state.getServletContext().getContextPath();
    HttpURI uri = new HttpURI(URIUtil.addPaths(contextPath,path));
    baseRequest.setUri(uri);
    baseRequest.setRequestURI(null);
    baseRequest.setPathInfo(baseRequest.getRequestURI());
    if (uri.getQuery()!=null)
      baseRequest.mergeQueryString(uri.getQuery()); //we have to assume dispatch path and query are UTF8
  }
  final String target=baseRequest.getPathInfo();
  final HttpServletRequest request=(HttpServletRequest)async.getRequest();
  final HttpServletResponse response=(HttpServletResponse)async.getResponse();
  if (LOG.isDebugEnabled())
  {
    LOG.debug("REQUEST "+target+" on "+connection);
    handle(target, baseRequest, request, response);
    LOG.debug("RESPONSE "+target+"  "+connection.getResponse().getStatus());
  }
  else
    handle(target, baseRequest, request, response);
}

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

public void handleAsync(AbstractHttpConnection connection) throws IOException, ServletException
{
  final AsyncContinuation async = connection.getRequest().getAsyncContinuation();
  final AsyncContinuation.AsyncEventState state = async.getAsyncEventState();
  final Request baseRequest=connection.getRequest();
  final String path=state.getPath();
  if (path!=null)
  {
    // this is a dispatch with a path
    final String contextPath=state.getServletContext().getContextPath();
    HttpURI uri = new HttpURI(URIUtil.addPaths(contextPath,path));
    baseRequest.setUri(uri);
    baseRequest.setRequestURI(null);
    baseRequest.setPathInfo(baseRequest.getRequestURI());
    if (uri.getQuery()!=null)
      baseRequest.mergeQueryString(uri.getQuery()); //we have to assume dispatch path and query are UTF8
  }
  final String target=baseRequest.getPathInfo();
  final HttpServletRequest request=(HttpServletRequest)async.getRequest();
  final HttpServletResponse response=(HttpServletResponse)async.getResponse();
  if (LOG.isDebugEnabled())
  {
    LOG.debug("REQUEST "+target+" on "+connection);
    handle(target, baseRequest, request, response);
    LOG.debug("RESPONSE "+target+"  "+connection.getResponse().getStatus());
  }
  else
    handle(target, baseRequest, request, response);
}

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

public void handleAsync(HttpChannel<?> connection) throws IOException, ServletException
{
  final HttpChannelState async = connection.getRequest().getHttpChannelState();
  final HttpChannelState.AsyncEventState state = async.getAsyncEventState();
  final Request baseRequest=connection.getRequest();
  final String path=state.getPath();
  if (path!=null)
  {
    // this is a dispatch with a path
    ServletContext context=state.getServletContext();
    HttpURI uri = new HttpURI(context==null?path:URIUtil.addPaths(context.getContextPath(),path));
    baseRequest.setUri(uri);
    baseRequest.setRequestURI(null);
    baseRequest.setPathInfo(baseRequest.getRequestURI());
    if (uri.getQuery()!=null)
      baseRequest.mergeQueryString(uri.getQuery()); //we have to assume dispatch path and query are UTF8
  }
  final String target=baseRequest.getPathInfo();
  final HttpServletRequest request=(HttpServletRequest)async.getRequest();
  final HttpServletResponse response=(HttpServletResponse)async.getResponse();
  if (LOG.isDebugEnabled())
  {
    LOG.debug("REQUEST "+target+" on "+connection);
    handle(target, baseRequest, request, response);
    LOG.debug("RESPONSE "+target+"  "+connection.getResponse().getStatus());
  }
  else
    handle(target, baseRequest, request, response);
}

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

public void handleAsync(AbstractHttpConnection connection) throws IOException, ServletException
{
  final AsyncContinuation async = connection.getRequest().getAsyncContinuation();
  final AsyncContinuation.AsyncEventState state = async.getAsyncEventState();
  final Request baseRequest=connection.getRequest();
  final String path=state.getPath();
  if (path!=null)
  {
    // this is a dispatch with a path
    final String contextPath=state.getServletContext().getContextPath();
    HttpURI uri = new HttpURI(URIUtil.addPaths(contextPath,path));
    baseRequest.setUri(uri);
    baseRequest.setRequestURI(null);
    baseRequest.setPathInfo(baseRequest.getRequestURI());
    if (uri.getQuery()!=null)
      baseRequest.mergeQueryString(uri.getQuery()); //we have to assume dispatch path and query are UTF8
  }
  final String target=baseRequest.getPathInfo();
  final HttpServletRequest request=(HttpServletRequest)async.getRequest();
  final HttpServletResponse response=(HttpServletResponse)async.getResponse();
  if (LOG.isDebugEnabled())
  {
    LOG.debug("REQUEST "+target+" on "+connection);
    handle(target, baseRequest, request, response);
    LOG.debug("RESPONSE "+target+"  "+connection.getResponse().getStatus());
  }
  else
    handle(target, baseRequest, request, response);
}

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

public void handleAsync(HttpChannel<?> connection) throws IOException, ServletException
{
  final HttpChannelState async = connection.getRequest().getHttpChannelState();
  final HttpChannelState.AsyncEventState state = async.getAsyncEventState();
  final Request baseRequest=connection.getRequest();
  final String path=state.getPath();
  if (path!=null)
  {
    // this is a dispatch with a path
    ServletContext context=state.getServletContext();
    HttpURI uri = new HttpURI(context==null?path:URIUtil.addPaths(context.getContextPath(),path));
    baseRequest.setUri(uri);
    baseRequest.setRequestURI(null);
    baseRequest.setPathInfo(baseRequest.getRequestURI());
    if (uri.getQuery()!=null)
      baseRequest.mergeQueryString(uri.getQuery()); //we have to assume dispatch path and query are UTF8
  }
  final String target=baseRequest.getPathInfo();
  final HttpServletRequest request=(HttpServletRequest)async.getRequest();
  final HttpServletResponse response=(HttpServletResponse)async.getResponse();
  if (LOG.isDebugEnabled())
  {
    LOG.debug("REQUEST "+target+" on "+connection);
    handle(target, baseRequest, request, response);
    LOG.debug("RESPONSE "+target+"  "+connection.getResponse().getStatus());
  }
  else
    handle(target, baseRequest, request, response);
}

相关文章

Request类方法