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

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

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

Request.getResponse介绍

暂无

代码示例

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

private static void addResponseFieldIfConfigured( Request request, HttpField field )
{
  if ( field != null )
  {
    request.getResponse().getHttpFields().add( field );
  }
}

代码示例来源:origin: AsyncHttpClient/async-http-client

@Override
 public void handle(String pathInContext, Request request, HttpServletRequest httpRequest, HttpServletResponse httpResponse) throws IOException, ServletException {
  request.getResponse().getHttpOutput().sendContent(EofTerminatedTest.class.getClassLoader().getResourceAsStream("SimpleTextFile.txt"));
 }
}

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

@Test
public void shouldNotAddHstsHeaderWhenNotConfigured()
{
  Customizer customizer = newCustomizer();
  Request request = newRequest();
  customize( customizer, request );
  String hstsValue = request.getResponse().getHttpFields().get( STRICT_TRANSPORT_SECURITY );
  assertNull( hstsValue );
}

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

@Test
public void shouldAddHstsHeaderWhenConfigured()
{
  String configuredValue = "max-age=3600; includeSubDomains";
  Customizer customizer = newCustomizer( configuredValue );
  Request request = newRequest();
  customize( customizer, request );
  String receivedValue = request.getResponse().getHttpFields().get( STRICT_TRANSPORT_SECURITY );
  assertEquals( configuredValue, receivedValue );
}

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

final HttpServletResponse httpServletResponse) throws IOException, ServletException {
final Response response = request.getResponse();
final ResponseWriter responseWriter = new ResponseWriter(request, response, configSetStatusOverSendError);
final URI baseUri = getBaseUri(request);

代码示例来源:origin: rnewson/couchdb-lucene

public void handle(String target,
          Request baseRequest,
          HttpServletRequest request,
          HttpServletResponse response) throws IOException {
  final String reason = baseRequest.getResponse().getReason();
  try {
    if (reason != null && reason.startsWith("{")) {
      ServletUtils.sendJsonError(request, response, baseRequest.getResponse().getStatus(),
          new JSONObject(reason));
    } else {
      ServletUtils.sendJsonError(request, response, baseRequest.getResponse().getStatus(),
          reason);
    }
  } catch (final JSONException e) {
    response.sendError(500);
  }
}

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

public UserIdentity login(String username, Object password, ServletRequest servletRequest)
{
  UserIdentity user = _loginService.login(username, password, servletRequest);
  if (user != null)
  {
    Request request = Request.getBaseRequest(servletRequest);
    renewSession(request, request == null ? null : request.getResponse());
    return user;
  }
  return null;
}

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

HttpServletResponse response = (HttpServletResponse)res;
Request base_request = Request.getBaseRequest(request);
Response base_response = base_request.getResponse();

代码示例来源:origin: com.codahale.metrics/metrics-jetty8

private void updateResponses(Request request) {
    final int response = request.getResponse().getStatus() / 100;
    if (response >= 1 && response <= 5) {
      responses[response - 1].mark();
    }
    activeRequests.dec();
    requests.mark();
  }
}

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

@Override
public void handle(String pathInContext, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
  final Response base_response = baseRequest.getResponse();
  final Handler handler=getHandler();

代码示例来源:origin: org.neo4j.app/neo4j-server

private static void addResponseFieldIfConfigured( Request request, HttpField field )
{
  if ( field != null )
  {
    request.getResponse().getHttpFields().add( field );
  }
}

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

public UserIdentity login(String username, Object password, ServletRequest request)
{
  UserIdentity user = _loginService.login(username,password);
  if (user!=null)
  {
    renewSession((HttpServletRequest)request, (request instanceof Request? ((Request)request).getResponse() : null));
    return user;
  }
  return null;
}

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

public UserIdentity login(String username, Object password, ServletRequest request)
{
  UserIdentity user = _loginService.login(username,password);
  if (user!=null)
  {
    renewSession((HttpServletRequest)request, (request instanceof Request? ((Request)request).getResponse() : null));
    return user;
  }
  return null;
}

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

public UserIdentity login(String username, Object password, ServletRequest request)
{
  UserIdentity user = _loginService.login(username,password);
  if (user!=null)
  {
    renewSession((HttpServletRequest)request, (request instanceof Request? ((Request)request).getResponse() : null));
    return user;
  }
  return null;
}

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

public UserIdentity login(String username, Object password, ServletRequest request)
{
  UserIdentity user = _loginService.login(username,password, request);
  if (user!=null)
  {
    renewSession((HttpServletRequest)request, (request instanceof Request? ((Request)request).getResponse() : null));
    return user;
  }
  return null;
}

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

@Override
public AsyncContext startAsync() throws IllegalStateException
{
  if (_asyncNotSupportedSource!=null)
    throw new IllegalStateException("!asyncSupported: "+_asyncNotSupportedSource);
  HttpChannelState state = getHttpChannelState();
  if (_async==null)
    _async=new AsyncContextState(state);
  AsyncContextEvent event = new AsyncContextEvent(_context,_async,state,this,this,getResponse());
  state.startAsync(event);
  return _async;
}

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

@Override
  public void onComplete(AsyncEvent event) throws IOException
  {
    AsyncContextState context = (AsyncContextState)event.getAsyncContext();
    Request request=context.getHttpChannelState().getBaseRequest();
    Response response=request.getResponse();
    _requestLog.log(request,response);
  }
};

代码示例来源:origin: com.yammer.metrics/metrics-jetty8

private void updateResponses(Request request) {
    final int response = request.getResponse().getStatus() / 100;
    if (response >= 1 && response <= 5) {
      responses[response - 1].mark();
    }
    activeRequests.dec();
    requests.mark();
  }
}

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

public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
    if (!request.isSecure()) {
      baseRequest.getResponse().sendRedirect("https://" + baseRequest.getServerName() + ":" + httpsPort + baseRequest.getPathInfo());
      baseRequest.setHandled(true);
    } else {
      getHandler().handle(target, baseRequest, request, response);
    }

  }
}

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

@Override
  public void onComplete(AsyncEvent event) throws IOException
  {
    AsyncContextEvent ace=(AsyncContextEvent)event;
    String cname=findContextName(ace.getServletContext());
    String rname=findRequestName(ace.getAsyncContext().getRequest());
    
    Request br=Request.getBaseRequest(ace.getAsyncContext().getRequest());
    Response response = br.getResponse();
    String headers=_showHeaders?("\n"+response.getHttpFields().toString()):"";
    
    log("!  ctx=%s r=%s onComplete %s %d%s",cname,rname,ace.getHttpChannelState(),response.getStatus(),headers);
  }
};

相关文章

Request类方法