org.glassfish.grizzly.http.server.Request.getScheme()方法的使用及代码示例

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

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

Request.getScheme介绍

[英]Return the scheme used to make this Request.
[中]返回用于发出此请求的方案。

代码示例

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

private String getServerAddress(final Request request) throws URISyntaxException {
  return new URI(request.getScheme(), null,  request.getServerName(), request.getServerPort(), null, null, null).toString();
}

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

private URI getBaseUri(final Request request) {
  try {
    return new URI(request.getScheme(), null, request.getServerName(),
        request.getServerPort(), getBasePath(request), null, null);
  } catch (final URISyntaxException ex) {
    throw new IllegalArgumentException(ex);
  }
}

代码示例来源:origin: javaee/grizzly

@Override
public String getRequestScheme() {
  return request.getScheme();
}

代码示例来源:origin: javaee/grizzly

/**
 * {@inheritDoc}
 */
@Override
public String getScheme() {
  if (request == null) {
    throw new IllegalStateException("Null request object");
  }
  return request.getScheme();
}

代码示例来源:origin: javaee/grizzly

/**
 * {@inheritDoc}
 */
@Override
public String getScheme() {
  if (request == null) {
    throw new IllegalStateException("Null request object");
  }
  return request.getScheme();
}

代码示例来源:origin: javaee/grizzly

/**
 * {@inheritDoc}
 */
@Override
public String getScheme() {
  if (request == null) {
    throw new IllegalStateException("Null request object");
  }
  return request.getScheme();
}

代码示例来源:origin: javaee/grizzly

/**
 * {@inheritDoc}
 */
@Override
public String getScheme() {
  if (request == null) {
    throw new IllegalStateException("Null request object");
  }
  return request.getScheme();
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server

/**
 * {@inheritDoc}
 */
@Override
public String getScheme() {
  if (request == null) {
    throw new IllegalStateException("Null request object");
  }
  return request.getScheme();
}

代码示例来源:origin: javaee/grizzly

/**
 * {@inheritDoc}
 */
@Override
public String getScheme() {
  if (request == null) {
    throw new IllegalStateException("Null request object");
  }
  return request.getScheme();
}

代码示例来源:origin: javaee/grizzly

static @NotNull
String getBaseAddress(Request request) {
  StringBuilder buf = new StringBuilder();
  buf.append(request.getScheme());
  buf.append("://");
  buf.append(request.getServerName());
  buf.append(':');
  buf.append(request.getServerPort());
  buf.append(request.getContextPath());
  return buf.toString();
}

代码示例来源:origin: org.glassfish.jersey.containers/jersey-container-grizzly2-http

private String getServerAddress(final Request request) throws URISyntaxException {
  return new URI(request.getScheme(), null,  request.getServerName(), request.getServerPort(), null, null, null).toString();
}

代码示例来源:origin: org.glassfish.jersey.containers/jersey-container-grizzly2-http

private URI getBaseUri(final Request request) {
  try {
    return new URI(request.getScheme(), null, request.getServerName(),
        request.getServerPort(), getBasePath(request), null, null);
  } catch (final URISyntaxException ex) {
    throw new IllegalArgumentException(ex);
  }
}

代码示例来源:origin: com.sun.jersey/jersey-grizzly2

private URI getBaseUri(final Request request) {
  try {
    return new URI(request.getScheme(), null, request.getServerName(),
        request.getServerPort(), getBasePath(request), null, null);
  } catch (final URISyntaxException ex) {
    throw new IllegalArgumentException(ex);
  }
}

代码示例来源:origin: jersey/jersey-1.x

private URI getBaseUri(final Request request) {
  try {
    return new URI(request.getScheme(), null, request.getServerName(),
        request.getServerPort(), getBasePath(request), null, null);
  } catch (final URISyntaxException ex) {
    throw new IllegalArgumentException(ex);
  }
}

代码示例来源:origin: bouncestorage/swiftproxy

@GET
  public Response auth(@HeaderParam("X-Auth-User") Optional<String> authUser,
             @HeaderParam("X-Auth-Key") Optional<String> authKey,
             @HeaderParam("X-Storage-User") Optional<String> storageUser,
             @HeaderParam("X-Storage-Pass") Optional<String> storagePass,
             @HeaderParam("Host") Optional<String> host,
             @Context Request request) {
    String identity = authUser.orElseGet(storageUser::get);
    String credential = authKey.orElseGet(storagePass::get);
    String authToken = null;
    try {
      authToken = ((BounceResourceConfig) application).authenticate(identity, credential);
    } catch (Throwable e) {
      e.printStackTrace();
    }
    if (authToken == null) {
      return notAuthorized();
    }

    String storageURL = host.orElseGet(() -> request.getLocalAddr() + ":" + request.getLocalPort());
    String scheme = request.getScheme();
    storageURL = scheme + "://" + storageURL + "/v1/AUTH_" + identity;

    return Response.ok()
        .header("x-storage-url", storageURL)
        .header("x-auth-token", authToken)
        .header("x-storage-token", authToken)
        .build();
  }
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server

final StringBuffer buffer) {
final String scheme = request.getScheme();
int port = request.getServerPort();
if (port < 0)

代码示例来源:origin: javaee/grizzly

final StringBuilder buffer) {
final String scheme = request.getScheme();
int port = request.getServerPort();
if (port < 0)

代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server-core

final StringBuilder buffer) {
final String scheme = request.getScheme();
int port = request.getServerPort();
if (port < 0)

代码示例来源:origin: org.glassfish.main.core/kernel

/**
 *
 */
private void sendStatusPage(Request req, Response res) {
  byte[] bytes;
  try {
    OutputBuffer ob = getOutputBuffer(res);
    // Replace locale specific Strings
    String localHtml = replaceTokens(statusHtml, bundle);
    // Replace state token
    String status = getStateMsg().getI18NKey();
    try {
      // Try to get a localized version of this key
      status = bundle.getString(status);
    } catch (MissingResourceException ex) {
      // Use the non-localized String version of the status
      status = getStateMsg().toString();
    }
    String locationUrl = req.getScheme()
        + "://" + req.getServerName()
        + ':' + req.getServerPort() + "/login.jsf";
    localHtml = localHtml.replace(REDIRECT_TOKEN, locationUrl);
    bytes = localHtml.replace(STATUS_TOKEN, status).getBytes("UTF-8");
    res.setContentLength(bytes.length);
    ob.write(bytes, 0, bytes.length);
    ob.flush();
  } catch (IOException ex) {
    throw new RuntimeException(ex);
  }
}

代码示例来源:origin: org.glassfish.main.web/web-core

/**
 * Return the scheme used to make this Request.
 */
@Override
public String getScheme() {
  // START S1AS 6170450
  if (getConnector() != null && getConnector().getAuthPassthroughEnabled()) {
    ProxyHandler proxyHandler = getConnector().getProxyHandler();
    if (proxyHandler != null && proxyHandler.getSSLKeysize(getRequest()) > 0) {
      return "https";
    }
  }
  // END S1AS 6170450
  return coyoteRequest.getScheme();
}

相关文章

Request类方法