FileProcessorSlotChain.java 706 B

12345678910111213141516171819
  1. package cn.nosum.gateway.slot.chain;
  2. import cn.nosum.common.http.entity.Context;
  3. import cn.nosum.common.util.LinuxCmd;
  4. import cn.nosum.common.util.NettyFileUtil;
  5. import cn.nosum.gateway.slot.AbstractLinkedProcessorSlot;
  6. import com.alibaba.fastjson.JSON;
  7. /**
  8. * 创建文件,进行IO操作
  9. */
  10. public class FileProcessorSlotChain extends AbstractLinkedProcessorSlot<Context> {
  11. @Override
  12. public void exec(Context context) throws Throwable {
  13. NettyFileUtil.dataToFile(JSON.toJSONString(context.getRequest().getParameters()), context.getRequest().getUrl(), true);
  14. context.setResult(LinuxCmd.executeLinuxCmd("stat "+context.getRequest().getUrl()));
  15. fireExec(context);
  16. }
  17. }