Rev 30 | Blame | Compare with Previous | Last modification | View Log | RSS feed
---- Licensed to the Apache Software Foundation (ASF) under one-- or more contributor license agreements. See the NOTICE file-- distributed with this work for additional information-- regarding copyright ownership. The ASF licenses this file-- to you under the Apache License, Version 2.0 (the-- "License"); you may not use this file except in compliance-- with the License. You may obtain a copy of the License at---- http://www.apache.org/licenses/LICENSE-2.0---- Unless required by applicable law or agreed to in writing,-- software distributed under the License is distributed on an-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY-- KIND, either express or implied. See the License for the-- specific language governing permissions and limitations-- under the License.--module Server whereimport ThriftTestimport ThriftTest_Ifaceimport Data.Map as Mapimport Control.Exceptionimport ThriftTest_Typesimport Thriftimport Thrift.Serverdata TestHandler = TestHandlerinstance ThriftTest_Iface TestHandler wheretestVoid a = return ()testString a (Just s) = do print s; return stestByte a (Just x) = do print x; return xtestI32 a (Just x) = do print x; return xtestI64 a (Just x) = do print x; return xtestDouble a (Just x) = do print x; return xtestStruct a (Just x) = do print x; return xtestNest a (Just x) = do print x; return xtestMap a (Just x) = do print x; return xtestSet a (Just x) = do print x; return xtestList a (Just x) = do print x; return xtestEnum a (Just x) = do print x; return xtestTypedef a (Just x) = do print x; return xtestMapMap a (Just x) = return (Map.fromList [(1,Map.fromList [(2,2)])])testInsanity a (Just x) = return (Map.fromList [(1,Map.fromList [(ONE,x)])])testMulti a a1 a2 a3 a4 a5 a6 = return (Xtruct Nothing Nothing Nothing Nothing)testException a c = throw (Xception (Just 1) (Just "bya"))testMultiException a c1 c2 = throw (Xception (Just 1) (Just "xyz"))testOneway a (Just i) = do print imain = do (runBasicServer TestHandler process 9090)`Control.Exception.catch`(\(TransportExn s t) -> print s)