Package org.apache.axis

Examples of org.apache.axis.Handler


    public void invoke(MessageContext msgContext) throws AxisFault
    {
        /** Log an access each time we get invoked.
         */
        try {
            Handler serviceHandler = msgContext.getService();
            String filename = (String)getOption("filename");
            if ((filename == null) || (filename.equals("")))
                throw new AxisFault("Server.NoLogFile",
                                 "No log file configured for the LogHandler!",
                                    null, null);
            FileOutputStream fos = new FileOutputStream(filename, true);
           
            PrintWriter writer = new PrintWriter(fos);
           
            Integer numAccesses =
                             (Integer)serviceHandler.getOption("accesses");
            if (numAccesses == null)
                numAccesses = new Integer(0);
           
            numAccesses = new Integer(numAccesses.intValue() + 1);
           
            Date date = new Date();
            String result = date + ": service " +
                            msgContext.getTargetService() +
                            " accessed " + numAccesses + " time(s).";
            serviceHandler.setOption("accesses", numAccesses);
           
            writer.println(result);
           
            writer.close();
        } catch (Exception e) {
View Full Code Here


    {
        Chain c = new org.apache.axis.SimpleChain();
       
        for (int n = 0; n < handlers.size(); n++) {
            WSDDHandler handler = (WSDDHandler)handlers.get(n);
            Handler h = handler.getInstance(registry);
            if ( h != null )
              c.addHandler(h);
            else
              throw new ConfigurationException("Can't find handler name:'" +
                                               handler.getQName() + "' type:'"+
View Full Code Here

        }

        // Make sure tmr is initialized.
        initTMR();

        Handler reqHandler = null;
        WSDDChain request = getRequestFlow();

        if (request != null) {
            reqHandler = request.getInstance(registry);
        }

        Handler providerHandler = null;

        if (providerQName != null) {
            try {
                providerHandler = WSDDProvider.getInstance(providerQName,
                                                           this,
                                                           registry);
            } catch (Exception e) {
                throw new ConfigurationException(e);
            }
            if (providerHandler == null)
                throw new WSDDException(
                          Messages.getMessage("couldntConstructProvider00"));
        }

        Handler respHandler = null;
        WSDDChain response = getResponseFlow();

        if (response != null) {
            respHandler = response.getInstance(registry);
        }

        SOAPService service = new SOAPService(reqHandler, providerHandler,
                                              respHandler);
        service.setStyle(style);
        service.setUse(use);
        service.setHighFidelityRecording(!streaming);
        service.setSendType(sendType);

        if ( getQName() != null )
            service.setName(getQName().getLocalPart());
        service.setOptions(getParametersTable());

        service.setEngine(((WSDDDeployment)registry).getEngine());

        if (use != Use.ENCODED) {
            // If not encoded, turn off multi-refs and prefer
            // not to sent xsi:type and xsi:nil
            service.setOption(AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
            service.setOption(AxisEngine.PROP_SEND_XSI, Boolean.FALSE);
        }

  // Set handlerInfoChain
  if (_wsddHIchain != null) {
            HandlerInfoChainFactory hiChainFactory = _wsddHIchain.getHandlerChainFactory();

      service.setOption(Constants.ATTR_HANDLERINFOCHAIN, hiChainFactory);
  }

        AxisEngine.normaliseOptions(service);
        tmr.delegate(registry.getTypeMappingRegistry());

        WSDDFaultFlow [] faultFlows = getFaultFlows();
        if (faultFlows != null && faultFlows.length > 0) {
            FaultableHandler wrapper = new FaultableHandler(service);
            for (int i = 0; i < faultFlows.length; i++) {
                WSDDFaultFlow flow = faultFlows[i];
                Handler faultHandler = flow.getInstance(registry);
                wrapper.setOption("fault-" + flow.getQName().getLocalPart(),
                                  faultHandler);
            }
        }
View Full Code Here

     * @throws ConfigurationException XXX
     */
    public Handler makeNewInstance(EngineConfiguration registry)
        throws ConfigurationException
    {
        Handler reqHandler = null;

        WSDDChain req = getRequestFlow();
        if (req != null)
            reqHandler = req.getInstance(registry);
       
        Handler pivot = null;
        if (pivotQName != null) {
            if (URI_WSDD_JAVA.equals(pivotQName.getNamespaceURI())) {
                try {
                    pivot = (Handler)ClassUtils.forName(pivotQName.getLocalPart()).newInstance();
                } catch (InstantiationException e) {
                    throw new ConfigurationException(e);
                } catch (IllegalAccessException e) {
                    throw new ConfigurationException(e);
                } catch (ClassNotFoundException e) {
                    throw new ConfigurationException(e);
                }
            } else {
                pivot = registry.getHandler(pivotQName);
            }
        }
       
        Handler respHandler = null;
        WSDDChain resp = getResponseFlow();
        if (resp != null)
            respHandler = resp.getInstance(registry);

        return new org.apache.axis.SimpleTargetedChain(reqHandler, pivot,
View Full Code Here

    public SerializationContextImpl(Writer writer, MessageContext msgContext)
    {
        this.writer = writer;
        this.msgContext = msgContext;

        Handler optionSource = null ;
        if ( msgContext != null ) {
            soapConstants = msgContext.getSOAPConstants();

            // optionSource = msgContext.getService();
            if (optionSource == null)
                optionSource = msgContext.getAxisEngine();

            // Use whatever schema is associated with this MC
            schemaVersion = msgContext.getSchemaVersion();

            Boolean shouldSendDecl = (Boolean)optionSource.getOption(
                                                  AxisEngine.PROP_XML_DECL);
            if (shouldSendDecl != null)
                sendXMLDecl = shouldSendDecl.booleanValue();

            Boolean shouldSendMultiRefs =
                  (Boolean)msgContext.getProperty(AxisEngine.PROP_DOMULTIREFS);

            if (shouldSendMultiRefs == null)
                shouldSendMultiRefs =
                        (Boolean)optionSource.getOption(AxisEngine.PROP_DOMULTIREFS);

            if (shouldSendMultiRefs != null)
                doMultiRefs = shouldSendMultiRefs.booleanValue();

            // The SEND_TYPE_ATTR and PROP_SEND_XSI options indicate
            // whether the elements should have xsi:type attributes.
            // Only turn this off is the user tells us to
            if ( !msgContext.isPropertyTrue(Call.SEND_TYPE_ATTR, true ))
                sendXSIType = false ;

            Boolean opt = (Boolean)optionSource.getOption(AxisEngine.PROP_SEND_XSI);
            if ((opt != null) && (opt.equals(Boolean.FALSE))) {
                    sendXSIType = false ;
            }

            // A Literal use service overrides the above settings. Don't
View Full Code Here

         */

        /** For now, though - make sure we can only admin from our own
         * IP, unless the remoteAdmin option is set.
         */
        Handler serviceHandler = msgContext.getService();
        if (serviceHandler != null  &&
            !JavaUtils.isTrueExplicitly(serviceHandler.getOption("enableRemoteAdmin"))) {

            String remoteIP = msgContext.getStrProp(Constants.MC_REMOTE_ADDR);
            if (remoteIP != null  &&
                !remoteIP.equals("127.0.0.1")) {

View Full Code Here

    public TypeMapping getTypeMapping(String encodingStyle) throws ConfigurationException {
        return (TypeMapping)getTypeMappingRegistry().getTypeMapping(encodingStyle);
    }

    public Handler getTransport(QName qname) throws ConfigurationException {
        Handler transport = (Handler)transports.get(qname);
        if ((defaultConfiguration != null) && (transport == null))
            transport = defaultConfiguration.getTransport(qname);
        return transport;
    }
View Full Code Here

            service = defaultConfiguration.getServiceByNamespaceURI(namespace);
        return service;
    }

    public Handler getHandler(QName qname) throws ConfigurationException {
        Handler handler = (Handler)handlers.get(qname);
        if ((defaultConfiguration != null) && (handler == null))
            handler = defaultConfiguration.getHandler(qname);
        return handler;
    }
View Full Code Here

public class BasicServerConfig extends SimpleProvider {
    /**
     * Constructor - deploy a hardcoded basic server-side configuration.
     */
    public BasicServerConfig() {
        Handler h = new LocalResponder();
        SimpleTargetedChain transport = new SimpleTargetedChain(null, null, h);
        deployTransport("local", transport);
        deployTransport("java", new SimpleTargetedChain(new LocalSender()));
    }
View Full Code Here

     */
    protected Handler makeNewInstance(EngineConfiguration registry)
        throws ConfigurationException
    {
        Class   c = null;
        Handler h = null;

        try {
            c = getJavaClass();
        } catch (ClassNotFoundException e) {
            throw new ConfigurationException(e);
        }

        if (c != null) {
            try {
                h = (Handler)createInstance(c);
            } catch (Exception e) {
                throw new ConfigurationException(e);
            }

            if (h != null) {
                if ( qname != null )
                  h.setName(qname.getLocalPart());
                h.setOptions(getParametersTable());
                try{
                  h.init();
                }catch(Exception e){
                    String msg=e + JavaUtils.LS + JavaUtils.stackToString(e);
                    log.debug(msg);
                    throw new ConfigurationException(e);
                }catch(Error e){
View Full Code Here

TOP

Related Classes of org.apache.axis.Handler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.