//RequestInfo attributes
info = new ServerRequestInfoImpl(controller.getORB(),
request,
servant);
InterceptorManager manager = controller.getORB().getInterceptorManager();
info.setCurrent (manager.getEmptyCurrent());
if(! invokeInterceptors( info,
ServerInterceptorIterator.
RECEIVE_REQUEST_SERVICE_CONTEXTS))
{
//an interceptor bailed out, so don't continue request
//processing and return here. The service contexts for
//the result have to be set, of course.
ReplyOutputStream out = request.getReplyOutputStream();
Enumeration ctx = info.getReplyServiceContexts();
while( ctx.hasMoreElements() )
{
out.addServiceContext( (ServiceContext) ctx.nextElement() );
}
return;
}
manager.setTSCurrent(info.current());
}
// TODO: The exception replies below should also trigger interceptors.
// Requires some re-arranging of the entire method.
if (Time.hasPassed (request.getRequestEndTime()))
{
request.setSystemException
(new org.omg.CORBA.TIMEOUT ("Request End Time exceeded",
0, CompletionStatus.COMPLETED_NO));
return;
}
if (checkReplyEndTime && Time.hasPassed (request.getReplyEndTime()))
{
request.setSystemException
(new org.omg.CORBA.TIMEOUT ("Reply End Time exceeded",
0, CompletionStatus.COMPLETED_NO));
return;
}
Time.waitFor (request.getRequestStartTime());
if (servantManager != null)
{
if (servantManager instanceof org.omg.PortableServer.ServantActivator)
{
invokeIncarnate();
}
else
{
invokePreInvoke();
}
}
if (servant != null)
{
if (info != null)
{
info.setServant(servant);
if (servant instanceof org.omg.CORBA.portable.InvokeHandler)
{
if(! invokeInterceptors(info,
ServerInterceptorIterator.RECEIVE_REQUEST ))
{
//an interceptor bailed out, so don't continue
//request processing and return here. The
//service contexts for the result have to be
//set, of course.
if( cookieHolder != null )
{
invokePostInvoke();
}
ReplyOutputStream out =
request.getReplyOutputStream();
Enumeration ctx =
info.getReplyServiceContexts();
while( ctx.hasMoreElements() )
{
out.addServiceContext( (ServiceContext) ctx.nextElement() );
}
return;
}
}
else if (servant instanceof org.omg.PortableServer.DynamicImplementation)
{
request.setServerRequestInfo(info);
}
}
invokeOperation();
}
// preinvoke and postinvoke are always called in pairs
// but what happens if the servant is null
if (cookieHolder != null)
{
invokePostInvoke();
}
if (checkReplyEndTime && Time.hasPassed (request.getReplyEndTime()))
{
request.setSystemException
(new org.omg.CORBA.TIMEOUT ("Reply End Time exceeded after invocation",
0, CompletionStatus.COMPLETED_YES));
}
if (info != null)
{
InterceptorManager manager =
controller.getORB().getInterceptorManager();
info.setCurrent (manager.getCurrent());
short op = 0;
switch(request.status().value())
{
case ReplyStatusType_1_2._NO_EXCEPTION :
op = ServerInterceptorIterator.SEND_REPLY;
info.setReplyStatus (SUCCESSFUL.value);
break;
case ReplyStatusType_1_2._USER_EXCEPTION :
info.setReplyStatus (USER_EXCEPTION.value);
SystemExceptionHelper.insert(info.sending_exception,
new org.omg.CORBA.UNKNOWN("Stream-based UserExceptions are not available!"));
op = ServerInterceptorIterator.SEND_EXCEPTION;
break;
case ReplyStatusType_1_2._SYSTEM_EXCEPTION :
info.setReplyStatus (SYSTEM_EXCEPTION.value);
SystemExceptionHelper.insert(info.sending_exception,
request.getSystemException());
op = ServerInterceptorIterator.SEND_EXCEPTION;
break;
case ReplyStatusType_1_2._LOCATION_FORWARD :
info.setReplyStatus (LOCATION_FORWARD.value);
op = ServerInterceptorIterator.SEND_OTHER;
break;
}
invokeInterceptors(info, op);
ReplyOutputStream out =
request.get_out();
Enumeration ctx =
info.getReplyServiceContexts();
while( ctx.hasMoreElements() )
{
out.addServiceContext( (ServiceContext) ctx.nextElement() );
}
manager.removeTSCurrent();
}
}