All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.silentgo.core.action.GZipAction Maven / Gradle / Ivy

There is a newer version: 0.0.49
Show newest version
package com.silentgo.core.action;

import com.silentgo.core.action.annotation.Action;
import com.silentgo.core.action.gzip.GZIPResponseWrapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Project : parent
 * Package : com.silentgo.core.action
 *
 * @author teddyzhu
 *         

* Created by teddyzhu on 2016/10/8. */ @Action public class GZipAction extends ActionChain { private static final Logger LOGGER = LoggerFactory.getLogger(GZipAction.class); @Override public Integer priority() { return Integer.MIN_VALUE + 1; } @Override public void doAction(ActionParam param) throws Throwable { LOGGER.info("enter gzip action"); String ae = param.getRequest().getHeader("accept-encoding"); //check if browser support gzip if (ae != null && ae.contains("gzip")) { GZIPResponseWrapper wrappedResponse = new GZIPResponseWrapper(param.getResponse()); param.setResponse(wrappedResponse); nextAction.doAction(param); wrappedResponse.finishResponse(); } else { nextAction.doAction(param); } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy