当前位置: 首页>>代码示例>>Java>>正文


Java UndertowLogger类代码示例

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


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


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