本文整理了Java中org.glassfish.grizzly.http.server.Request.getServerPort
方法的一些代码示例,展示了Request.getServerPort
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.getServerPort
方法的具体详情如下:
包路径:org.glassfish.grizzly.http.server.Request
类名称:Request
方法名:getServerPort
[英]Return the server port responding to 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 int getServerPort() {
return request.getServerPort();
}
代码示例来源:origin: javaee/grizzly
/**
* {@inheritDoc}
*/
@Override
public int getServerPort() {
if (request == null) {
throw new IllegalStateException("Null request object");
}
return request.getServerPort();
}
代码示例来源:origin: javaee/grizzly
/**
* {@inheritDoc}
*/
@Override
public int getServerPort() {
if (request == null) {
throw new IllegalStateException("Null request object");
}
return request.getServerPort();
}
代码示例来源:origin: javaee/grizzly
/**
* {@inheritDoc}
*/
@Override
public int getServerPort() {
if (request == null) {
throw new IllegalStateException("Null request object");
}
return request.getServerPort();
}
代码示例来源:origin: javaee/grizzly
/**
* {@inheritDoc}
*/
@Override
public int getServerPort() {
if (request == null) {
throw new IllegalStateException("Null request object");
}
return request.getServerPort();
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server
/**
* {@inheritDoc}
*/
@Override
public int getServerPort() {
if (request == null) {
throw new IllegalStateException("Null request object");
}
return request.getServerPort();
}
代码示例来源:origin: javaee/grizzly
/**
* {@inheritDoc}
*/
@Override
public int getServerPort() {
if (request == null) {
throw new IllegalStateException("Null request object");
}
return request.getServerPort();
}
代码示例来源: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.main.web/web-core
/**
* Return the server port responding to this Request.
*/
@Override
public int getServerPort() {
/* SJSAS 6586658
return (coyoteRequest.getServerPort());
*/
// START SJSAS 6586658
if (isSecure()) {
String host = getHeader("host");
if (host != null && host.indexOf(':') == -1) {
// No port number provided with Host header, use default
return 443;
} else {
return coyoteRequest.getServerPort();
}
} else {
return coyoteRequest.getServerPort();
}
// END SJSAS 6586658
}
代码示例来源: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: org.glassfish.grizzly/grizzly-websockets-server
int port = request.getServerPort();
if (port < 0)
port = 80; // Work around java.net.URL bug
代码示例来源:origin: javaee/grizzly
int port = request.getServerPort();
if (port < 0)
port = 80; // Work around java.net.URL bug
代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server-core
int port = request.getServerPort();
if (port < 0)
port = 80; // Work around java.net.URL bug
代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server
int port = request.getServerPort();
if (port < 0)
port = 80; // Work around java.net.URL bug
代码示例来源: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);
}
}
内容来源于网络,如有侵权,请联系作者删除!