Package com.caucho.hessian.io

Examples of com.caucho.hessian.io.AbstractHessianInput


        throw new HessianProtocolException(L.l("expected 'H' at '{0}'", ch));

      int major = is.read();
      int minor = is.read();

      AbstractHessianInput in = new Hessian2Input(is);

      return in.readReply(method.getReturnType());
    } catch (HessianProtocolException e) {
      throw new RuntimeException(e);
    } finally {
      try {
        if (is != null)
View Full Code Here


        }
      }

      is = conn.getInputStream();

      AbstractHessianInput in = _factory.getHessianInput(is);

      in.startReply();

      Object value = in.readObject(method.getReturnType());

      if (value instanceof InputStream) {
  value = new ResultInputStream(httpConn, is, in, (InputStream) value);
  is = null;
  httpConn = null;
      }
      else
  in.completeReply();

      return value;
    } catch (HessianProtocolException e) {
      throw new HessianRuntimeException(e);
    } finally {
View Full Code Here

      _conn = null;
     
      InputStream connIs = _connIs;
      _connIs = null;
     
      AbstractHessianInput in = _in;
      _in = null;
     
      InputStream hessianIs = _hessianIs;
      _hessianIs = null;

      try {
  if (hessianIs != null)
    hessianIs.close();
      } catch (Exception e) {
  log.log(Level.FINE, e.toString(), e);
      }

      try {
  if (in != null) {
    in.completeReply();
    in.close();
  }
      } catch (Exception e) {
  log.log(Level.FINE, e.toString(), e);
      }
View Full Code Here

      os = dOs;
    }

    HessianInputFactory.HeaderType header = _inputFactory.readHeader(is);

    AbstractHessianInput in;
    AbstractHessianOutput out;

    switch (header) {
    case CALL_1_REPLY_1:
      in = _hessianFactory.createHessianInput(is);
      out = _hessianFactory.createHessianOutput(os);
      break;

    case CALL_1_REPLY_2:
      in = _hessianFactory.createHessianInput(is);
      out = _hessianFactory.createHessian2Output(os);
      break;

    case HESSIAN_2:
      in = _hessianFactory.createHessian2Input(is);
      in.readCall();
      out = _hessianFactory.createHessian2Output(os);
      break;

    default:
      throw new IllegalStateException(header + " is an unknown Hessian call");
    }

    if (serializerFactory != null) {
      in.setSerializerFactory(serializerFactory);
      out.setSerializerFactory(serializerFactory);
    }

    try {
      invoke(_service, in, out);
    } finally {
      in.close();
      out.close();

      if (isDebug)
        os.close();
    }
View Full Code Here

    return authLink;
  }

  protected void invoke(RequestWrapper rw, InputStream is, OutputStream os,
      SerializerFactory serializerFactory) {
    AbstractHessianInput in = null;
    AbstractHessianOutput out = null;
    String username = rw.getUser();
    String password = rw.getPassword();
    try {

      HessianInputFactory.HeaderType header = _inputFactory
          .readHeader(is);

      switch (header) {
      case CALL_1_REPLY_1:
        in = _hessianFactory.createHessianInput(is);
        out = _hessianFactory.createHessianOutput(os);
        break;

      case CALL_1_REPLY_2:
        in = _hessianFactory.createHessianInput(is);
        out = _hessianFactory.createHessian2Output(os);
        break;

      case HESSIAN_2:
        in = _hessianFactory.createHessian2Input(is);
        in.readCall();
        out = _hessianFactory.createHessian2Output(os);
        break;

      default:
        throw new IllegalStateException(header
            + " is an unknown Hessian call");
      }

      if (serializerFactory != null) {
        in.setSerializerFactory(serializerFactory);
        out.setSerializerFactory(serializerFactory);
      }

      if (username == null || password == null) {
        Exception exception = new RuntimeException(
            "the client can't offer the user or password infor,please check.");
        out.writeFault("ServiceException", exception.getMessage(),
            exception);
        log.error("the client can't offer the user or password infor,now we have refused.");
        throw exception;
      }
      invoke(rw, in, out);
    } catch (Exception e) {
      e.printStackTrace();
      try {
        out.writeFault("ServiceException", e.getMessage(), e);
      } catch (IOException e1) {
        e1.printStackTrace();
      }
    } finally {
      try {
        in.close();
        out.close();
      } catch (IOException e) {
        e.printStackTrace();
      }
View Full Code Here

      int code = isToUse.read();
      int major;
      int minor;

      AbstractHessianInput in;
      AbstractHessianOutput out;

      if (code == 'H') {
        // Hessian 2.0 stream
        major = isToUse.read();
        minor = isToUse.read();
        if (major != 0x02) {
          throw new IOException("Version " + major + "." + minor + " is not understood");
        }
        in = new Hessian2Input(isToUse);
        out = new Hessian2Output(osToUse);
        in.readCall();
      }
      else if (code == 'C') {
        // Hessian 2.0 call... for some reason not handled in HessianServlet!
        isToUse.reset();
        in = new Hessian2Input(isToUse);
        out = new Hessian2Output(osToUse);
        in.readCall();
      }
      else if (code == 'c') {
        // Hessian 1.0 call
        major = isToUse.read();
        minor = isToUse.read();
        in = new HessianInput(isToUse);
        if (major >= 2) {
          out = new Hessian2Output(osToUse);
        }
        else {
          out = new HessianOutput(osToUse);
        }
      }
      else {
        throw new IOException("Expected 'H'/'C' (Hessian 2.0) or 'c' (Hessian 1.0) in hessian input at " + code);
      }

      if (this.serializerFactory != null) {
        in.setSerializerFactory(this.serializerFactory);
        out.setSerializerFactory(this.serializerFactory);
      }
      if (this.remoteResolver != null) {
        in.setRemoteResolver(this.remoteResolver);
      }

      try {
        skeleton.invoke(in, out);
      }
      finally {
        try {
          in.close();
          isToUse.close();
        }
        catch (IOException ex) {
          // ignore
        }
View Full Code Here

      int code = isToUse.read();
      int major;
      int minor;

      AbstractHessianInput in;
      AbstractHessianOutput out;

      if (code == 'H') {
        // Hessian 2.0 stream
        major = isToUse.read();
        minor = isToUse.read();
        if (major != 0x02) {
          throw new IOException("Version " + major + "." + minor + " is not understood");
        }
        in = new Hessian2Input(isToUse);
        out = new Hessian2Output(osToUse);
        in.readCall();
      }
      else if (code == 'C') {
        // Hessian 2.0 call... for some reason not handled in HessianServlet!
        isToUse.reset();
        in = new Hessian2Input(isToUse);
        out = new Hessian2Output(osToUse);
        in.readCall();
      }
      else if (code == 'c') {
        // Hessian 1.0 call
        major = isToUse.read();
        minor = isToUse.read();
        in = new HessianInput(isToUse);
        if (major >= 2) {
          out = new Hessian2Output(osToUse);
        }
        else {
          out = new HessianOutput(osToUse);
        }
      }
      else {
        throw new IOException("Expected 'H'/'C' (Hessian 2.0) or 'c' (Hessian 1.0) in hessian input at " + code);
      }

      if (this.serializerFactory != null) {
        in.setSerializerFactory(this.serializerFactory);
        out.setSerializerFactory(this.serializerFactory);
      }

      try {
        skeleton.invoke(in, out);
      }
      finally {
        try {
          in.close();
          isToUse.close();
        }
        catch (IOException ex) {
          // ignore
        }
View Full Code Here

    return getHessian2Input(is);
  }

  public AbstractHessianInput getHessian1Input(InputStream is)
  {
    AbstractHessianInput in;

    if (_isDebug)
      is = new HessianDebugInputStream(is, new PrintWriter(System.out));

    in = new HessianInput(is);

    in.setRemoteResolver(getRemoteResolver());

    in.setSerializerFactory(getSerializerFactory());

    return in;
  }
View Full Code Here

    return in;
  }

  public AbstractHessianInput getHessian2Input(InputStream is)
  {
    AbstractHessianInput in;

    if (_isDebug)
      is = new HessianDebugInputStream(is, new PrintWriter(System.out));

    in = new Hessian2Input(is);

    in.setRemoteResolver(getRemoteResolver());

    in.setSerializerFactory(getSerializerFactory());

    return in;
  }
View Full Code Here

      os = dOs;
    }

    HessianInputFactory.HeaderType header = _inputFactory.readHeader(is);

    AbstractHessianInput in;
    AbstractHessianOutput out;

    switch (header) {
    case CALL_1_REPLY_1:
      in = _hessianFactory.createHessianInput(is);
      out = _hessianFactory.createHessianOutput(os);
      break;

    case CALL_1_REPLY_2:
      in = _hessianFactory.createHessianInput(is);
      out = _hessianFactory.createHessian2Output(os);
      break;

    case HESSIAN_2:
      in = _hessianFactory.createHessian2Input(is);
      in.readCall();
      out = _hessianFactory.createHessian2Output(os);
      break;

    default:
      throw new IllegalStateException(header + " is an unknown Hessian call");
    }

    if (serializerFactory != null) {
      in.setSerializerFactory(serializerFactory);
      out.setSerializerFactory(serializerFactory);
    }

    try {
      invoke(_service, in, out);
    } finally {
      in.close();
      out.close();

      if (isDebug)
        os.close();
    }
View Full Code Here

TOP

Related Classes of com.caucho.hessian.io.AbstractHessianInput

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.