i would recommend moving those central resources to a singleton and allowing axis to create instances of your handlers as it needs them. if these resources are truely shared (and sharable) then having them in a central thread-safe singleton also decouples them from the api (axis, struts, whatever) layer which tends to be a good idea.
> That is not always possible. There is some internal state such as > resources on databases and so on that you dont want to create each time. > > -- Robert > > zze-ELSOKHON Tony RD-BIZZ-ISS schrieb: > >>Robert, >> >>You can declare a handler only once as a child element of >> <globalConfiguration> and give it a "name" attribute, just like URLMapper or >> LocalResponder. The specified name could be used later to reference the >> handler. >> >>Declaring a handler this way doesn't guarantee having only one object >> created. Besides, handlers should be completely stateless objects and >> manipulate only the data transmitted via MessageContext. Having one or >> multiple instances created should not be a design issue. >> >>Regards, >> >>Tony >> >>-----Message d'origine----- >>De : news [mailto:[EMAIL PROTECTED] De la part de Robert Simmons Jr. >>Envoyé : mercredi 16 novembre 2005 19:51 >>À : [email protected] >>Objet : One Handler for request and response? >> >>Greetings, I currently use a handler to do some stuff to the request and >>response and I wanted to know if it was possible to have it so that one >>object would be doing both. I have the configuration pasted below and >>you will see that I have to create 2 instance of ContentCryptoHandler in >>my HTTP protocol config and I would rahter have just one. Any way to do >>that ? >> >>TIA >> >><?xml version="1.0" encoding="UTF-8"?> >> >><deployment xmlns="http://xml.apache.org/axis/wsdd/" >> xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"> >> <globalConfiguration> >> <parameter name="adminPassword" value="nimda"/> >> <parameter name="attachments.Directory" >>value="C:\temp\MobileLDAP\attachments"/> >> <parameter name="disablePrettyXML" value="true"/> >> <parameter name="attachments.implementation" >> value="org.apache.axis.attachments.AttachmentsImpl"/> >> <parameter name="sendXsiTypes" value="true"/> >> <parameter name="sendMultiRefs" value="true"/> >> <parameter name="sendXMLDeclaration" value="true"/> >> </globalConfiguration> >> <handler name="LocalResponder" >> type="java:org.apache.axis.transport.local.LocalResponder"/> >> <handler name="URLMapper" >>type="java:org.apache.axis.handlers.http.URLMapper"/> >> <handler name="Authenticate" >> type="java:org.apache.axis.handlers.SimpleAuthenticationHandler"/> >> <service name="Version" provider="java:RPC"> >> <parameter name="allowedMethods" value="getVersion"/> >> <parameter name="className" value="org.apache.axis.Version"/> >> </service> >> <service name="MobileLDAP" provider="java:RPC" style="wrapped" >>use="literal"> >> <documentation>Provides Mobile Access to LDAP.</documentation> >> <parameter name="allowedMethods" value="getSimpleSearchFilter, >>searchForContacts"/> >> <parameter name="className" >>value="com.jambit.mobileLDAP.WSMobileLDAP"/> >> <parameter name="scope" value="session"/> >> <beanMapping >>languageSpecificType="java:com.jambit.mobileLDAP.Contact" >> qname="ns1:Contact" xmlns:ns1="urn:com.jambit.MobileLDAP"/> >> <namespace>urn:com.jambit.MobileLDAP</namespace> >> </service> >> <transport name="http"> >> <requestFlow> >> <handler type="URLMapper"/> >> <handler >>type="java:org.apache.axis.handlers.http.HTTPAuthHandler"/> >> <handler >>type="java:com.jambit.axis.handlers.ContentCryptoHandler"/> >> </requestFlow> >> <responseFlow> >> <handler >>type="java:com.jambit.axis.handlers.ContentCryptoHandler"/> >> </responseFlow> >> <parameter name="qs:list" >>value="org.apache.axis.transport.http.QSListHandler"/> >> <parameter name="qs:wsdl" >>value="org.apache.axis.transport.http.QSWSDLHandler"/> >> <parameter name="qs.list" >>value="org.apache.axis.transport.http.QSListHandler"/> >> <parameter name="qs.method" >>value="org.apache.axis.transport.http.QSMethodHandler"/> >> <parameter name="qs:method" >>value="org.apache.axis.transport.http.QSMethodHandler"/> >> <parameter name="qs.wsdl" >>value="org.apache.axis.transport.http.QSWSDLHandler"/> >> </transport> >> <transport name="local"> >> <responseFlow> >> <handler type="LocalResponder"/> >> </responseFlow> >> </transport> >></deployment> >> >> >> >> >> >
