Hi All,
I'm struggling with trying to implement conditionality in Server processing. What I am doing now is: myServer processOn: 12345 using: [ :requestObject | [requestObject processThis] fork. responseObject ] This allows processThis to happen and responseObject to come back. What I'd like to do is: myServer processOn: 12345 using: [ :requestObject | [requestObject is MemberOf:A] ifTrue:[(requestObject instVarL)='somevalue' ifTrue:[ ResponseObject1 instVarA:( (requestObject instVarL) ) ].] [requestObject is MemberOf:B] ifTrue:[(requestObject instVarT)='somevalue' ifTrue:[ ResponseObject2 doSomething:(requestObject)].] ] I'd like to get a response without forking.... so that the responseObject is based on the conditionality and the value of one of its instance variables is based on some processing of an instance variable of the requestObject. Is there something structurally wrong with what I am trying to do, i.e. introduce conditionality within the processOn method? Kind regards, Hari _______________________________________________ Magma mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/magma |
Hi Hari,
forking from your process block is not normal usage.. > What I'd like to do is: > > > myServer > > processOn: 12345 > > using: > > [ :requestObject | > > [requestObject is MemberOf:A] ifTrue:[(requestObject instVarL)='somevalue' ifTrue:[ ResponseObject1 instVarA:( (requestObject instVarL) ) ].] > > [requestObject is MemberOf:B] ifTrue:[(requestObject instVarT)='somevalue' ifTrue:[ ResponseObject2 doSomething:(requestObject)].] > > > ] > > I'd like to get a response without forking.... The request-handling block above, needs to evaluate to the response object, but the block above is written as: condition1 ifTrue: [ create1 ]. condition2 ifTrue: [ create2 ] create1 will *never* be returned. It'll just create it and then move on to test condition2. Every time its false, it'll answer nil, which is why your client doesn't get a response; because returning nil is a way to have a request-only type of request (no response). You can't use return carats, so you need to structure it as a single expression like this: condition1 ifTrue: [ create1 ] ifFalse: [ condition2 ifTrue: [ create2 ] ifFalse: [ InvalidRequest signal ] ] Best, Chris > so that the responseObject is based on the conditionality and the value of one of its instance variables is based on some processing of an instance variable of the requestObject. > > > Is there something structurally wrong with what I am trying to do, i.e. introduce conditionality within the processOn method? > > > Kind regards, > > > Hari > _______________________________________________ > Magma mailing list > [hidden email] > http://lists.squeakfoundation.org/mailman/listinfo/magma Magma mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/magma |
Free forum by Nabble | Edit this page |