package de.ivu.elect.presentation;

import java.io.IOException;

import javax.faces.component.FacesComponent;
import javax.faces.component.UIComponentBase;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletResponse;

/**
 * ELECT-7773
 */
@FacesComponent(createTag = true, tagName = "cdata", namespace = "http://www.ivu.de/elect/tags", value = "de.ivu.elect.presentation.IvuCdata")
public class IvuCdata extends UIComponentBase {

  public static final String HEADER_MARKER = "CDP";

  @Override
  public String getFamily() {
    return "";
  }

  @Override
  public void encodeBegin(FacesContext context) throws IOException {
    super.encodeBegin(context);
    if (isRendered()) {
      ((HttpServletResponse) context.getExternalContext().getResponse()).setHeader(HEADER_MARKER, "TRUE");
    }
  }
}