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

com.fastchar.out.FastOutRedirect Maven / Gradle / Ivy

package com.fastchar.out;

import com.fastchar.core.FastAction;
import com.fastchar.core.FastChar;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class FastOutRedirect extends FastOut {

    @Override
    public void response(FastAction action) throws Exception {
        String url = FastChar.wrapperUrl(String.valueOf(data));
        HttpServletResponse response = action.getResponse();
        response.setStatus(getStatus());
        if (getStatus() == 301) {
            this.setDescription("moved permanently  to '" + url + "'");
            response.setHeader("Location", url);
            response.setHeader("Connection", "close");
        } else {
            this.setDescription("redirect to url '" + url + "'");
            response.sendRedirect(url);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy