FileDocCategorySizeDatePackage
RequestMessage_1_2.javaAPI DocJava SE 5 API6141Fri Aug 26 14:54:32 BST 2005com.sun.corba.se.impl.protocol.giopmsgheaders

RequestMessage_1_2

public final class RequestMessage_1_2 extends Message_1_2 implements RequestMessage
This implements the GIOP 1.2 Request header.
author
Ram Jeyaraman 05/14/2000
version
1.0

Fields Summary
private com.sun.corba.se.spi.orb.ORB
orb
private com.sun.corba.se.impl.logging.ORBUtilSystemException
wrapper
private byte
response_flags
private byte[]
reserved
private TargetAddress
target
private String
operation
private com.sun.corba.se.spi.servicecontext.ServiceContexts
service_contexts
private com.sun.corba.se.spi.ior.ObjectKey
objectKey
Constructors Summary
RequestMessage_1_2(com.sun.corba.se.spi.orb.ORB orb)


    // Constructors

      
        this.orb = orb;
	this.wrapper = ORBUtilSystemException.get( orb,
	    CORBALogDomains.RPC_PROTOCOL ) ;
    
RequestMessage_1_2(com.sun.corba.se.spi.orb.ORB orb, int _request_id, byte _response_flags, byte[] _reserved, TargetAddress _target, String _operation, com.sun.corba.se.spi.servicecontext.ServiceContexts _service_contexts)

        super(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN,
            Message.GIOPRequest, 0);
        this.orb = orb;
	this.wrapper = ORBUtilSystemException.get( orb,
	    CORBALogDomains.RPC_PROTOCOL ) ;
        request_id = _request_id;
        response_flags = _response_flags;
        reserved = _reserved;
        target = _target;
        operation = _operation;
        service_contexts = _service_contexts;
    
Methods Summary
public voidcallback(MessageHandler handler)

        handler.handleInput(this);
    
public com.sun.corba.se.spi.ior.ObjectKeygetObjectKey()

        if (this.objectKey == null) {
	    // this will raise a MARSHAL exception upon errors.
	    this.objectKey = MessageBase.extractObjectKey(target, orb);
        }

	return this.objectKey;
    
public java.lang.StringgetOperation()

        return this.operation;
    
public org.omg.CORBA.PrincipalgetPrincipal()

        // REVISIT Should we throw an exception or return null ?
        return null;
    
public intgetRequestId()

        return this.request_id;
    
public byte[]getReserved()

        return this.reserved;
    
public com.sun.corba.se.spi.servicecontext.ServiceContextsgetServiceContexts()

        return this.service_contexts;
    
public booleanisResponseExpected()

        /*
        case 1: LSBit[1] == 1
            not a oneway call (DII flag INV_NO_RESPONSE is false)  // Ox03
            LSBit[0] must be 1.
        case 2: LSBit[1] == 0
            if (LSB[0] == 0) // Ox00
                oneway call
            else if (LSB[0] == 1) // 0x01
                oneway call; but server may provide
                a location forward response or system exception response.
        */

        if ( (this.response_flags & RESPONSE_EXPECTED_BIT) == RESPONSE_EXPECTED_BIT ) {
            return true;
        }

        return false;
    
public voidread(org.omg.CORBA.portable.InputStream istream)

        super.read(istream);
        this.request_id = istream.read_ulong();
        this.response_flags = istream.read_octet();
        this.reserved = new byte[3];
        for (int _o0 = 0;_o0 < (3); ++_o0) {
            this.reserved[_o0] = istream.read_octet();
        }
        this.target = TargetAddressHelper.read(istream);
        getObjectKey(); // this does AddressingDisposition check
        this.operation = istream.read_string();
        this.service_contexts 
            = new ServiceContexts((org.omg.CORBA_2_3.portable.InputStream) istream);

        // CORBA formal 00-11-0 15.4.2.2 GIOP 1.2 body must be
        // aligned on an 8 octet boundary.
        // Ensures that the first read operation called from the stub code,
        // during body deconstruction, would skip the header padding, that was
        // inserted to ensure that the body was aligned on an 8-octet boundary.
        ((CDRInputStream)istream).setHeaderPadding(true);
        
    
public voidwrite(org.omg.CORBA.portable.OutputStream ostream)

        super.write(ostream);
        ostream.write_ulong(this.request_id);
        ostream.write_octet(this.response_flags);
        nullCheck(this.reserved);
        if (this.reserved.length != (3)) {
	    throw wrapper.badReservedLength(
                org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
        }
        for (int _i0 = 0;_i0 < (3); ++_i0) {
            ostream.write_octet(this.reserved[_i0]);
        }
        nullCheck(this.target);
        TargetAddressHelper.write(ostream, this.target);
        ostream.write_string(this.operation);
        if (this.service_contexts != null) {
	        service_contexts.write(
                (org.omg.CORBA_2_3.portable.OutputStream) ostream,
                GIOPVersion.V1_2);
	    } else {
	        ServiceContexts.writeNullServiceContext(
                (org.omg.CORBA_2_3.portable.OutputStream) ostream);
        }

        // CORBA formal 00-11-0 15.4.2.2 GIOP 1.2 body must be
        // aligned on an 8 octet boundary.
        // Ensures that the first write operation called from the stub code,
        // during body construction, would insert a header padding, such that
        // the body is aligned on an 8-octet boundary.
        ((CDROutputStream)ostream).setHeaderPadding(true);