本文整理汇总了Java中io.undertow.server.HttpServerExchange.getQueryString方法的典型用法代码示例。如果您正苦于以下问题:Java HttpServerExchange.getQueryString方法的具体用法?Java HttpServerExchange.getQueryString怎么用?Java HttpServerExchange.getQueryString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.undertow.server.HttpServerExchange
的用法示例。
在下文中一共展示了HttpServerExchange.getQueryString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readAttribute
import io.undertow.server.HttpServerExchange; //导入方法依赖的package包/类
@Override
public String readAttribute(final HttpServerExchange exchange) {
String qs = exchange.getQueryString();
if(qs.isEmpty()) {
return qs;
}
return '?' + qs;
}
示例2: getRedirectURI
import io.undertow.server.HttpServerExchange; //导入方法依赖的package包/类
protected URI getRedirectURI(HttpServerExchange exchange, int port) throws URISyntaxException {
String host = exchange.getHostName();
String queryString = exchange.getQueryString();
return new URI("https", null, host, port, exchange.getRequestURI(),
queryString == null || queryString.length() == 0 ? null : queryString, null);
}
示例3: logMessage
import io.undertow.server.HttpServerExchange; //导入方法依赖的package包/类
public void logMessage(String pattern, HttpServerExchange exchange) {
JDBCLogAttribute jdbcLogAttribute = new JDBCLogAttribute();
if (pattern.equals("combined")) {
jdbcLogAttribute.pattern = pattern;
}
jdbcLogAttribute.remoteHost = ((InetSocketAddress) exchange.getConnection().getPeerAddress()).getAddress().getHostAddress();
SecurityContext sc = exchange.getSecurityContext();
if (sc == null || !sc.isAuthenticated()) {
jdbcLogAttribute.user = null;
} else {
jdbcLogAttribute.user = sc.getAuthenticatedAccount().getPrincipal().getName();
}
jdbcLogAttribute.query = exchange.getQueryString();
jdbcLogAttribute.bytes = exchange.getResponseContentLength();
if (jdbcLogAttribute.bytes < 0)
jdbcLogAttribute.bytes = 0;
jdbcLogAttribute.status = exchange.getResponseCode();
if (jdbcLogAttribute.pattern.equals("combined")) {
jdbcLogAttribute.virtualHost = exchange.getRequestHeaders().getFirst(Headers.HOST);
jdbcLogAttribute.method = exchange.getRequestMethod().toString();
jdbcLogAttribute.referer = exchange.getRequestHeaders().getFirst(Headers.REFERER);
jdbcLogAttribute.userAgent = exchange.getRequestHeaders().getFirst(Headers.USER_AGENT);
}
this.pendingMessages.add(jdbcLogAttribute);
int state = stateUpdater.get(this);
if (state == 0) {
if (stateUpdater.compareAndSet(this, 0, 1)) {
logWriteExecutor.execute(this);
}
}
}