01: /*
02: * Copyright 2005 Joe Walker
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.directwebremoting.impl;
17:
18: import javax.servlet.ServletConfig;
19: import javax.servlet.http.HttpServletRequest;
20:
21: import org.directwebremoting.extend.ContainerAbstraction;
22: import org.directwebremoting.extend.ServerLoadMonitor;
23: import org.directwebremoting.extend.Sleeper;
24:
25: /**
26: * An abstraction of the servlet container that is specific to Grizzly
27: * @author Joe Walker [joe at getahead dot ltd dot uk]
28: */
29: public class GrizzlyContainerAbstraction implements
30: ContainerAbstraction {
31: /* (non-Javadoc)
32: * @see org.directwebremoting.dwrp.ContainerAbstraction#isNativeEnvironment(javax.servlet.ServletConfig)
33: */
34: public boolean isNativeEnvironment(ServletConfig servletConfig) {
35: String serverInfo = servletConfig.getServletContext()
36: .getServerInfo();
37: if (serverInfo
38: .startsWith("Sun Java System Application Server ")) {
39: // TODO: some number versioning
40: return true;
41: }
42:
43: return false;
44: }
45:
46: /* (non-Javadoc)
47: * @see org.directwebremoting.dwrp.ContainerAbstraction#createSleeper(javax.servlet.http.HttpServletRequest)
48: */
49: public Sleeper createSleeper(HttpServletRequest request) {
50: return new GrizzlyContinuationSleeper(request);
51: }
52:
53: /* (non-Javadoc)
54: * @see org.directwebremoting.dwrp.ContainerAbstraction#getServerLoadMonitorImplementation()
55: */
56: public Class<? extends ServerLoadMonitor> getServerLoadMonitorImplementation() {
57: return ThreadDroppingServerLoadMonitor.class;
58: }
59: }
|