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

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

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

Request.getDispatcherType介绍

暂无

代码示例

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

@Test
public void shouldAddDefaultHeadersForRootContext() throws Exception {
  jetty9Server.configure();
  jetty9Server.startHandlers();
  HttpServletResponse response = mock(HttpServletResponse.class);
  when(response.getWriter()).thenReturn(mock(PrintWriter.class));
  HttpServletRequest request = mock(HttpServletRequest.class);
  Request baseRequest = mock(Request.class);
  when(baseRequest.getDispatcherType()).thenReturn(DispatcherType.REQUEST);
  when(baseRequest.getHttpFields()).thenReturn(mock(HttpFields.class));
  ContextHandler rootPathHandler = getLoadedHandlers().get(GoServerLoadingIndicationHandler.class);
  rootPathHandler.setServer(server);
  rootPathHandler.start();
  rootPathHandler.handle("/something", baseRequest, request, response);
  verify(response).setHeader("X-XSS-Protection", "1; mode=block");
  verify(response).setHeader("X-Content-Type-Options", "nosniff");
  verify(response).setHeader("X-Frame-Options", "SAMEORIGIN");
  verify(response).setHeader("X-UA-Compatible", "chrome=1");
}

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

@Override
  public void handle( String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response ) throws IOException, ServletException
  {
    HttpChannel httpChannel = baseRequest.getHttpChannel();
    if ( httpChannel != null ) // if the channel is not null, all good, you handle yourself.
    {
      super.handle( target, baseRequest, request, response );
    }
    else // if we do not have a real channel, then we just log ourselves
    {
      try
      {
        if ( _handler != null )
        {
          _handler.handle( target, baseRequest, request, response );
        }
      }
      finally
      {
        RequestLog requestLog = getRequestLog();
        if ( requestLog != null && baseRequest.getDispatcherType() == DispatcherType.REQUEST )
        {
          requestLog.log( baseRequest, (Response) response );
        }
      }
    }
  }
}

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

protected boolean checkSecurity(Request request)
{
  switch(request.getDispatcherType())
  {
    case REQUEST:
    case ASYNC:
      return true;
    case FORWARD:
      if (isCheckWelcomeFiles() && request.getAttribute("org.eclipse.jetty.server.welcome") != null)
      {
        request.removeAttribute("org.eclipse.jetty.server.welcome");
        return true;
      }
      return false;
    default:
      return false;
  }
}

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

@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
 // handle ASYNC as well?
 if (((Request) request).getDispatcherType() == DispatcherType.REQUEST) {
  rewriteProxyRequest(baseRequest);
 }
 super.handle(target, baseRequest, request, response);
}

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

@Override
public final void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
  if (baseRequest.getDispatcherType()==DispatcherType.ERROR)
    doError(target,baseRequest,request,response);
  else
    doNonErrorHandle(target,baseRequest,request,response);
}

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

protected boolean checkSecurity(Request request)
{
  switch(request.getDispatcherType())
  {
    case REQUEST:
    case ASYNC:
      return true;
    case FORWARD:
      if (_checkWelcomeFiles && request.getAttribute("org.eclipse.jetty.server.welcome") != null)
      {
        request.removeAttribute("org.eclipse.jetty.server.welcome");
        return true;
      }
      return false;
    default:
      return false;
  }
}

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

protected boolean checkSecurity(Request request)
{
  switch(request.getDispatcherType())
  {
    case REQUEST:
    case ASYNC:
      return true;
    case FORWARD:
      if (_checkWelcomeFiles && request.getAttribute("org.eclipse.jetty.server.welcome") != null)
      {
        request.removeAttribute("org.eclipse.jetty.server.welcome");
        return true;
      }
      return false;
    default:
      return false;
  }
}

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

protected boolean checkSecurity(Request request)
{
  switch(request.getDispatcherType())
  {
    case REQUEST:
    case ASYNC:
      return true;
    case FORWARD:
      if (_checkWelcomeFiles && request.getAttribute("org.eclipse.jetty.server.welcome") != null)
      {
        request.removeAttribute("org.eclipse.jetty.server.welcome");
        return true;
      }
      return false;
    default:
      return false;
  }
}

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

protected boolean checkSecurity(Request request)
{
  switch(request.getDispatcherType())
  {
    case REQUEST:
    case ASYNC:
      return true;
    case FORWARD:
      if (_checkWelcomeFiles && request.getAttribute("org.eclipse.jetty.server.welcome") != null)
      {
        request.removeAttribute("org.eclipse.jetty.server.welcome");
        return true;
      }
      return false;
    default:
      return false;
  }
}

代码示例来源:origin: com.madgag/org.eclipse.jgit.junit.http

@Override
public void handle(String target, Request baseRequest, HttpServletRequest request,
  HttpServletResponse response) throws IOException, ServletException {
 try {
  for (;;) {
   try {
    active.acquire();
    break;
   } catch (InterruptedException e) {
    continue;
   }
  }
  super.handle(target, baseRequest, request, response);
  if (DispatcherType.REQUEST.equals(baseRequest.getDispatcherType()))
   log((Request) request, (Response) response);
 } finally {
  active.release();
 }
}

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

@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException
{
  if (baseRequest.getDispatcherType()==DispatcherType.REQUEST)
    baseRequest.getHttpChannel().addRequestLog(_requestLog);
  if (_handler!=null)
    _handler.handle(target,baseRequest, request, response);
}

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

@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException
{
  if (baseRequest.getDispatcherType()==DispatcherType.REQUEST)
    baseRequest.getHttpChannel().addRequestLog(_requestLog);
  if (_handler!=null)
    _handler.handle(target,baseRequest, request, response);
}

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

@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
  if (isStarted())
  {
    if (_dispatchTypes.contains(baseRequest.getDispatcherType()))
    {
      String returned = _rules.matchAndApply(target, request, response);
      target = (returned == null) ? target : returned;
    }
    if (!baseRequest.isHandled())
      super.handle(target, baseRequest, request, response);
  }
}

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

protected boolean checkSecurity(Request request)
{
  switch(request.getDispatcherType())
  {
    case REQUEST:
    case ASYNC:
      return true;
    case FORWARD:
      if (isCheckWelcomeFiles() && request.getAttribute("org.eclipse.jetty.server.welcome") != null)
      {
        request.removeAttribute("org.eclipse.jetty.server.welcome");
        return true;
      }
      return false;
    default:
      return false;
  }
}

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

protected boolean checkSecurity(Request request)
{
  switch(request.getDispatcherType())
  {
    case REQUEST:
    case ASYNC:
      return true;
    case FORWARD:
      if (isCheckWelcomeFiles() && request.getAttribute("org.eclipse.jetty.server.welcome") != null)
      {
        request.removeAttribute("org.eclipse.jetty.server.welcome");
        return true;
      }
      return false;
    default:
      return false;
  }
}

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

protected boolean checkSecurity(Request request)
{
  switch(request.getDispatcherType())
  {
    case REQUEST:
    case ASYNC:
      return true;
    case FORWARD:
      if (isCheckWelcomeFiles() && request.getAttribute("org.eclipse.jetty.server.welcome") != null)
      {
        request.removeAttribute("org.eclipse.jetty.server.welcome");
        return true;
      }
      return false;
    default:
      return false;
  }
}

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

protected boolean checkSecurity(Request request)
{
  switch(request.getDispatcherType())
  {
    case REQUEST:
    case ASYNC:
      return true;
    case FORWARD:
      if (isCheckWelcomeFiles() && request.getAttribute("org.eclipse.jetty.server.welcome") != null)
      {
        request.removeAttribute("org.eclipse.jetty.server.welcome");
        return true;
      }
      return false;
    default:
      return false;
  }
}

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

@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException
{
  HttpChannelState continuation = baseRequest.getHttpChannelState();
  if (!continuation.isInitial())
  {
    baseRequest.setDispatchTime(System.currentTimeMillis());
  }
  try
  {
    super.handle(target, baseRequest, request, response);
  }
  finally
  {
    if (_requestLog != null && DispatcherType.REQUEST.equals(baseRequest.getDispatcherType()))
    {
      _requestLog.log(baseRequest, (Response)response);
    }
  }
}

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

public void complete (Session session, Request request)
{
  if (request.isAsyncStarted() && request.getDispatcherType() == DispatcherType.REQUEST)
  {
    request.getAsyncContext().addListener(new SessionAsyncListener(session));
  }
  else
  {
    complete(session);
  }
  //if dispatcher type is not async and not request, complete immediately (its a forward or an include)
  
  //else if dispatcher type is request and not async, complete immediately
  
  //else register an async callback completion listener that will complete the session
}

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

public void handle(HttpChannel<?> connection) throws IOException, ServletException
{
  final String target=connection.getRequest().getPathInfo();
  final Request request=connection.getRequest();
  final Response response=connection.getResponse();
  if (LOG.isDebugEnabled())
    LOG.debug(request.getDispatcherType()+" "+request.getMethod()+" "+target+" on "+connection);
  if (HttpMethod.OPTIONS.is(request.getMethod()) || "*".equals(target))
  {
    if (!HttpMethod.OPTIONS.is(request.getMethod()))
      response.sendError(HttpStatus.BAD_REQUEST_400);
    handleOptions(request,response);
    if (!request.isHandled())
      handle(target, request, request, response);
  }
  else
    handle(target, request, request, response);
  if (LOG.isDebugEnabled())
    LOG.debug("RESPONSE "+target+"  "+connection.getResponse().getStatus()+" handled="+request.isHandled());
}

相关文章

Request类方法