FileDocCategorySizeDatePackage
HessianServiceSkeletonInvokerImpl.javaAPI DocApache Lucene 2.1.04175Wed Feb 14 10:46:00 GMT 2007org.apache.lucene.gdata.hivemind.webservice

HessianServiceSkeletonInvokerImpl

public class HessianServiceSkeletonInvokerImpl extends Object implements HessianServiceSkeletonInvoker
Wrapps the hessian skeleton invokation logic. This is based on the protocol description of the hessian protocol
author
Simon Willnauer

Fields Summary
private static final Log
LOG
private com.caucho.hessian.io.SerializerFactory
serializerFactory
private final com.caucho.hessian.server.HessianSkeleton
skeleton
Constructors Summary
HessianServiceSkeletonInvokerImpl(com.caucho.hessian.server.HessianSkeleton skeleton)
Creates a new HessianServiceSkeletonInvoker

param
skeleton - The skeleton instance to invoke to process the request

                          
       
        this.skeleton = skeleton;
       
    
Methods Summary
public com.caucho.hessian.io.SerializerFactorygetSerializerFactory()

return
Returns the serializerFactory.

        return this.serializerFactory;
    
public voidinvoke(javax.servlet.http.HttpServletRequest arg0, javax.servlet.http.HttpServletResponse arg1)

throws
Throwable
see
org.apache.lucene.gdata.hivemind.webservice.HessianServiceSkeletonInvoker#invoke(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)

        InputStream inputStream = arg0.getInputStream();
        OutputStream outputStream = arg1.getOutputStream();
        /*
         *This works only with hessian >= hessian-3.0.20!!
         *but remember this is not a framework  
         */
        Hessian2Input hessianInput = new Hessian2Input(inputStream);
        if (this.serializerFactory != null) {
                hessianInput.setSerializerFactory(this.serializerFactory);
        }

        int code = hessianInput.read();
        if (code != 'c") {
                throw new IOException("expected 'c' in hessian input at " + code);
        }

        AbstractHessianOutput  hessianOutput = null;
        int major = hessianInput.read();
        // useless read just get the stream in the right position.
        int minor = hessianInput.read();
        if (major >= 2) {
                hessianOutput = new Hessian2Output(outputStream);
        }
        else {
                hessianOutput = new HessianOutput(outputStream);
        }
        if (this.serializerFactory != null) {
                hessianOutput.setSerializerFactory(this.serializerFactory);
        }

        try {
            this.skeleton.invoke(hessianInput, hessianOutput);
        } catch (Throwable e) {
            LOG.error("Unexpected Exception thrown -- "+e.getMessage(),e);
            throw e;
            
        }

    
public voidsetSerializerFactory(com.caucho.hessian.io.SerializerFactory serializerFactory)

param
serializerFactory The serializerFactory to set.

        this.serializerFactory = serializerFactory;