overflow_discovery/server/rpc_servlet_handlers.go

38 lines
1.2 KiB
Go
Raw Normal View History

2017-11-29 00:36:19 +00:00
package server
import (
"git.loafle.net/commons_go/rpc"
crcs "git.loafle.net/commons_go/rpc/connection/socket"
"git.loafle.net/commons_go/rpc/protocol"
"git.loafle.net/commons_go/rpc/server"
)
func newRPCServletHandler(rpcRegistry rpc.Registry) server.ServletHandler {
sh := &RPCServletHandlers{}
sh.RPCRegistry = rpcRegistry
return sh
}
type RPCServletHandlers struct {
server.ServletHandlers
rpcIO crcs.ServletHandlers
}
func (sh *RPCServletHandlers) ReadRequest(servletCTX rpc.ServletContext, codec protocol.ServerCodec, conn interface{}) (protocol.ServerRequestCodec, error) {
return sh.rpcIO.ReadRequest(servletCTX, codec, conn)
}
func (sh *RPCServletHandlers) WriteResponse(servletCTX rpc.ServletContext, conn interface{}, requestCodec protocol.ServerRequestCodec, result interface{}, err error) error {
return sh.rpcIO.WriteResponse(servletCTX, conn, requestCodec, result, err)
}
func (sh *RPCServletHandlers) WriteNotification(servletCTX rpc.ServletContext, conn interface{}, codec protocol.ServerCodec, method string, args []interface{}) error {
return sh.rpcIO.WriteNotification(servletCTX, conn, codec, method, args)
}
func (sh *RPCServletHandlers) Validate() {
sh.ServletHandlers.Validate()
}