org.mortbay.jetty.HttpConnection.getRequest()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(117)

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

HttpConnection.getRequest介绍

暂无

代码示例

代码示例来源:origin: twitter/ambrose

private static void setHandled(HttpServletRequest request) {
 Request base_request = (request instanceof Request) ?
   (Request) request : HttpConnection.getCurrentConnection().getRequest();
 base_request.setHandled(true);
}

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

public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) throws IOException, ServletException
  {
    Request base_request = (request instanceof Request) ? (Request)request:HttpConnection.getCurrentConnection().getRequest();
    base_request.setHandled(true);
    response.setContentType("text/html");
    response.setStatus(HttpServletResponse.SC_OK);
    response.getWriter().println("<h1>Hello ManyHandler</h1>");
  }
}

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

public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) throws IOException, ServletException
  {
    Request base_request = (request instanceof Request) ? (Request)request:HttpConnection.getCurrentConnection().getRequest();
    base_request.setHandled(true);
    
    response.setStatus(HttpServletResponse.SC_OK);
    response.setContentType("text/html");
    response.getWriter().println("<h1>Hello OneContext</h1>");
  }
}

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

public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) throws IOException, ServletException
  {
    Request base_request = (request instanceof Request) ? (Request)request:HttpConnection.getCurrentConnection().getRequest();
    base_request.setHandled(true);
    
    response.setContentType("text/html");
    response.setStatus(HttpServletResponse.SC_OK);
    response.getWriter().println("<h1>Hello OneHandler</h1>");
  }
}

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

public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) throws IOException, ServletException
  {
    Request base_request = (request instanceof Request) ? (Request)request:HttpConnection.getCurrentConnection().getRequest();
    base_request.setHandled(true);
    response.setStatus(HttpServletResponse.SC_OK);
    response.setContentType("text/html");
    response.getWriter().println("<h1>Hello OneContext "+hello+"</h1>");
  }
}

代码示例来源:origin: org.restlet/org.restlet.ext.jetty

@Override
public List<Certificate> getSslClientCertificates() {
  final Certificate[] certificateArray = (Certificate[]) getConnection()
      .getRequest().getAttribute(
          "javax.servlet.request.X509Certificate");
  if (certificateArray != null) {
    return Arrays.asList(certificateArray);
  } else {
    return null;
  }
}

代码示例来源:origin: org.restlet/org.restlet.ext.jetty

@Override
public String getClientAddress() {
  return getConnection().getRequest().getRemoteAddr();
}

代码示例来源:origin: org.restlet/org.restlet.ext.jetty

@Override
public String getSslCipherSuite() {
  return (String) getConnection().getRequest().getAttribute(
      "javax.servlet.request.cipher_suite");
}

代码示例来源:origin: org.mortbay.jetty/com.springsource.org.mortbay.jetty.server

public static Request getRequest(HttpServletRequest request)
{
  if (request instanceof Request)
    return (Request) request;
  
  while (request instanceof ServletRequestWrapper)
    request = (HttpServletRequest)((ServletRequestWrapper)request).getRequest();
  
  if (request instanceof Request)
    return (Request) request;
  
  return HttpConnection.getCurrentConnection().getRequest();
}

代码示例来源:origin: org.restlet/org.restlet.ext.jetty

/**
 * Returns the request method.
 * 
 * @return The request method.
 */
@Override
public String getMethod() {
  return getConnection().getRequest().getMethod();
}

代码示例来源:origin: org.restlet/org.restlet.ext.jetty

/**
 * Returns the response address.<br>
 * Corresponds to the IP address of the responding server.
 * 
 * @return The response address.
 */
@Override
public String getServerAddress() {
  return getConnection().getRequest().getLocalAddr();
}

代码示例来源:origin: org.restlet/org.restlet.ext.jetty

/**
 * Indicates if the request was made using a confidential mean.<br>
 * 
 * @return True if the request was made using a confidential mean.<br>
 */
@Override
public boolean isConfidential() {
  return getConnection().getRequest().isSecure();
}

代码示例来源:origin: org.restlet/org.restlet.ext.jetty

@Override
public int getClientPort() {
  return getConnection().getRequest().getRemotePort();
}

代码示例来源:origin: org.restlet/org.restlet.ext.jetty

@Override
public InputStream getRequestEntityStream(long size) {
  try {
    return getConnection().getRequest().getInputStream();
  } catch (IOException e) {
    getLogger().log(Level.WARNING,
        "Unable to get request entity stream", e);
    return null;
  }
}

代码示例来源:origin: org.restlet/org.restlet.ext.jetty

/**
 * Returns the URI on the request line (most like a relative reference, but
 * not necessarily).
 * 
 * @return The URI on the request line.
 */
@Override
public String getRequestUri() {
  return getConnection().getRequest().getUri().toString();
}

代码示例来源:origin: org.restlet/org.restlet.ext.jetty

@Override
public Integer getSslKeySize() {
  Integer keySize = (Integer) getConnection().getRequest().getAttribute(
      "javax.servlet.request.key_size");
  if (keySize == null) {
    keySize = super.getSslKeySize();
  }
  return keySize;
}

代码示例来源:origin: org.mortbay.jetty/com.springsource.org.mortbay.jetty.server

public void handle(HttpConnection connection) throws IOException, ServletException
{
  String target=connection.getRequest().getPathInfo();
  if (Log.isDebugEnabled())
  {
    Log.debug("REQUEST "+target+" on "+connection);
    handle(target, connection.getRequest(), connection.getResponse(), Handler.REQUEST);
    Log.debug("RESPONSE "+target+"  "+connection.getResponse().getStatus());
  }
  else
    handle(target, connection.getRequest(), connection.getResponse(), Handler.REQUEST);
}

代码示例来源:origin: org.graniteds/granite-server

public void logout() throws SecurityServiceException {
  HttpGraniteContext graniteContext = (HttpGraniteContext)GraniteContext.getCurrentInstance();
  HttpServletRequest httpRequest = graniteContext.getRequest();
  Request request = httpRequest instanceof Request ? (Request)httpRequest : HttpConnection.getCurrentConnection().getRequest();
  UserRealm realm = request.getUserRealm();
  realm.disassociate(httpRequest.getUserPrincipal());
  
  endLogout();
}

代码示例来源:origin: org.mortbay.jetty/com.springsource.org.mortbay.jetty.server

public void close() throws IOException
{
  RetryContinuation continuation = (RetryContinuation) ((HttpConnection)getConnection()).getRequest().getContinuation();
  if (continuation != null && continuation.isPending())
    continuation.reset();
  super.close();
}

代码示例来源:origin: org.mortbay.jetty/com.springsource.org.mortbay.jetty.server

public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) throws IOException
{
  HttpConnection.getCurrentConnection().getRequest().setHandled(true);
  response.setContentType(MimeTypes.TEXT_HTML_8859_1);
  ByteArrayISO8859Writer writer= new ByteArrayISO8859Writer(4096);
  HttpConnection connection = HttpConnection.getCurrentConnection();
  handleErrorPage(request, writer, connection.getResponse().getStatus(), connection.getResponse().getReason());
  writer.flush();
  response.setContentLength(writer.size());
  writer.writeTo(response.getOutputStream());
  writer.destroy();
}

相关文章