• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java UndertowLogger类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中io.undertow.UndertowLogger的典型用法代码示例。如果您正苦于以下问题:Java UndertowLogger类的具体用法?Java UndertowLogger怎么用?Java UndertowLogger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UndertowLogger类属于io.undertow包,在下文中一共展示了UndertowLogger类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: send

import io.undertow.UndertowLogger; //导入依赖的package包/类
/**
 * response
 * 
 * @param exchange
 * @param statusCode
 * @param output
 *            auto release
 */
protected final void send(HttpServerExchange exchange, int statusCode, PooledByteBufferOutputStream output) {
	try {
		output.flip();

		StreamSinkChannel channel = getResponseChannel(exchange);
		Sender sender = exchange.getResponseSender();

		setStatusCode(exchange, statusCode);
		setResponseChannel(sender, channel);
		setPooledBuffers(sender, output.getPooledByteBuffers());

		sender.send(output.getByteBuffers());
	} catch (Throwable t) {
		UndertowLogger.REQUEST_IO_LOGGER.handleUnexpectedFailure(t);
	}
}
 
开发者ID:hank-whu,项目名称:undertow-async,代码行数:25,代码来源:AsyncHttpHandler.java


示例2: handleRequest

import io.undertow.UndertowLogger; //导入依赖的package包/类
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
    if (isConfidential(exchange) || !confidentialityRequired(exchange)) {
        next.handleRequest(exchange);
    } else {
        try {
            URI redirectUri = getRedirectURI(exchange);

            exchange.setResponseCode(StatusCodes.FOUND);
            exchange.getResponseHeaders().put(Headers.LOCATION, redirectUri.toString());
        } catch (Exception e) {
            UndertowLogger.REQUEST_LOGGER.exceptionProcessingRequest(e);
            exchange.setResponseCode(StatusCodes.INTERNAL_SERVER_ERROR);
        }
        exchange.endExchange();
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:AbstractConfidentialityHandler.java


示例3: handleError

import io.undertow.UndertowLogger; //导入依赖的package包/类
public void handleError(final Throwable error) {
    dispatched = false; //we reset the dispatched state
    onAsyncError(error);
    if (!dispatched) {
        servletRequest.setAttribute(RequestDispatcher.ERROR_EXCEPTION, error);
        try {
            boolean errorPage = servletRequestContext.displayStackTraces();
            if(errorPage) {
                ServletDebugPageHandler.handleRequest(exchange, servletRequestContext, error);
            } else {
                if (servletResponse instanceof HttpServletResponse) {
                    ((HttpServletResponse) servletResponse).sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
                } else {
                    servletRequestContext.getOriginalResponse().sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
                }
            }
        } catch (IOException e) {
            UndertowLogger.REQUEST_IO_LOGGER.ioException(e);
        }
        if (!dispatched) {
            complete();
        }
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:AsyncContextImpl.java


示例4: handleEvent

import io.undertow.UndertowLogger; //导入依赖的package包/类
@Override
public void handleEvent(StreamConnection channel) {
    try {
        for (CloseListener l : closeListeners) {
            try {
                l.closed(AbstractServerConnection.this);
            } catch (Throwable e) {
                UndertowLogger.REQUEST_LOGGER.exceptionInvokingCloseListener(l, e);
            }
        }
        if (current != null) {
            current.endExchange();
        }
        ChannelListeners.invokeChannelListener(AbstractServerConnection.this, listener);
    } finally {
        if(extraBytes != null) {
            extraBytes.free();
            extraBytes = null;
        }
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:AbstractServerConnection.java


示例5: run

import io.undertow.UndertowLogger; //导入依赖的package包/类
@Override
public void run() {
    if(!connection.isOpen()) {
        return;
    }
    handle = null;
    if (expireTime > 0) { //timeout is not active
        long now = System.currentTimeMillis();
        if(expireTime > now) {
            handle = connection.getIoThread().executeAfter(this, (expireTime - now) + FUZZ_FACTOR, TimeUnit.MILLISECONDS);
        } else {
            UndertowLogger.REQUEST_LOGGER.parseRequestTimedOut(connection.getPeerAddress());
            IoUtils.safeClose(connection);
        }
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:ParseTimeoutUpdater.java


示例6: sendBadRequestAndClose

import io.undertow.UndertowLogger; //导入依赖的package包/类
private void sendBadRequestAndClose(final StreamConnection connection, final Exception exception) {
    UndertowLogger.REQUEST_IO_LOGGER.failedToParseRequest(exception);
    connection.getSourceChannel().suspendReads();
    new StringWriteChannelListener(BAD_REQUEST) {
        @Override
        protected void writeDone(final StreamSinkChannel c) {
            super.writeDone(c);
            c.suspendWrites();
            IoUtils.safeClose(connection);
        }

        @Override
        protected void handleError(StreamSinkChannel channel, IOException e) {
            IoUtils.safeClose(connection);
        }
    }.setup(connection.getSinkChannel());
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:HttpReadListener.java


示例7: close

import io.undertow.UndertowLogger; //导入依赖的package包/类
@Override
public void close() throws IOException {
    //we have to dispatch this, as it may result in file IO
    final List<File> files = new ArrayList<>(getCreatedFiles());
    exchange.getConnection().getWorker().execute(new Runnable() {
        @Override
        public void run() {
            for (final File file : files) {
                if (file.exists()) {
                    if (!file.delete()) {
                        UndertowLogger.REQUEST_LOGGER.cannotRemoveUploadedFile(file);
                    }
                }
            }
        }
    });

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:MultiPartParserDefinition.java


示例8: CachingResourceManager

import io.undertow.UndertowLogger; //导入依赖的package包/类
public CachingResourceManager(final int metadataCacheSize, final long maxFileSize, final DirectBufferCache dataCache, final ResourceManager underlyingResourceManager, final int maxAge) {
    this.maxFileSize = maxFileSize;
    this.underlyingResourceManager = underlyingResourceManager;
    this.dataCache = dataCache;
    this.cache = new LRUCache<>(metadataCacheSize, maxAge);
    this.maxAge = maxAge;
    if(underlyingResourceManager.isResourceChangeListenerSupported()) {
        try {
            underlyingResourceManager.registerResourceChangeListener(new ResourceChangeListener() {
                @Override
                public void handleChanges(Collection<ResourceChangeEvent> changes) {
                    for(ResourceChangeEvent change : changes) {
                        invalidate(change.getResource());
                    }
                }
            });
        } catch (Exception e) {
            UndertowLogger.ROOT_LOGGER.couldNotRegisterChangeListener(e);
        }
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:CachingResourceManager.java


示例9: cancel

import io.undertow.UndertowLogger; //导入依赖的package包/类
void cancel(final HttpServerExchange exchange) {
    final ProxyConnection connectionAttachment = exchange.getAttachment(CONNECTION);
    if (connectionAttachment != null) {
        ClientConnection clientConnection = connectionAttachment.getConnection();
        UndertowLogger.REQUEST_LOGGER.timingOutRequest(clientConnection.getPeerAddress() + "" + exchange.getRequestURI());
        IoUtils.safeClose(clientConnection);
    } else {
        UndertowLogger.REQUEST_LOGGER.timingOutRequest(exchange.getRequestURI());
    }
    if (exchange.isResponseStarted()) {
        IoUtils.safeClose(exchange.getConnection());
    } else {
        exchange.setResponseCode(StatusCodes.SERVICE_UNAVAILABLE);
        exchange.endExchange();
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:ProxyHandler.java


示例10: handleException

import io.undertow.UndertowLogger; //导入依赖的package包/类
@Override
public void handleException(Channel channel, IOException exception) {
    IoUtils.safeClose(channel);
    if (exchange.isResponseStarted()) {
        IoUtils.safeClose(clientConnection);
        UndertowLogger.REQUEST_IO_LOGGER.debug("Exception reading from target server", exception);
        if (!exchange.isResponseStarted()) {
            exchange.setResponseCode(StatusCodes.INTERNAL_SERVER_ERROR);
            exchange.endExchange();
        } else {
            IoUtils.safeClose(exchange.getConnection());
        }
    } else {
        exchange.setResponseCode(StatusCodes.INTERNAL_SERVER_ERROR);
        exchange.endExchange();
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:ProxyHandler.java


示例11: run

import io.undertow.UndertowLogger; //导入依赖的package包/类
@Override
public void run() {
    handle = null;
    if (expireTime == -1) {
        return;
    }
    long current = System.currentTimeMillis();
    if (current  < expireTime) {
        //timeout has been bumped, re-schedule
        handle = connection.getIoThread().executeAfter(timeoutCommand, (expireTime - current) + FUZZ_FACTOR, TimeUnit.MILLISECONDS);
        return;
    }
    UndertowLogger.REQUEST_LOGGER.tracef("Timing out channel %s due to inactivity");
    IoUtils.safeClose(connection);
    if (connection.getSourceChannel().isReadResumed()) {
        ChannelListeners.invokeChannelListener(connection.getSourceChannel(), connection.getSourceChannel().getReadListener());
    }
    if (connection.getSinkChannel().isWriteResumed()) {
        ChannelListeners.invokeChannelListener(connection.getSinkChannel(), connection.getSinkChannel().getWriteListener());
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:WriteTimeoutStreamSinkConduit.java


示例12: terminateWrites

import io.undertow.UndertowLogger; //导入依赖的package包/类
@Override
public void terminateWrites() throws IOException {
    if(anyAreSet(state, FLAG_WRITES_SHUTDOWN)) {
        return;
    }
    if (this.chunkleft != 0) {
        UndertowLogger.REQUEST_IO_LOGGER.debugf("Channel closed mid-chunk");
        next.truncateWrites();
    }
    if (!anyAreSet(state, FLAG_FIRST_DATA_WRITTEN)) {
        //if no data was actually sent we just remove the transfer encoding header, and set content length 0
        //TODO: is this the best way to do it?
        //todo: should we make this behaviour configurable?
        responseHeaders.put(Headers.CONTENT_LENGTH, "0"); //according to the spec we don't actually need this, but better to be safe
        responseHeaders.remove(Headers.TRANSFER_ENCODING);
        state |= FLAG_NEXT_SHUTDOWN | FLAG_WRITES_SHUTDOWN;
        if(anyAreSet(state, CONF_FLAG_PASS_CLOSE)) {
            next.terminateWrites();
        }
    } else {
        createLastChunk(false);
        state |= FLAG_WRITES_SHUTDOWN;
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:ChunkedStreamSinkConduit.java


示例13: getSinkChannel

import io.undertow.UndertowLogger; //导入依赖的package包/类
@Override
public ConduitStreamSinkChannel getSinkChannel() {

    ConduitStreamSinkChannel sinkChannel = new ConduitStreamSinkChannel(
            Configurable.EMPTY,
            new BufferedStreamSinkConduit(
                    new NullStreamSinkConduit(worker.getIoThread()),
                    new PooledAdaptor(bufferPool.allocate())
            )
    );
    sinkChannel.setCloseListener(conduitStreamSinkChannel -> {
        for (CloseListener l : closeListeners) {
            try {
                l.closed(InVMConnection.this);
            } catch (Throwable e) {
                UndertowLogger.REQUEST_LOGGER.exceptionInvokingCloseListener(l, e);
            }
        }
    });
    return sinkChannel;
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:22,代码来源:InVMConnection.java


示例14: cancel

import io.undertow.UndertowLogger; //导入依赖的package包/类
void cancel(final HttpServerExchange exchange) {
    final ProxyConnection connectionAttachment = exchange.getAttachment(CONNECTION);
    if (connectionAttachment != null) {
        ClientConnection clientConnection = connectionAttachment.getConnection();
        UndertowLogger.REQUEST_LOGGER.timingOutRequest(clientConnection.getPeerAddress() + "" + exchange.getRequestURI());
        IoUtils.safeClose(clientConnection);
    } else {
        UndertowLogger.REQUEST_LOGGER.timingOutRequest(exchange.getRequestURI());
    }
    if (exchange.isResponseStarted()) {
        IoUtils.safeClose(exchange.getConnection());
    } else {
        exchange.setResponseCode(503);
        exchange.endExchange();
    }
}
 
开发者ID:liveoak-io,项目名称:liveoak,代码行数:17,代码来源:ProxyHandler.java


示例15: handleException

import io.undertow.UndertowLogger; //导入依赖的package包/类
@Override
public void handleException(Channel channel, IOException exception) {
    IoUtils.safeClose(channel);
    if (exchange.isResponseStarted()) {
        IoUtils.safeClose(clientConnection);
        UndertowLogger.REQUEST_IO_LOGGER.debug("Exception reading from target server", exception);
        if (!exchange.isResponseStarted()) {
            exchange.setResponseCode(500);
            exchange.endExchange();
        } else {
            IoUtils.safeClose(exchange.getConnection());
        }
    } else {
        exchange.setResponseCode(500);
        exchange.endExchange();
    }
}
 
开发者ID:liveoak-io,项目名称:liveoak,代码行数:18,代码来源:ProxyHandler.java


示例16: runFormAuth

import io.undertow.UndertowLogger; //导入依赖的package包/类
public AuthenticationMechanismOutcome runFormAuth(final HttpServerExchange exchange, final SecurityContext securityContext) {
    final FormDataParser parser = formParserFactory.createParser(exchange);
    if (parser == null) {
        UndertowLogger.REQUEST_LOGGER.debug("Could not authenticate as no form parser is present");
        // TODO - May need a better error signaling mechanism here to prevent repeated attempts.
        return AuthenticationMechanismOutcome.NOT_AUTHENTICATED;
    }

    try {
        final FormData data = parser.parseBlocking();
        final FormData.FormValue jUsername = data.getFirst("j_username");
        final FormData.FormValue jPassword = data.getFirst("j_password");
        if (jUsername == null || jPassword == null) {
            UndertowLogger.REQUEST_LOGGER.debug("Could not authenticate as username or password was not present in the posted result");
            return AuthenticationMechanismOutcome.NOT_AUTHENTICATED;
        }
        final String userName = jUsername.getValue();
        final String password = jPassword.getValue();
        AuthenticationMechanismOutcome outcome = null;
        PasswordCredential credential = new PasswordCredential(password.toCharArray());
        try {
            IdentityManager identityManager = securityContext.getIdentityManager();
            Account account = identityManager.verify(userName, credential);
            if (account != null) {
                securityContext.authenticationComplete(account, name, true);
                outcome = AuthenticationMechanismOutcome.AUTHENTICATED;
            } else {
                securityContext.authenticationFailed(MESSAGES.authenticationFailed(userName), name);
            }
        } finally {
            if (outcome == AuthenticationMechanismOutcome.AUTHENTICATED) {
                handleRedirectBack(exchange);
                exchange.endExchange();
            }
            return outcome != null ? outcome : AuthenticationMechanismOutcome.NOT_AUTHENTICATED;
        }
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:41,代码来源:FormAuthenticationMechanism.java


示例17: parseSingleToken

import io.undertow.UndertowLogger; //导入依赖的package包/类
public ExchangeAttribute parseSingleToken(final String token) {
    for (final ExchangeAttributeBuilder builder : builders) {
        ExchangeAttribute res = builder.build(token);
        if (res != null) {
            return res;
        }
    }
    if (token.startsWith("%")) {
        UndertowLogger.ROOT_LOGGER.unknownVariable(token);
    }
    return new ConstantExchangeAttribute(token);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:ExchangeAttributeParser.java


示例18: handleCustomLog

import io.undertow.UndertowLogger; //导入依赖的package包/类
private void handleCustomLog(HttpServerExchange exchange, Throwable t, Logger.Level level, Logger.Level stackTraceLevel, String category) {
    BasicLogger logger = UndertowLogger.REQUEST_LOGGER;
    if (!category.isEmpty()) {
        logger = Logger.getLogger(category);
    }
    boolean stackTrace = true;
    if (stackTraceLevel.ordinal() > level.ordinal()) {
        if (!logger.isEnabled(stackTraceLevel)) {
            stackTrace = false;
        }
    }
    if (stackTrace) {
        logger.logf(level, t, "Exception handling request to %s", exchange.getRequestURI());
    } else {
        logger.logf(level, "Exception handling request to %s: %s", exchange.getRequestURI(), t.getMessage());
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:LoggingExceptionHandler.java


示例19: complete

import io.undertow.UndertowLogger; //导入依赖的package包/类
@Override
public synchronized void complete() {
    if(complete) {
        UndertowLogger.REQUEST_LOGGER.trace("Ignoring call to AsyncContext.complete() as it has already been called");
        return;
    }
    complete = true;
    onAsyncComplete();
    if(!dispatched) {
        completeInternal();
    }
    if(previousAsyncContext != null) {
        previousAsyncContext.complete();
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:AsyncContextImpl.java


示例20: responseDone

import io.undertow.UndertowLogger; //导入依赖的package包/类
public void responseDone() {
    if (responseDone || treatAsCommitted) {
        return;
    }
    servletContext.updateSessionAccessTime(exchange);
    responseDone = true;
    try {
        closeStreamAndWriter();
    } catch (IOException e) {
        UndertowLogger.REQUEST_IO_LOGGER.ioException(e);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:HttpServletResponseImpl.java



注:本文中的io.undertow.UndertowLogger类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AggregateProgressFactory类代码示例发布时间:2022-05-22
下一篇:
Java PagingLoadResult类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap