Example usage for javax.servlet.http HttpServletResponseWrapper getResponse

List of usage examples for javax.servlet.http HttpServletResponseWrapper getResponse

Introduction

In this page you can find the example usage for javax.servlet.http HttpServletResponseWrapper getResponse.

Prototype


public ServletResponse getResponse() 

Source Link

Document

Return the wrapped ServletResponse object.

Usage

From source file:com.flexive.faces.FxJsfUtils.java

/**
 * Gets the response from the faces context.
 * <p/>/*from   www . j a  v a 2s  . com*/
 * The result is null if no faces context is available.
 *
 * @return the response from the faces context
 */
public static FxResponseWrapper getResponse() {
    HttpServletResponseWrapper resp = (HttpServletResponseWrapper) getCurrentInstance().getExternalContext()
            .getResponse();
    FxResponseWrapper fresp;
    if (resp == null) {
        fresp = null;
    } else if (resp instanceof FxResponseWrapper) {
        fresp = (FxResponseWrapper) resp;
    } else {
        fresp = (FxResponseWrapper) resp.getResponse();
    }
    return fresp;
}

From source file:servletunit.struts.MockStrutsTestCase.java

/**
 * Set this TestCase to use a given HttpServletResponseWrapper
 * class when calling Action.execute().  Note that if this
 * method is not called, then the normal HttpServletResponse
 * object is used.// w w  w  .  j a v  a 2 s .c  o m
 *
 * @param wrapper an HttpServletResponseWrapper object to be
 *                used when calling Action.execute().
 */
public void setResponseWrapper(HttpServletResponseWrapper wrapper) {
    if (logger.isDebugEnabled())
        logger.debug("Entering - wrapper = " + wrapper);
    init();
    if (wrapper == null)
        throw new IllegalArgumentException("wrapper class cannot be null!");
    else {
        if (wrapper.getResponse() == null)
            wrapper.setResponse(this.response);
        this.responseWrapper = wrapper;
    }
    if (logger.isDebugEnabled())
        logger.debug("Exiting");
}