Not sure it's a good idea to add hk2 dependencies to Grizzly modules,
just because it will clean up GF integration.
On 03/17/2011 06:50 PM, Justin Lee wrote:
> Looking at those added files below, it seems they're only reason for
> being is so that we can add those hk2 annotations. What if we added
> those in grizzly and just added a dep on hk2 in those modules? It's a
> dep that might not mean much to others but would clean up a few pieces
> on our end.
>
> On 3/17/11 6:22 AM, oleksiys_at_java.net wrote:
>> Project: glassfish
>> Repository: svn
>> Revision: 45600
>> Author: oleksiys
>> Date: 2011-03-17 13:22:09 UTC
>> Link:
>>
>> Log Message:
>> ------------
>> + align with the latest Grizzly changes
>> + prepare for Grizzly 2.0.1 integration
>>
>>
>> Revisions:
>> ----------
>> 45600
>>
>>
>> Modified Paths:
>> ---------------
>> branches/grizzly20/core/kernel/src/main/java/com/sun/enterprise/v3/services/impl/GlassfishNetworkListener.java
>>
>> branches/grizzly20/pom.xml
>> branches/grizzly20/common/container-common/pom.xml
>> branches/grizzly20/packager/glassfish-grizzly-full/pom.xml
>> branches/grizzly20/web/webtier-all/pom.xml
>> branches/grizzly20/web/web-core/src/main/java/org/apache/catalina/connector/CoyoteAdapter.java
>>
>> branches/grizzly20/core/kernel/src/main/java/com/sun/enterprise/v3/services/impl/ServiceInitializerListener.java
>>
>>
>>
>> Added Paths:
>> ------------
>> branches/grizzly20/common/container-common/src/main/java/org/glassfish/javaee/services/CometAddOnProvider.java
>>
>> branches/grizzly20/common/container-common/src/main/java/org/glassfish/javaee/services/AjpAddOnProvider.java
>>
>> branches/grizzly20/common/container-common/src/main/java/org/glassfish/javaee/services/WebSocketAddOnProvider.java
>>
>>
>>
>> Diffs:
>> ------
>> Index:
>> branches/grizzly20/core/kernel/src/main/java/com/sun/enterprise/v3/services/impl/GlassfishNetworkListener.java
>> ===================================================================
>> ---
>> branches/grizzly20/core/kernel/src/main/java/com/sun/enterprise/v3/services/impl/GlassfishNetworkListener.java
>> (revision 45599)
>> +++
>> branches/grizzly20/core/kernel/src/main/java/com/sun/enterprise/v3/services/impl/GlassfishNetworkListener.java
>> (revision 45600)
>> @@ -1,7 +1,7 @@
>> /*
>> * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
>> *
>> - * Copyright (c) 2007-2010 Oracle and/or its affiliates. All rights
>> reserved.
>> + * Copyright (c) 2007-2011 Oracle and/or its affiliates. All rights
>> reserved.
>> *
>> * The contents of this file are subject to the terms of either the
>> GNU
>> * General Public License Version 2 only ("GPL") or the Common
>> Development
>> @@ -59,7 +59,7 @@
>> import org.glassfish.grizzly.config.dom.Protocol;
>> import org.glassfish.grizzly.config.dom.ThreadPool;
>> import org.glassfish.grizzly.config.dom.Transport;
>> -import org.glassfish.grizzly.filterchain.FilterChain;
>> +import org.glassfish.grizzly.filterchain.FilterChainBuilder;
>> import org.glassfish.grizzly.http.KeepAlive;
>> import org.glassfish.grizzly.http.server.HttpHandler;
>> import org.glassfish.grizzly.http.server.StaticHttpHandler;
>> @@ -105,11 +105,23 @@
>> return super.getAdapter(adapterClass);
>> }
>>
>> + @Override
>> + protected void configureTransport(final Habitat habitat,
>> + final NetworkListener networkListener,
>> + final Transport transportConfig,
>> + final FilterChainBuilder filterChainBuilder) {
>>
>> + super.configureTransport(habitat, networkListener,
>> transportConfig,
>> + filterChainBuilder);
>>
>> + transport.getConnectionMonitoringConfig().addProbes(new
>> ConnectionMonitor(
>> + grizzlyService.getMonitoring(), name, transport));
>> + }
>> +
>> @Override
>> - protected void configureHttpProtocol(Habitat habitat,
>> - Http http, FilterChain filterChain) {
>> + protected void configureHttpProtocol(final Habitat habitat,
>> + final NetworkListener networkListener,
>> + final Http http, final FilterChainBuilder
>> filterChainBuilder) {
>> registerMonitoringStatsProviders();
>>
>> final V3Mapper mapper = new V3Mapper(logger);
>> @@ -165,7 +177,7 @@
>> Inhabitant<Mapper> onePortMapper = new
>> ExistingSingletonInhabitant<Mapper>(mapper);
>> grizzlyService.getHabitat().addIndex(onePortMapper,
>> Mapper.class.getName(), address.toString() + port);
>>
>> - super.configureHttpProtocol(habitat, http, filterChain);
>> + super.configureHttpProtocol(habitat, networkListener, http,
>> filterChainBuilder);
>> final Protocol protocol = http.getParent();
>> for (NetworkListener listener :
>> protocol.findNetworkListeners()) {
>> grizzlyService.notifyMapperUpdateListeners(listener,
>> mapper);
>> @@ -178,15 +190,6 @@
>> }
>>
>> @Override
>> - protected void configureTransport(Habitat habitat, Transport
>> transportConfig) {
>> -
>> - super.configureTransport(habitat, transportConfig);
>> - transport.getConnectionMonitoringConfig().addProbes(new
>> ConnectionMonitor(
>> - grizzlyService.getMonitoring(), name, transport));
>> - }
>> -
>> -
>> - @Override
>> protected KeepAlive configureKeepAlive(Habitat habitat, Http
>> http) {
>> final KeepAlive keepAlive =
>> super.configureKeepAlive(habitat, http);
>> keepAlive.getMonitoringConfig().addProbes(new
>> KeepAliveMonitor(
>> @@ -206,10 +209,12 @@
>> }
>>
>> @Override
>> - protected ThreadPoolConfig configureThreadPoolConfig(Habitat
>> habitat,
>> - ThreadPool threadPool) {
>> + protected ThreadPoolConfig configureThreadPoolConfig(final
>> Habitat habitat,
>> + final NetworkListener networkListener,
>> + final ThreadPool threadPool) {
>>
>> - final ThreadPoolConfig config =
>> super.configureThreadPoolConfig(habitat, threadPool);
>> + final ThreadPoolConfig config =
>> super.configureThreadPoolConfig(habitat,
>> + networkListener, threadPool);
>> config.getInitialMonitoringConfig().addProbes(new
>> ThreadPoolMonitor(
>> grizzlyService.getMonitoring(), name, config));
>> return config;
>> Index:
>> branches/grizzly20/core/kernel/src/main/java/com/sun/enterprise/v3/services/impl/ServiceInitializerListener.java
>> ===================================================================
>> ---
>> branches/grizzly20/core/kernel/src/main/java/com/sun/enterprise/v3/services/impl/ServiceInitializerListener.java
>> (revision 45599)
>> +++
>> branches/grizzly20/core/kernel/src/main/java/com/sun/enterprise/v3/services/impl/ServiceInitializerListener.java
>> (revision 45600)
>> @@ -1,7 +1,7 @@
>> /*
>> * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
>> *
>> - * Copyright (c) 2007-2010 Oracle and/or its affiliates. All rights
>> reserved.
>> + * Copyright (c) 2007-2011 Oracle and/or its affiliates. All rights
>> reserved.
>> *
>> * The contents of this file are subject to the terms of either the
>> GNU
>> * General Public License Version 2 only ("GPL") or the Common
>> Development
>> @@ -40,11 +40,11 @@
>> package com.sun.enterprise.v3.services.impl;
>>
>> import java.util.logging.Logger;
>> +import org.glassfish.grizzly.config.dom.NetworkListener;
>>
>> import org.glassfish.grizzly.config.dom.Protocol;
>> import org.glassfish.grizzly.config.dom.ThreadPool;
>> import org.glassfish.grizzly.config.dom.Transport;
>> -import org.glassfish.grizzly.filterchain.FilterChain;
>> import org.glassfish.grizzly.filterchain.FilterChainBuilder;
>> import org.glassfish.grizzly.nio.transport.TCPNIOTransportBuilder;
>> import org.glassfish.grizzly.threadpool.GrizzlyExecutorService;
>> @@ -70,7 +70,9 @@
>>
>> @Override
>> protected void configureTransport(final Habitat habitat,
>> - Transport transportConfig) {
>> + final NetworkListener networkListener,
>> + final Transport transportConfig,
>> + final FilterChainBuilder filterChainBuilder) {
>>
>> transport = TCPNIOTransportBuilder.newInstance().build();
>>
>> @@ -82,12 +84,15 @@
>>
>> @Override
>> protected void configureProtocol(final Habitat habitat,
>> - final Protocol protocol, final FilterChain filterChain) {
>> - filterChain.add(new ServiceInitializerFilter(this,
>> grizzlyService.getHabitat(), logger));
>> + final NetworkListener networkListener,
>> + final Protocol protocol, final FilterChainBuilder
>> filterChainBuilder) {
>> + filterChainBuilder.add(new ServiceInitializerFilter(this,
>> + grizzlyService.getHabitat(), logger));
>> }
>>
>> @Override
>> protected void configureThreadPool(final Habitat habitat,
>> + final NetworkListener networkListener,
>> final ThreadPool threadPool) {
>>
>> transport.setWorkerThreadPool(GrizzlyExecutorService.createInstance(
>> ThreadPoolConfig.defaultConfig()));
>> Index: branches/grizzly20/pom.xml
>> ===================================================================
>> --- branches/grizzly20/pom.xml (revision 45599)
>> +++ branches/grizzly20/pom.xml (revision 45600)
>> @@ -109,7 +109,7 @@
>> <jsf-ext.version>0.2</jsf-ext.version>
>> <woodstock.version>4.0.2.6</woodstock.version>
>> <jaxrpc-api.version>1.1</jaxrpc-api.version>
>> -<grizzly.version>2.0.1-b2</grizzly.version>
>> +<grizzly.version>2.0.1-SNAPSHOT</grizzly.version>
>> <jsr181-api.version>1.0-MR1</jsr181-api.version>
>> <saaj-api.version>1.3</saaj-api.version>
>> <hk2.version>1.1.0</hk2.version>
>> @@ -850,6 +850,11 @@
>> <version>${grizzly.version}</version>
>> </dependency>
>>
>> +<dependency>
>> +<groupId>org.glassfish.grizzly</groupId>
>> +<artifactId>grizzly-http-ajp</artifactId>
>> +<version>${grizzly.version}</version>
>> +</dependency>
>> <!--<dependency>
>> <groupId>org.glassfish.grizzly</groupId>
>> <artifactId>grizzly-messagesbus</artifactId>
>> Index:
>> branches/grizzly20/web/web-core/src/main/java/org/apache/catalina/connector/CoyoteAdapter.java
>> ===================================================================
>> ---
>> branches/grizzly20/web/web-core/src/main/java/org/apache/catalina/connector/CoyoteAdapter.java
>> (revision 45599)
>> +++
>> branches/grizzly20/web/web-core/src/main/java/org/apache/catalina/connector/CoyoteAdapter.java
>> (revision 45600)
>> @@ -208,9 +208,7 @@
>>
>> // Create objects
>> request = (Request) connector.createRequest();
>> - request.setCoyoteRequest(req);
>> response = (Response) connector.createResponse();
>> - response.setCoyoteResponse(res);
>>
>> // Link objects
>> request.setResponse(response);
>> @@ -225,6 +223,9 @@
>>
>> req.getRequest().getRequestURIRef().setDefaultURIEncoding(Charset.forName(connector.getURIEncoding()));
>> }
>>
>> + request.setCoyoteRequest(req);
>> + response.setCoyoteResponse(res);
>> +
>> if (v3Enabled&& !compatWithTomcat) {
>> request.setMappingData(md);
>> request.updatePaths(md);
>> Index: branches/grizzly20/web/webtier-all/pom.xml
>> ===================================================================
>> --- branches/grizzly20/web/webtier-all/pom.xml (revision 45599)
>> +++ branches/grizzly20/web/webtier-all/pom.xml (revision 45600)
>> @@ -112,11 +112,11 @@
>> <artifactId>gf-web-connector</artifactId>
>> <version>${project.version}</version>
>> </dependency>
>> -<dependency>
>> +<!--<dependency>
>> <groupId>org.glassfish.web</groupId>
>> <artifactId>web-ajp</artifactId>
>> <version>${project.version}</version>
>> - </dependency>
>> + </dependency> -->
>> <dependency>
>> <groupId>org.glassfish.web</groupId>
>> <artifactId>web-embed-api</artifactId>
>> Index: branches/grizzly20/packager/glassfish-grizzly-full/pom.xml
>> ===================================================================
>> --- branches/grizzly20/packager/glassfish-grizzly-full/pom.xml
>> (revision 45599)
>> +++ branches/grizzly20/packager/glassfish-grizzly-full/pom.xml
>> (revision 45600)
>> @@ -92,6 +92,10 @@
>> <groupId>org.glassfish.grizzly</groupId>
>> <artifactId>grizzly-http-servlet</artifactId>
>> </dependency>
>> +<dependency>
>> +<groupId>org.glassfish.grizzly</groupId>
>> + <artifactId>grizzly-http-ajp</artifactId>
>> +</dependency>
>> <!-- previous package - required for dependency graph calculation -->
>> <dependency>
>> <groupId>org.glassfish.packager</groupId>
>> Index:
>> branches/grizzly20/common/container-common/src/main/java/org/glassfish/javaee/services/WebSocketsAsyncFilterProvider.java
>> ===================================================================
>> ---
>> branches/grizzly20/common/container-common/src/main/java/org/glassfish/javaee/services/WebSocketsAsyncFilterProvider.java
>> (revision 45599)
>> +++
>> branches/grizzly20/common/container-common/src/main/java/org/glassfish/javaee/services/WebSocketsAsyncFilterProvider.java
>> (revision 45600)
>> @@ -1,56 +0,0 @@
>> -/*
>> - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
>> - *
>> - * Copyright (c) 2009-2010 Oracle and/or its affiliates. All rights
>> reserved.
>> - *
>> - * The contents of this file are subject to the terms of either the GNU
>> - * General Public License Version 2 only ("GPL") or the Common
>> Development
>> - * and Distribution License("CDDL") (collectively, the "License"). You
>> - * may not use this file except in compliance with the License. You
>> can
>> - * obtain a copy of the License at
>> - * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
>> - * or packager/legal/LICENSE.txt. See the License for the specific
>> - * language governing permissions and limitations under the License.
>> - *
>> - * When distributing the software, include this License Header
>> Notice in each
>> - * file and include the License file at packager/legal/LICENSE.txt.
>> - *
>> - * GPL Classpath Exception:
>> - * Oracle designates this particular file as subject to the "Classpath"
>> - * exception as provided by Oracle in the GPL Version 2 section of
>> the License
>> - * file that accompanied this code.
>> - *
>> - * Modifications:
>> - * If applicable, add the following below the License Header, with
>> the fields
>> - * enclosed by brackets [] replaced by your own identifying
>> information:
>> - * "Portions Copyright [year] [name of copyright owner]"
>> - *
>> - * Contributor(s):
>> - * If you wish your version of this file to be governed by only the
>> CDDL or
>> - * only the GPL Version 2, indicate your decision by adding
>> "[Contributor]
>> - * elects to include this software in this distribution under the
>> [CDDL or GPL
>> - * Version 2] license." If you don't indicate a single choice of
>> license, a
>> - * recipient has the option to distribute your version of this file
>> under
>> - * either the CDDL, the GPL Version 2 or to extend the choice of
>> license to
>> - * its licensees as provided above. However, if you add GPL Version
>> 2 code
>> - * and therefore, elected the GPL Version 2 license, then the option
>> applies
>> - * only if the new code is made subject to such option by the copyright
>> - * holder.
>> - */
>> -
>> -package org.glassfish.javaee.services;
>> -
>> -import org.jvnet.hk2.annotations.Service;
>> -import org.jvnet.hk2.annotations.ContractProvided;
>> -
>> -/**
>> - * Websockets service.
>> - *
>> - * @Author Alexey Stashok
>> - */
>> -_at_Service(name="websockets")
>> -//_at_ContractProvided(AsyncFilter.class)
>> -public class WebSocketsAsyncFilterProvider {
>> -// extends WebSocketAsyncFilter {
>> -
>> -}
>> Index:
>> branches/grizzly20/common/container-common/src/main/java/org/glassfish/javaee/services/WebSocketAddOnProvider.java
>> ===================================================================
>> ---
>> branches/grizzly20/common/container-common/src/main/java/org/glassfish/javaee/services/WebSocketAddOnProvider.java
>> (revision 0)
>> +++
>> branches/grizzly20/common/container-common/src/main/java/org/glassfish/javaee/services/WebSocketAddOnProvider.java
>> (revision 45600)
>> @@ -0,0 +1,56 @@
>> +/*
>> + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
>> + *
>> + * Copyright (c) 2009-2011 Oracle and/or its affiliates. All rights
>> reserved.
>> + *
>> + * The contents of this file are subject to the terms of either the GNU
>> + * General Public License Version 2 only ("GPL") or the Common
>> Development
>> + * and Distribution License("CDDL") (collectively, the "License"). You
>> + * may not use this file except in compliance with the License. You
>> can
>> + * obtain a copy of the License at
>> + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
>> + * or packager/legal/LICENSE.txt. See the License for the specific
>> + * language governing permissions and limitations under the License.
>> + *
>> + * When distributing the software, include this License Header
>> Notice in each
>> + * file and include the License file at packager/legal/LICENSE.txt.
>> + *
>> + * GPL Classpath Exception:
>> + * Oracle designates this particular file as subject to the "Classpath"
>> + * exception as provided by Oracle in the GPL Version 2 section of
>> the License
>> + * file that accompanied this code.
>> + *
>> + * Modifications:
>> + * If applicable, add the following below the License Header, with
>> the fields
>> + * enclosed by brackets [] replaced by your own identifying
>> information:
>> + * "Portions Copyright [year] [name of copyright owner]"
>> + *
>> + * Contributor(s):
>> + * If you wish your version of this file to be governed by only the
>> CDDL or
>> + * only the GPL Version 2, indicate your decision by adding
>> "[Contributor]
>> + * elects to include this software in this distribution under the
>> [CDDL or GPL
>> + * Version 2] license." If you don't indicate a single choice of
>> license, a
>> + * recipient has the option to distribute your version of this file
>> under
>> + * either the CDDL, the GPL Version 2 or to extend the choice of
>> license to
>> + * its licensees as provided above. However, if you add GPL Version
>> 2 code
>> + * and therefore, elected the GPL Version 2 license, then the option
>> applies
>> + * only if the new code is made subject to such option by the copyright
>> + * holder.
>> + */
>> +
>> +package org.glassfish.javaee.services;
>> +
>> +import org.glassfish.grizzly.http.server.AddOn;
>> +import org.glassfish.grizzly.websockets.WebSocketAddOn;
>> +import org.jvnet.hk2.annotations.ContractProvided;
>> +import org.jvnet.hk2.annotations.Service;
>> +
>> +/**
>> + * Websocket service.
>> + *
>> + * @author Alexey Stashok
>> + */
>> +_at_Service(name="websocket")
>> +_at_ContractProvided(AddOn.class)
>> +public class WebSocketAddOnProvider extends WebSocketAddOn {
>> +}
>>
>> Property changes on:
>> branches/grizzly20/common/container-common/src/main/java/org/glassfish/javaee/services/WebSocketAddOnProvider.java
>> ___________________________________________________________________
>> Added: svn:eol-style
>> + native
>>
>> Index:
>> branches/grizzly20/common/container-common/src/main/java/org/glassfish/javaee/services/CometAddOnProvider.java
>> ===================================================================
>> ---
>> branches/grizzly20/common/container-common/src/main/java/org/glassfish/javaee/services/CometAddOnProvider.java
>> (revision 0)
>> +++
>> branches/grizzly20/common/container-common/src/main/java/org/glassfish/javaee/services/CometAddOnProvider.java
>> (revision 45600)
>> @@ -0,0 +1,56 @@
>> +/*
>> + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
>> + *
>> + * Copyright (c) 2009-2011 Oracle and/or its affiliates. All rights
>> reserved.
>> + *
>> + * The contents of this file are subject to the terms of either the GNU
>> + * General Public License Version 2 only ("GPL") or the Common
>> Development
>> + * and Distribution License("CDDL") (collectively, the "License"). You
>> + * may not use this file except in compliance with the License. You
>> can
>> + * obtain a copy of the License at
>> + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
>> + * or packager/legal/LICENSE.txt. See the License for the specific
>> + * language governing permissions and limitations under the License.
>> + *
>> + * When distributing the software, include this License Header
>> Notice in each
>> + * file and include the License file at packager/legal/LICENSE.txt.
>> + *
>> + * GPL Classpath Exception:
>> + * Oracle designates this particular file as subject to the "Classpath"
>> + * exception as provided by Oracle in the GPL Version 2 section of
>> the License
>> + * file that accompanied this code.
>> + *
>> + * Modifications:
>> + * If applicable, add the following below the License Header, with
>> the fields
>> + * enclosed by brackets [] replaced by your own identifying
>> information:
>> + * "Portions Copyright [year] [name of copyright owner]"
>> + *
>> + * Contributor(s):
>> + * If you wish your version of this file to be governed by only the
>> CDDL or
>> + * only the GPL Version 2, indicate your decision by adding
>> "[Contributor]
>> + * elects to include this software in this distribution under the
>> [CDDL or GPL
>> + * Version 2] license." If you don't indicate a single choice of
>> license, a
>> + * recipient has the option to distribute your version of this file
>> under
>> + * either the CDDL, the GPL Version 2 or to extend the choice of
>> license to
>> + * its licensees as provided above. However, if you add GPL Version
>> 2 code
>> + * and therefore, elected the GPL Version 2 license, then the option
>> applies
>> + * only if the new code is made subject to such option by the copyright
>> + * holder.
>> + */
>> +
>> +package org.glassfish.javaee.services;
>> +
>> +import org.glassfish.grizzly.comet.CometAddOn;
>> +import org.glassfish.grizzly.http.server.AddOn;
>> +import org.jvnet.hk2.annotations.ContractProvided;
>> +import org.jvnet.hk2.annotations.Service;
>> +
>> +/**
>> + * Comet service.
>> + *
>> + * @author Alexey Stashok
>> + */
>> +_at_Service(name="comet")
>> +_at_ContractProvided(AddOn.class)
>> +public class CometAddOnProvider extends CometAddOn {
>> +}
>> Index:
>> branches/grizzly20/common/container-common/src/main/java/org/glassfish/javaee/services/AjpAddOnProvider.java
>> ===================================================================
>> ---
>> branches/grizzly20/common/container-common/src/main/java/org/glassfish/javaee/services/AjpAddOnProvider.java
>> (revision 0)
>> +++
>> branches/grizzly20/common/container-common/src/main/java/org/glassfish/javaee/services/AjpAddOnProvider.java
>> (revision 45600)
>> @@ -0,0 +1,144 @@
>> +/*
>> + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
>> + *
>> + * Copyright (c) 2009-2011 Oracle and/or its affiliates. All rights
>> reserved.
>> + *
>> + * The contents of this file are subject to the terms of either the GNU
>> + * General Public License Version 2 only ("GPL") or the Common
>> Development
>> + * and Distribution License("CDDL") (collectively, the "License"). You
>> + * may not use this file except in compliance with the License. You
>> can
>> + * obtain a copy of the License at
>> + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
>> + * or packager/legal/LICENSE.txt. See the License for the specific
>> + * language governing permissions and limitations under the License.
>> + *
>> + * When distributing the software, include this License Header
>> Notice in each
>> + * file and include the License file at packager/legal/LICENSE.txt.
>> + *
>> + * GPL Classpath Exception:
>> + * Oracle designates this particular file as subject to the "Classpath"
>> + * exception as provided by Oracle in the GPL Version 2 section of
>> the License
>> + * file that accompanied this code.
>> + *
>> + * Modifications:
>> + * If applicable, add the following below the License Header, with
>> the fields
>> + * enclosed by brackets [] replaced by your own identifying
>> information:
>> + * "Portions Copyright [year] [name of copyright owner]"
>> + *
>> + * Contributor(s):
>> + * If you wish your version of this file to be governed by only the
>> CDDL or
>> + * only the GPL Version 2, indicate your decision by adding
>> "[Contributor]
>> + * elects to include this software in this distribution under the
>> [CDDL or GPL
>> + * Version 2] license." If you don't indicate a single choice of
>> license, a
>> + * recipient has the option to distribute your version of this file
>> under
>> + * either the CDDL, the GPL Version 2 or to extend the choice of
>> license to
>> + * its licensees as provided above. However, if you add GPL Version
>> 2 code
>> + * and therefore, elected the GPL Version 2 license, then the option
>> applies
>> + * only if the new code is made subject to such option by the copyright
>> + * holder.
>> + */
>> +package org.glassfish.javaee.services;
>> +
>> +import com.sun.logging.LogDomains;
>> +import java.io.BufferedInputStream;
>> +import java.io.File;
>> +import java.io.FileInputStream;
>> +import java.io.IOException;
>> +import java.io.InputStream;
>> +import java.util.Properties;
>> +import java.util.logging.Level;
>> +import java.util.logging.Logger;
>> +import org.glassfish.grizzly.config.ConfigAwareElement;
>> +import org.glassfish.grizzly.config.dom.Http;
>> +import org.glassfish.grizzly.config.dom.NetworkListener;
>> +import org.glassfish.grizzly.http.ajp.AjpAddOn;
>> +import org.glassfish.grizzly.http.server.AddOn;
>> +import org.jvnet.hk2.annotations.ContractProvided;
>> +import org.jvnet.hk2.annotations.Service;
>> +import org.jvnet.hk2.component.Habitat;
>> +
>> +/**
>> + * Ajp service.
>> + *
>> + * @author Alexey Stashok
>> + */
>> +_at_Service(name = "ajp")
>> +_at_ContractProvided(AddOn.class)
>> +public class AjpAddOnProvider extends AjpAddOn implements
>> ConfigAwareElement<Http> {
>> +
>> + protected static final Logger _logger = LogDomains.getLogger(
>> + AjpAddOnProvider.class, LogDomains.WEB_LOGGER);
>> +
>> + @Override
>> + public void configure(final Habitat habitat,
>> + final NetworkListener networkListener, final Http http) {
>> +
>> + final boolean jkSupportEnabled = http.getJkEnabled() != null
>> + ? Boolean.parseBoolean(http.getJkEnabled())
>> + : Boolean.parseBoolean(networkListener.getJkEnabled());
>> + if (jkSupportEnabled) {
>> + final String jkPropertiesFilename =
>> + Boolean.parseBoolean(http.getJkEnabled())
>> + ? http.getJkConfigurationFile()
>> + : networkListener.getJkConfigurationFile();
>> +
>> + File propertiesFile = null;
>> +
>> + if (jkPropertiesFilename != null) {
>> + propertiesFile = new File(jkPropertiesFilename);
>> + }
>> +
>> +
>> + final String systemPropertyFilename =
>> +
>> System.getProperty("com.sun.enterprise.web.connector.enableJK.propertyFile");
>> +
>> + if ((propertiesFile == null
>> + || (propertiesFile != null&&
>> !propertiesFile.exists()))
>> +&& systemPropertyFilename != null) {
>> + propertiesFile = new File(systemPropertyFilename);
>> + }
>> +
>> + if (propertiesFile == null) {
>> + if (_logger.isLoggable(Level.FINEST)) {
>> + _logger.finest("jk properties configuration file
>> not defined");
>> + }
>> + return;
>> + }
>> +
>> + if (!propertiesFile.exists()) {
>> + if (_logger.isLoggable(Level.FINEST)) {
>> + _logger.log(Level.FINEST,
>> + "jk properties configuration file '{0}'
>> doesn't exist",
>> + propertiesFile.getAbsoluteFile());
>> + }
>> + return;
>> + }
>> +
>> + if (_logger.isLoggable(Level.FINEST)) {
>> + _logger.log(Level.FINEST, "Loading
>> glassfish-jk.properties from {0}",
>> + propertiesFile.getAbsolutePath());
>> + }
>> +
>> + Properties properties = null;
>> +
>> + InputStream is = null;
>> + try {
>> + is = new BufferedInputStream(new
>> FileInputStream(propertiesFile));
>> + properties = new Properties();
>> + properties.load(is);
>> +
>> + } catch (Exception ex) {
>> + throw new IllegalStateException(ex);
>> + } finally {
>> + if (is != null) {
>> + try {
>> + is.close();
>> + } catch (IOException ioe) {
>> + }
>> + }
>> + }
>> +
>> + configure(properties);
>> + }
>> + }
>> +}
>> Index: branches/grizzly20/common/container-common/pom.xml
>> ===================================================================
>> --- branches/grizzly20/common/container-common/pom.xml (revision
>> 45599)
>> +++ branches/grizzly20/common/container-common/pom.xml (revision
>> 45600)
>> @@ -155,6 +155,10 @@
>> <artifactId>grizzly-websockets</artifactId>
>> </dependency>
>> <dependency>
>> +<groupId>org.glassfish.grizzly</groupId>
>> +<artifactId>grizzly-http-ajp</artifactId>
>> +</dependency>
>> +<dependency>
>> <groupId>junit</groupId>
>> <artifactId>junit</artifactId>
>> <scope>test</scope>
>>
>>
>>