001: /*
002: * Copyright 1999-2004 The Apache Software Foundation
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016:
017: package org.apache.coyote.http11;
018:
019: import java.io.IOException;
020: import java.io.InputStream;
021: import java.io.OutputStream;
022: import java.net.InetAddress;
023: import java.net.Socket;
024: import java.net.URLEncoder;
025: import java.util.Enumeration;
026: import java.util.Hashtable;
027:
028: import javax.management.MBeanRegistration;
029: import javax.management.MBeanServer;
030: import javax.management.ObjectName;
031:
032: import org.apache.commons.modeler.Registry;
033: import org.apache.coyote.ActionCode;
034: import org.apache.coyote.ActionHook;
035: import org.apache.coyote.Adapter;
036: import org.apache.coyote.ProtocolHandler;
037: import org.apache.coyote.RequestGroupInfo;
038: import org.apache.coyote.RequestInfo;
039: import org.apache.tomcat.util.net.PoolTcpEndpoint;
040: import org.apache.tomcat.util.net.SSLImplementation;
041: import org.apache.tomcat.util.net.SSLSupport;
042: import org.apache.tomcat.util.net.ServerSocketFactory;
043: import org.apache.tomcat.util.net.TcpConnection;
044: import org.apache.tomcat.util.net.TcpConnectionHandler;
045: import org.apache.tomcat.util.res.StringManager;
046: import org.apache.tomcat.util.threads.ThreadPool;
047: import org.apache.tomcat.util.threads.ThreadWithAttributes;
048:
049: /**
050: * Abstract the protocol implementation, including threading, etc.
051: * Processor is single threaded and specific to stream-based protocols,
052: * will not fit Jk protocols like JNI.
053: *
054: * @author Remy Maucherat
055: * @author Costin Manolache
056: */
057: public class Http11Protocol implements ProtocolHandler,
058: MBeanRegistration {
059: public Http11Protocol() {
060: cHandler = new Http11ConnectionHandler(this );
061: setSoLinger(Constants.DEFAULT_CONNECTION_LINGER);
062: setSoTimeout(Constants.DEFAULT_CONNECTION_TIMEOUT);
063: setServerSoTimeout(Constants.DEFAULT_SERVER_SOCKET_TIMEOUT);
064: setTcpNoDelay(Constants.DEFAULT_TCP_NO_DELAY);
065: }
066:
067: /**
068: * The string manager for this package.
069: */
070: protected static StringManager sm = StringManager
071: .getManager(Constants.Package);
072:
073: /** Pass config info
074: */
075: public void setAttribute(String name, Object value) {
076: if (log.isTraceEnabled())
077: log.trace(sm.getString("http11protocol.setattribute", name,
078: value));
079:
080: attributes.put(name, value);
081: }
082:
083: public Object getAttribute(String key) {
084: if (log.isTraceEnabled())
085: log.trace(sm.getString("http11protocol.getattribute", key));
086: return attributes.get(key);
087: }
088:
089: /**
090: * Set a property.
091: */
092: public void setProperty(String name, String value) {
093: setAttribute(name, value);
094: }
095:
096: /**
097: * Get a property
098: */
099: public String getProperty(String name) {
100: return (String) getAttribute(name);
101: }
102:
103: /** The adapter, used to call the connector
104: */
105: public void setAdapter(Adapter adapter) {
106: this .adapter = adapter;
107: }
108:
109: public Adapter getAdapter() {
110: return adapter;
111: }
112:
113: /** Start the protocol
114: */
115: public void init() throws Exception {
116: ep.setConnectionHandler(cHandler);
117: try {
118: checkSocketFactory();
119: } catch (Exception ex) {
120: log
121: .error(
122: sm
123: .getString("http11protocol.socketfactory.initerror"),
124: ex);
125: throw ex;
126: }
127:
128: if (socketFactory != null) {
129: Enumeration attE = attributes.keys();
130: while (attE.hasMoreElements()) {
131: String key = (String) attE.nextElement();
132: Object v = attributes.get(key);
133: socketFactory.setAttribute(key, v);
134: }
135: }
136:
137: // XXX get domain from registration
138: try {
139: ep.initEndpoint();
140: } catch (Exception ex) {
141: log.error(
142: sm.getString("http11protocol.endpoint.initerror"),
143: ex);
144: throw ex;
145: }
146: log.info(sm.getString("http11protocol.init", getName()));
147:
148: }
149:
150: ObjectName tpOname;
151: ObjectName rgOname;
152:
153: public void start() throws Exception {
154: if (this .domain != null) {
155: try {
156: // XXX We should be able to configure it separately
157: // XXX It should be possible to use a single TP
158: tpOname = new ObjectName(domain + ":"
159: + "type=ThreadPool,name=" + getName());
160: Registry.getRegistry(null, null).registerComponent(tp,
161: tpOname, null);
162: tp.setName(getName());
163: tp.setDaemon(false);
164: tp.addThreadPoolListener(new MXPoolListener(this , tp));
165: } catch (Exception e) {
166: log.error("Can't register threadpool");
167: }
168: rgOname = new ObjectName(domain
169: + ":type=GlobalRequestProcessor,name=" + getName());
170: Registry.getRegistry(null, null).registerComponent(
171: cHandler.global, rgOname, null);
172: }
173:
174: try {
175: ep.startEndpoint();
176: } catch (Exception ex) {
177: log.error(sm
178: .getString("http11protocol.endpoint.starterror"),
179: ex);
180: throw ex;
181: }
182: log.info(sm.getString("http11protocol.start", getName()));
183: }
184:
185: public void pause() throws Exception {
186: try {
187: ep.pauseEndpoint();
188: } catch (Exception ex) {
189: log.error(sm
190: .getString("http11protocol.endpoint.pauseerror"),
191: ex);
192: throw ex;
193: }
194: log.info(sm.getString("http11protocol.pause", getName()));
195: }
196:
197: public void resume() throws Exception {
198: try {
199: ep.resumeEndpoint();
200: } catch (Exception ex) {
201: log.error(sm
202: .getString("http11protocol.endpoint.resumeerror"),
203: ex);
204: throw ex;
205: }
206: log.info(sm.getString("http11protocol.resume", getName()));
207: }
208:
209: public void destroy() throws Exception {
210: log.info(sm.getString("http11protocol.stop", getName()));
211: ep.stopEndpoint();
212: if (tpOname != null)
213: Registry.getRegistry(null, null).unregisterComponent(
214: tpOname);
215: if (rgOname != null)
216: Registry.getRegistry(null, null).unregisterComponent(
217: rgOname);
218: }
219:
220: // -------------------- Properties--------------------
221: protected ThreadPool tp = ThreadPool.createThreadPool(true);
222: protected PoolTcpEndpoint ep = new PoolTcpEndpoint(tp);
223: protected boolean secure;
224:
225: protected ServerSocketFactory socketFactory;
226: protected SSLImplementation sslImplementation;
227: // socket factory attriubtes ( XXX replace with normal setters )
228: protected Hashtable attributes = new Hashtable();
229: protected String socketFactoryName = null;
230: protected String sslImplementationName = null;
231:
232: private int maxKeepAliveRequests = 100; // as in Apache HTTPD server
233: private int timeout = 300000; // 5 minutes as in Apache HTTPD server
234: private int maxPostSize = 2 * 1024 * 1024;
235: private int maxHttpHeaderSize = 4 * 1024;
236: private String reportedname;
237: private int socketCloseDelay = -1;
238: private boolean disableUploadTimeout = true;
239: private int socketBuffer = 9000;
240: private Adapter adapter;
241: private Http11ConnectionHandler cHandler;
242:
243: /**
244: * Compression value.
245: */
246: private String compression = "off";
247: private String noCompressionUserAgents = null;
248: private String restrictedUserAgents = null;
249: private String compressableMimeTypes = "text/html,text/xml,text/plain";
250: private int compressionMinSize = 2048;
251:
252: // -------------------- Pool setup --------------------
253:
254: public boolean getPools() {
255: return ep.isPoolOn();
256: }
257:
258: public void setPools(boolean t) {
259: ep.setPoolOn(t);
260: setAttribute("pools", "" + t);
261: }
262:
263: public int getMaxThreads() {
264: return ep.getMaxThreads();
265: }
266:
267: public void setMaxThreads(int maxThreads) {
268: ep.setMaxThreads(maxThreads);
269: setAttribute("maxThreads", "" + maxThreads);
270: }
271:
272: public int getMaxSpareThreads() {
273: return ep.getMaxSpareThreads();
274: }
275:
276: public void setMaxSpareThreads(int maxThreads) {
277: ep.setMaxSpareThreads(maxThreads);
278: setAttribute("maxSpareThreads", "" + maxThreads);
279: }
280:
281: public int getMinSpareThreads() {
282: return ep.getMinSpareThreads();
283: }
284:
285: public void setMinSpareThreads(int minSpareThreads) {
286: ep.setMinSpareThreads(minSpareThreads);
287: setAttribute("minSpareThreads", "" + minSpareThreads);
288: }
289:
290: public void setThreadPriority(int threadPriority) {
291: ep.setThreadPriority(threadPriority);
292: setAttribute("threadPriority", "" + threadPriority);
293: }
294:
295: public int getThreadPriority() {
296: return ep.getThreadPriority();
297: }
298:
299: // -------------------- Tcp setup --------------------
300:
301: public int getBacklog() {
302: return ep.getBacklog();
303: }
304:
305: public void setBacklog(int i) {
306: ep.setBacklog(i);
307: setAttribute("backlog", "" + i);
308: }
309:
310: public int getPort() {
311: return ep.getPort();
312: }
313:
314: public void setPort(int port) {
315: ep.setPort(port);
316: setAttribute("port", "" + port);
317: //this.port=port;
318: }
319:
320: public InetAddress getAddress() {
321: return ep.getAddress();
322: }
323:
324: public void setAddress(InetAddress ia) {
325: ep.setAddress(ia);
326: setAttribute("address", "" + ia);
327: }
328:
329: public String getName() {
330: String encodedAddr = "";
331: if (getAddress() != null) {
332: encodedAddr = "" + getAddress();
333: if (encodedAddr.startsWith("/"))
334: encodedAddr = encodedAddr.substring(1);
335: encodedAddr = URLEncoder.encode(encodedAddr) + "-";
336: }
337: return ("http-" + encodedAddr + ep.getPort());
338: }
339:
340: // commenting out for now since it's not doing anything
341: //public void setHostName( String name ) {
342: // ??? Doesn't seem to be used in existing or prev code
343: // vhost=name;
344: //}
345:
346: public String getSocketFactory() {
347: return socketFactoryName;
348: }
349:
350: public void setSocketFactory(String valueS) {
351: socketFactoryName = valueS;
352: setAttribute("socketFactory", valueS);
353: }
354:
355: public String getSSLImplementation() {
356: return sslImplementationName;
357: }
358:
359: public void setSSLImplementation(String valueS) {
360: sslImplementationName = valueS;
361: setAttribute("sslImplementation", valueS);
362: }
363:
364: public boolean getTcpNoDelay() {
365: return ep.getTcpNoDelay();
366: }
367:
368: public void setTcpNoDelay(boolean b) {
369: ep.setTcpNoDelay(b);
370: setAttribute("tcpNoDelay", "" + b);
371: }
372:
373: public boolean getDisableUploadTimeout() {
374: return disableUploadTimeout;
375: }
376:
377: public void setDisableUploadTimeout(boolean isDisabled) {
378: disableUploadTimeout = isDisabled;
379: }
380:
381: public int getSocketBuffer() {
382: return socketBuffer;
383: }
384:
385: public void setSocketBuffer(int valueI) {
386: socketBuffer = valueI;
387: }
388:
389: public String getCompression() {
390: return compression;
391: }
392:
393: public void setCompression(String valueS) {
394: compression = valueS;
395: setAttribute("compression", valueS);
396: }
397:
398: public int getMaxPostSize() {
399: return maxPostSize;
400: }
401:
402: public void setMaxPostSize(int valueI) {
403: maxPostSize = valueI;
404: setAttribute("maxPostSize", "" + valueI);
405: }
406:
407: public int getMaxHttpHeaderSize() {
408: return maxHttpHeaderSize;
409: }
410:
411: public void setMaxHttpHeaderSize(int valueI) {
412: maxHttpHeaderSize = valueI;
413: setAttribute("maxHttpHeaderSize", "" + valueI);
414: }
415:
416: public String getRestrictedUserAgents() {
417: return restrictedUserAgents;
418: }
419:
420: public void setRestrictedUserAgents(String valueS) {
421: restrictedUserAgents = valueS;
422: setAttribute("restrictedUserAgents", valueS);
423: }
424:
425: public String getNoCompressionUserAgents() {
426: return noCompressionUserAgents;
427: }
428:
429: public void setNoCompressionUserAgents(String valueS) {
430: noCompressionUserAgents = valueS;
431: setAttribute("noCompressionUserAgents", valueS);
432: }
433:
434: public String getCompressableMimeType() {
435: return compressableMimeTypes;
436: }
437:
438: public void setCompressableMimeType(String valueS) {
439: compressableMimeTypes = valueS;
440: setAttribute("compressableMimeTypes", valueS);
441: }
442:
443: public int getCompressionMinSize() {
444: return compressionMinSize;
445: }
446:
447: public void setCompressionMinSize(int valueI) {
448: compressionMinSize = valueI;
449: setAttribute("compressionMinSize", "" + valueI);
450: }
451:
452: public int getSoLinger() {
453: return ep.getSoLinger();
454: }
455:
456: public void setSoLinger(int i) {
457: ep.setSoLinger(i);
458: setAttribute("soLinger", "" + i);
459: }
460:
461: public int getSoTimeout() {
462: return ep.getSoTimeout();
463: }
464:
465: public void setSoTimeout(int i) {
466: ep.setSoTimeout(i);
467: setAttribute("soTimeout", "" + i);
468: }
469:
470: public int getServerSoTimeout() {
471: return ep.getServerSoTimeout();
472: }
473:
474: public void setServerSoTimeout(int i) {
475: ep.setServerSoTimeout(i);
476: setAttribute("serverSoTimeout", "" + i);
477: }
478:
479: public String getKeystore() {
480: return getProperty("keystore");
481: }
482:
483: public void setKeystore(String k) {
484: setAttribute("keystore", k);
485: }
486:
487: public String getKeypass() {
488: return getProperty("keypass");
489: }
490:
491: public void setKeypass(String k) {
492: attributes.put("keypass", k);
493: //setAttribute("keypass", k);
494: }
495:
496: public String getKeytype() {
497: return getProperty("keystoreType");
498: }
499:
500: public void setKeytype(String k) {
501: setAttribute("keystoreType", k);
502: }
503:
504: public String getClientauth() {
505: return getProperty("clientauth");
506: }
507:
508: public void setClientauth(String k) {
509: setAttribute("clientauth", k);
510: }
511:
512: public String getProtocol() {
513: return getProperty("protocol");
514: }
515:
516: public void setProtocol(String k) {
517: setAttribute("protocol", k);
518: }
519:
520: public String getProtocols() {
521: return getProperty("protocols");
522: }
523:
524: public void setProtocols(String k) {
525: setAttribute("protocols", k);
526: }
527:
528: public String getAlgorithm() {
529: return getProperty("algorithm");
530: }
531:
532: public void setAlgorithm(String k) {
533: setAttribute("algorithm", k);
534: }
535:
536: public boolean getSecure() {
537: return secure;
538: }
539:
540: public void setSecure(boolean b) {
541: secure = b;
542: setAttribute("secure", "" + b);
543: }
544:
545: public String getCiphers() {
546: return getProperty("ciphers");
547: }
548:
549: public void setCiphers(String ciphers) {
550: setAttribute("ciphers", ciphers);
551: }
552:
553: public String getKeyAlias() {
554: return getProperty("keyAlias");
555: }
556:
557: public void setKeyAlias(String keyAlias) {
558: setAttribute("keyAlias", keyAlias);
559: }
560:
561: public int getMaxKeepAliveRequests() {
562: return maxKeepAliveRequests;
563: }
564:
565: /** Set the maximum number of Keep-Alive requests that we will honor.
566: */
567: public void setMaxKeepAliveRequests(int mkar) {
568: maxKeepAliveRequests = mkar;
569: setAttribute("maxKeepAliveRequests", "" + mkar);
570: }
571:
572: public int getSocketCloseDelay() {
573: return socketCloseDelay;
574: }
575:
576: public void setSocketCloseDelay(int d) {
577: socketCloseDelay = d;
578: setAttribute("socketCloseDelay", "" + d);
579: }
580:
581: private static ServerSocketFactory string2SocketFactory(String val)
582: throws ClassNotFoundException, IllegalAccessException,
583: InstantiationException {
584: Class chC = Class.forName(val);
585: return (ServerSocketFactory) chC.newInstance();
586: }
587:
588: public int getTimeout() {
589: return timeout;
590: }
591:
592: public void setTimeout(int timeouts) {
593: timeout = timeouts * 1000;
594: setAttribute("timeout", "" + timeouts);
595: }
596:
597: public String getReportedname() {
598: return reportedname;
599: }
600:
601: public void setReportedname(String reportedName) {
602: reportedname = reportedName;
603: }
604:
605: // -------------------- Connection handler --------------------
606: public static final int THREAD_DATA_PROCESSOR = 1;
607: public static final int THREAD_DATA_OBJECT_NAME = 2;
608:
609: static class MXPoolListener implements
610: ThreadPool.ThreadPoolListener {
611: MXPoolListener(Http11Protocol proto, ThreadPool control) {
612:
613: }
614:
615: public void threadStart(ThreadPool tp, Thread t) {
616: }
617:
618: public void threadEnd(ThreadPool tp, Thread t) {
619: // Register our associated processor
620: // TP uses only TWA
621: ThreadWithAttributes ta = (ThreadWithAttributes) t;
622: Object tpData[] = ta.getThreadData(tp);
623: if (tpData == null)
624: return;
625: // Weird artifact - it should be cleaned up, but that may break something
626: // and it won't gain us too much
627: if (tpData[1] instanceof Object[]) {
628: tpData = (Object[]) tpData[1];
629: }
630: ObjectName oname = (ObjectName) tpData[Http11Protocol.THREAD_DATA_OBJECT_NAME];
631: if (oname == null)
632: return;
633: Registry.getRegistry(null, null).unregisterComponent(oname);
634: Http11Processor processor = (Http11Processor) tpData[Http11Protocol.THREAD_DATA_PROCESSOR];
635: RequestInfo rp = processor.getRequest()
636: .getRequestProcessor();
637: rp.setGlobalProcessor(null);
638: }
639: }
640:
641: static class Http11ConnectionHandler implements
642: TcpConnectionHandler {
643: Http11Protocol proto;
644: static int count = 0;
645: RequestGroupInfo global = new RequestGroupInfo();
646:
647: Http11ConnectionHandler(Http11Protocol proto) {
648: this .proto = proto;
649: }
650:
651: public void setAttribute(String name, Object value) {
652: }
653:
654: public void setServer(Object o) {
655: }
656:
657: public Object[] init() {
658: Object thData[] = new Object[3];
659:
660: Http11Processor processor = new Http11Processor(
661: proto.maxHttpHeaderSize);
662: processor.setAdapter(proto.adapter);
663: processor.setThreadPool(proto.tp);
664: processor
665: .setMaxKeepAliveRequests(proto.maxKeepAliveRequests);
666: processor.setTimeout(proto.timeout);
667: processor
668: .setDisableUploadTimeout(proto.disableUploadTimeout);
669: processor.setCompression(proto.compression);
670: processor.setCompressionMinSize(proto.compressionMinSize);
671: processor
672: .setNoCompressionUserAgents(proto.noCompressionUserAgents);
673: processor
674: .setCompressableMimeTypes(proto.compressableMimeTypes);
675: processor
676: .setRestrictedUserAgents(proto.restrictedUserAgents);
677: processor.setSocketBuffer(proto.socketBuffer);
678: processor.setMaxPostSize(proto.maxPostSize);
679:
680: thData[Http11Protocol.THREAD_DATA_PROCESSOR] = processor;
681:
682: if (proto.getDomain() != null) {
683: try {
684: RequestInfo rp = processor.getRequest()
685: .getRequestProcessor();
686: rp.setGlobalProcessor(global);
687: ObjectName rpName = new ObjectName(proto
688: .getDomain()
689: + ":type=RequestProcessor,worker="
690: + proto.getName()
691: + ",name=HttpRequest"
692: + count++);
693: Registry.getRegistry(null, null).registerComponent(
694: rp, rpName, null);
695: thData[Http11Protocol.THREAD_DATA_OBJECT_NAME] = rpName;
696: } catch (Exception ex) {
697: log.warn("Error registering request");
698: }
699: }
700:
701: return thData;
702: }
703:
704: public void processConnection(TcpConnection connection,
705: Object thData[]) {
706: Socket socket = null;
707: Http11Processor processor = null;
708: try {
709: processor = (Http11Processor) thData[Http11Protocol.THREAD_DATA_PROCESSOR];
710:
711: if (processor instanceof ActionHook) {
712: ((ActionHook) processor).action(
713: ActionCode.ACTION_START, null);
714: }
715: socket = connection.getSocket();
716:
717: InputStream in = socket.getInputStream();
718: OutputStream out = socket.getOutputStream();
719:
720: if (proto.secure) {
721: SSLSupport sslSupport = null;
722: if (proto.sslImplementation != null)
723: sslSupport = proto.sslImplementation
724: .getSSLSupport(socket);
725: processor.setSSLSupport(sslSupport);
726: } else {
727: processor.setSSLSupport(null);
728: }
729: processor.setSocket(socket);
730:
731: processor.process(in, out);
732:
733: // If unread input arrives after the shutdownInput() call
734: // below and before or during the socket.close(), an error
735: // may be reported to the client. To help troubleshoot this
736: // type of error, provide a configurable delay to give the
737: // unread input time to arrive so it can be successfully read
738: // and discarded by shutdownInput().
739: if (proto.socketCloseDelay >= 0) {
740: try {
741: Thread.sleep(proto.socketCloseDelay);
742: } catch (InterruptedException ie) { /* ignore */
743: }
744: }
745:
746: TcpConnection.shutdownInput(socket);
747: } catch (java.net.SocketException e) {
748: // SocketExceptions are normal
749: Http11Protocol.log
750: .debug(
751: sm
752: .getString("http11protocol.proto.socketexception.debug"),
753: e);
754: } catch (java.io.IOException e) {
755: // IOExceptions are normal
756: Http11Protocol.log
757: .debug(
758: sm
759: .getString("http11protocol.proto.ioexception.debug"),
760: e);
761: }
762: // Future developers: if you discover any other
763: // rare-but-nonfatal exceptions, catch them here, and log as
764: // above.
765: catch (Throwable e) {
766: // any other exception or error is odd. Here we log it
767: // with "ERROR" level, so it will show up even on
768: // less-than-verbose logs.
769: Http11Protocol.log.error(sm
770: .getString("http11protocol.proto.error"), e);
771: } finally {
772: // if(proto.adapter != null) proto.adapter.recycle();
773: // processor.recycle();
774:
775: if (processor instanceof ActionHook) {
776: ((ActionHook) processor).action(
777: ActionCode.ACTION_STOP, null);
778: }
779: // recycle kernel sockets ASAP
780: try {
781: if (socket != null)
782: socket.close();
783: } catch (IOException e) { /* ignore */
784: }
785: }
786: }
787: }
788:
789: protected static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory
790: .getLog(Http11Protocol.class);
791:
792: // -------------------- Various implementation classes --------------------
793:
794: /** Sanity check and socketFactory setup.
795: * IMHO it is better to stop the show on a broken connector,
796: * then leave Tomcat running and broken.
797: * @exception TomcatException Unable to resolve classes
798: */
799: private void checkSocketFactory() throws Exception {
800: if (secure) {
801: try {
802: // The SSL setup code has been moved into
803: // SSLImplementation since SocketFactory doesn't
804: // provide a wide enough interface
805: sslImplementation = SSLImplementation
806: .getInstance(sslImplementationName);
807: socketFactory = sslImplementation
808: .getServerSocketFactory();
809: ep.setServerSocketFactory(socketFactory);
810: } catch (ClassNotFoundException e) {
811: throw e;
812: }
813: } else if (socketFactoryName != null) {
814: try {
815: socketFactory = string2SocketFactory(socketFactoryName);
816: ep.setServerSocketFactory(socketFactory);
817: } catch (Exception sfex) {
818: throw sfex;
819: }
820: }
821: }
822:
823: /*
824: public boolean isKeystoreSet() {
825: return (attributes.get("keystore") != null);
826: }
827:
828: public boolean isKeypassSet() {
829: return (attributes.get("keypass") != null);
830: }
831:
832: public boolean isClientauthSet() {
833: return (attributes.get("clientauth") != null);
834: }
835:
836: public boolean isAttributeSet( String attr ) {
837: return (attributes.get(attr) != null);
838: }
839:
840: public boolean isSecure() {
841: return secure;
842: }
843:
844: public PoolTcpEndpoint getEndpoint() {
845: return ep;
846: }
847: */
848:
849: protected String domain;
850: protected ObjectName oname;
851: protected MBeanServer mserver;
852:
853: public ObjectName getObjectName() {
854: return oname;
855: }
856:
857: public String getDomain() {
858: return domain;
859: }
860:
861: public ObjectName preRegister(MBeanServer server, ObjectName name)
862: throws Exception {
863: oname = name;
864: mserver = server;
865: domain = name.getDomain();
866: return name;
867: }
868:
869: public void postRegister(Boolean registrationDone) {
870: }
871:
872: public void preDeregister() throws Exception {
873: }
874:
875: public void postDeregister() {
876: }
877: }
|