public static Protocol getParent(Http http) { return http.getParent(Protocol.class); } }
@Override public Object run(Http http) throws PropertyVetoException, TransactionFailure { http.setEncodedSlashEnabled("true"); return null; } }
public Object run(Protocols param) throws TransactionFailure { final Protocol protocol = param.createChild(Protocol.class); param.getProtocol().add(protocol); protocol.setName(ASADMIN_LISTENER); Http http = protocol.createChild(Http.class); http.setFileCache(http.createChild(FileCache.class)); protocol.setHttp(http); http.setDefaultVirtualServer(ASADMIN_VIRTUAL_SERVER); http.setMaxConnections("250"); return protocol; } }, protocols);
private org.glassfish.grizzly.http.HttpServerFilter createHttpServerCodecFilter( final Http http) { int maxRequestHeaders = MimeHeaders.MAX_NUM_HEADERS_DEFAULT; int maxResponseHeaders = MimeHeaders.MAX_NUM_HEADERS_DEFAULT; boolean isChunkedEnabled = true; int headerBufferLengthBytes = org.glassfish.grizzly.http.HttpServerFilter.DEFAULT_MAX_HTTP_PACKET_HEADER_SIZE; String defaultResponseType = null; if (http != null) { isChunkedEnabled = Boolean.parseBoolean(http.getChunkingEnabled()); headerBufferLengthBytes = Integer.parseInt(http.getHeaderBufferLengthBytes()); defaultResponseType = http.getDefaultResponseType(); maxRequestHeaders = Integer.parseInt(http.getMaxRequestHeaders()); maxResponseHeaders = Integer.parseInt(http.getMaxResponseHeaders()); } return createHttpServerCodecFilter(http, isChunkedEnabled, headerBufferLengthBytes, defaultResponseType, configureKeepAlive(http), obtainDelayedExecutor(), maxRequestHeaders, maxResponseHeaders); }
final Http http, final FilterChainBuilder filterChainBuilder, boolean secure) { transactionTimeoutMillis = Integer.parseInt(http.getRequestTimeoutSeconds()) * 1000; filterChainBuilder.add(new IdleTimeoutFilter(delayedExecutor, Integer.parseInt(http.getTimeoutSeconds()), TimeUnit.SECONDS)); int maxRequestHeaders; try { maxRequestHeaders = Integer.parseInt(http.getMaxRequestHeaders()); } catch (NumberFormatException nfe) { maxRequestHeaders = MimeHeaders.MAX_NUM_HEADERS_DEFAULT; maxResponseHeaders = Integer.parseInt(http.getMaxResponseHeaders()); } catch (NumberFormatException nfe) { maxResponseHeaders = MimeHeaders.MAX_NUM_HEADERS_DEFAULT; Boolean.parseBoolean(http.getChunkingEnabled()), Integer.parseInt(http.getHeaderBufferLengthBytes()), http.getDefaultResponseType(), configureKeepAlive(http), delayedExecutor, final boolean isRcmSupportEnabled = Boolean.parseBoolean(http.getRcmSupportEnabled()); if (isRcmSupportEnabled) { filterChainBuilder.add(new ResourceAllocationFilter()); final FileCache fileCache = configureHttpFileCache(http.getFileCache()); fileCache.initialize(transport.getMemoryManager(), delayedExecutor); final FileCacheFilter fileCacheFilter = new FileCacheFilter(fileCache);
protected Set<ContentEncoding> configureCompressionEncodings(Http http) { final String mode = http.getCompression(); int compressionMinSize = Integer.parseInt(http.getCompressionMinSizeBytes()); CompressionLevel compressionLevel; try { final String compressableMimeTypesString = http.getCompressableMimeType(); final String noCompressionUserAgentsString = http.getNoCompressionUserAgents(); final String[] compressableMimeTypes = ((compressableMimeTypesString != null)
private Http writeableHttpWithFileCacheChild(final Transaction t, final Protocol secAdminListenerProtocol_w) throws TransactionFailure { /* * Because of the calling context, the secAdminListenerProtocol is already * writeable -- it was just created moments ago and has not yet * been committed. */ Http http_w; Http http = secAdminListenerProtocol_w.getHttp(); if (http == null) { http_w = secAdminListenerProtocol_w.createChild(Http.class); secAdminListenerProtocol_w.setHttp(http_w); } else { http_w = t.enroll(http); } http_w.setDefaultVirtualServer(ASADMIN_VIRTUAL_SERVER_NAME); http_w.setEncodedSlashEnabled("true"); final FileCache cache = http_w.createChild(FileCache.class); // cache.setEnabled("false"); http_w.setFileCache(cache); return http_w; }
final Http http, final FilterChainBuilder filterChainBuilder, boolean secure) { transactionTimeoutMillis = Long.parseLong(http.getRequestTimeoutSeconds()) * 1000; filterChainBuilder.add(new IdleTimeoutFilter(obtainDelayedExecutor(), getTimeoutSeconds(http), TimeUnit.SECONDS)); final FileCache fileCache = configureHttpFileCache(http.getFileCache()); fileCache.initialize(obtainDelayedExecutor()); final FileCacheFilter fileCacheFilter = new FileCacheFilter(fileCache); httpHandler.setAllowEncodedSlash(GrizzlyConfig.toBoolean(http.getEncodedSlashEnabled())); webServerFilter.setHttpHandler(httpHandler);
private void createHttp(Protocol p) throws PropertyVetoException { try { if (parser.getLocalName().equals("http") && p != null) { Http h = p.createChild(Http.class); p.setHttp(h); for (int i = 0; i < parser.getAttributeCount(); i++) { String attr = parser.getAttributeLocalName(i); String val = parser.getAttributeValue(i); if (attr.equals("default-virtual-server")) { h.setDefaultVirtualServer(val); } if (attr.equals("encoded-slash-enabled")) { h.setEncodedSlashEnabled(val); } if (attr.equals("max-connections")) { h.setMaxConnections(val); } } createFileCache(h); } } catch (TransactionFailure ex) { logger.log( Level.SEVERE, failureCreatingHttpConfig, ex); } }
containerMapper.setDefaultHost(http.getDefaultVirtualServer()); containerMapper.setRequestURIEncoding(http.getUriEncoding()); containerMapper.configureMapper(); final String vsName = http.getDefaultVirtualServer(); for (final VirtualServer virtualServer : list) { if (virtualServer.getId().equals(vsName)) { final Protocol protocol = http.getParent(); for (NetworkListener listener : protocol.findNetworkListeners()) { grizzlyService.notifyMapperUpdateListeners(listener, mapper);
@Override protected org.glassfish.grizzly.http.HttpServerFilter createHttpServerCodecFilter( final Http http, final boolean isChunkedEnabled, final int headerBufferLengthBytes, final String defaultResponseType, final KeepAlive keepAlive, final DelayedExecutor delayedExecutor, final int maxRequestHeaders, final int maxResponseHeaders) { final org.glassfish.grizzly.http.HttpServerFilter httpCodecFilter = new GlassfishHttpCodecFilter( http == null || Boolean.parseBoolean(http.getXpoweredBy()), isChunkedEnabled, headerBufferLengthBytes, defaultResponseType, keepAlive, delayedExecutor, maxRequestHeaders, maxResponseHeaders); if (http != null) { // could be null for HTTP redirect httpCodecFilter.setMaxPayloadRemainderToSkip( Integer.parseInt(http.getMaxSwallowingInputBytes())); httpCodecFilter.setAllowPayloadForUndefinedHttpMethods( Boolean.parseBoolean(http.getAllowPayloadForUndefinedHttpMethods())); } return httpCodecFilter; }
private void createFileCache(Http h) throws PropertyVetoException { while (true) { try { if (parser.next() == START_ELEMENT) { if (parser.getLocalName().equals("file-cache") && h != null) { FileCache fc = h.createChild(FileCache.class); h.setFileCache(fc); for (int i = 0; i < parser.getAttributeCount(); i++) { String attr = parser.getAttributeLocalName(i); String val = parser.getAttributeValue(i); if (attr.equals("enabled")) { fc.setEnabled(val); } } break; } } } catch (TransactionFailure ex) { logger.log( Level.SEVERE, failureCreatingFileCacheConfig, ex); } catch (XMLStreamException ex) { logger.log( Level.SEVERE, problemParsingFileCacheElement, ex); } } }
protected org.glassfish.grizzly.http.HttpServerFilter createHttpServerCodecFilter( final Http http, final boolean isChunkedEnabled, final int headerBufferLengthBytes, final String defaultResponseType, final KeepAlive keepAlive, final DelayedExecutor delayedExecutor, final int maxRequestHeaders, final int maxResponseHeaders) { final org.glassfish.grizzly.http.HttpServerFilter httpCodecFilter = new org.glassfish.grizzly.http.HttpServerFilter( isChunkedEnabled, headerBufferLengthBytes, defaultResponseType, keepAlive, delayedExecutor, maxRequestHeaders, maxResponseHeaders); if (http != null) { // could be null for HTTP redirect httpCodecFilter.setMaxPayloadRemainderToSkip( Integer.parseInt(http.getMaxSwallowingInputBytes())); httpCodecFilter.setAllowPayloadForUndefinedHttpMethods( Boolean.parseBoolean(http.getAllowPayloadForUndefinedHttpMethods())); } return httpCodecFilter; }
addChangeListener(protocol); addChangeListener(protocol.getHttp()); addChangeListener(protocol.getHttp().getFileCache()); addChangeListener(protocol.getSsl());
protected void configureCometSupport(final ServiceLocator habitat, final NetworkListener networkListener, final Http http, final FilterChainBuilder filterChainBuilder) { if(GrizzlyConfig.toBoolean(http.getCometSupportEnabled())) { final AddOn cometAddOn = loadAddOn(habitat, "comet", "org.glassfish.grizzly.comet.CometAddOn"); if (cometAddOn != null) { configureElement(habitat, networkListener, http, cometAddOn); cometAddOn.setup(null, filterChainBuilder); } } }
protected Set<ContentEncoding> configureCompressionEncodings(Http http) { final String mode = http.getCompression(); int compressionMinSize = Integer.parseInt(http.getCompressionMinSizeBytes()); CompressionLevel compressionLevel; try { final String compressableMimeTypesString = http.getCompressableMimeType(); final String noCompressionUserAgentsString = http.getNoCompressionUserAgents(); final String[] compressableMimeTypes = ((compressableMimeTypesString != null)
protected void configureCometSupport(final ServiceLocator habitat, final NetworkListener networkListener, final Http http, final FilterChainBuilder filterChainBuilder) { if(GrizzlyConfig.toBoolean(http.getCometSupportEnabled())) { final AddOn cometAddOn = loadAddOn(habitat, "comet", "org.glassfish.grizzly.comet.CometAddOn"); if (cometAddOn != null) { configureElement(habitat, networkListener, http, cometAddOn); cometAddOn.setup(null, filterChainBuilder); isCometEnabled = true; } } }
public static Protocol getParent(Http http) { return http.getParent(Protocol.class); } }