コード例 #1
0
ファイル: Connection.java プロジェクト: fengwuze/pigeon
 public void filtrate(Channel channel, FilterChain<Channel> chain) throws Exception {
   Invocation request = (Invocation) channel.getAttribute(CHANNEL_INVOCATION_ATTRIBUTE_KEY);
   Collection<Step> steps = processings.get(request.getMethod()).values();
   channel.send(null, request, beanFactory, streamFactory, new ArrayList<Step>(steps));
   State status = channel.getStatus();
   switch (status.getCode()) {
     case HttpURLConnection.HTTP_OK:
       {
         Method method = correspondences.get(request.getMethod());
         Invocation response =
             channel.receive(null, method, beanFactory, streamFactory, new ArrayList<Step>(steps));
         request.setServerHeader(response.getServerHeader());
         request.setResult(response.getResult());
         break;
       }
     default:
       throw new RemoteMethodException(
           channel.getStatus().getCode(),
           channel.getStatus().getMessage(),
           IOToolkit.toString(channel));
   }
 }