jfinal 차단기 301 점프

5743 단어 jFinal
jfinal handle 에 추가
HandlerKit.redirect301("http://10.10.3.144:8080/bbb.rar", request, response, arg3);
일부 자신의 업무 논 리 는 무시 할 수 있다.
package com.dsideal.CommonIntercptor;



import java.util.concurrent.TimeoutException;



import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;



import net.rubyeye.xmemcached.exception.MemcachedException;



import com.dsideal.Util.SigarTest;

import com.jfinal.handler.Handler;

import com.jfinal.kit.HandlerKit;

import com.jfinal.plugin.memcached.MemcachedKit;

import com.jfinal.plugin.memcached.MemcachedPlugin;

import com.jfinal.render.RenderFactory;



public class ResourceHandler extends Handler{





    /**

     *    ,    

     */

    @Override

    public void handle(String target, HttpServletRequest request,

            HttpServletResponse response, boolean[] arg3) {

        



//        MemcachedPlugin memcachedPlugin = new MemcachedPlugin("10.10.3.151:11211");

//         memcachedPlugin.start();

        int index = target.indexOf("ReportServer");

        if (index == -1){

//            if (request.getRequestURI().indexOf(".") != -1) {

//                if (request.getRequestURI().substring(request.getRequestURI().lastIndexOf('.')).toLowerCase().equals(".zip")) {

                    try {

                        if(new Long((Long)MemcachedKit.get("dfTxBytesMb")).intValue() > 2) {

                            System.out.println("TxBytes(         ) = " + MemcachedKit.get("dfTxBytesMb") + "MB");

                            SigarTest.printA();

                            HandlerKit.redirect301("http://10.10.3.36:8817/aaa.rar", request, response, arg3);

                        } else {

                            System.out.println("TxBytes(         ) = " + MemcachedKit.get("dfTxBytesMb") + "MB");

                            SigarTest.printB();

                            HandlerKit.redirect301("http://10.10.3.144:8080/bbb.rar", request, response, arg3);

                        }

                    } catch (TimeoutException e) {

                        // TODO Auto-generated catch block

                        e.printStackTrace();

                    } catch (InterruptedException e) {

                        // TODO Auto-generated catch block

                        e.printStackTrace();

                    } catch (MemcachedException e) {

                        // TODO Auto-generated catch block

                        e.printStackTrace();

                    }

                    

//                }

//            }

                    

            nextHandler.handle(target, request, response, arg3);

            



        }

    }

}

좋은 웹페이지 즐겨찾기