Package org.apache.wink.server.handlers

Examples of org.apache.wink.server.handlers.ResponseHandlersChain


     * Initializes the Response Handlers Chain (the chain that handles the
     * out-bound response). Usually the user won't need to override this method,
     * but <tt>initResponseUserHandlers</tt> instead.
     */
    protected ResponseHandlersChain initResponseHandlersChain() {
        ResponseHandlersChain handlersChain = new ResponseHandlersChain();
        handlersChain.addHandler(createHandler(PopulateResponseStatusHandler.class));
        handlersChain.addHandler(createHandler(PopulateResponseMediaTypeHandler.class));
        for (ResponseHandler h : responseUserHandlers) {
            h.init(properties);
            handlersChain.addHandler(h);
        }
        handlersChain.addHandler(createHandler(FlushResultHandler.class));
        handlersChain.addHandler(createHandler(HeadMethodHandler.class));
        return handlersChain;
    }
View Full Code Here


     * Initializes the Error Handlers Chain (the chain that handles the
     * exceptions). Usually the user won't need to override this method, but
     * <tt>initErrorUserHandlers</tt> instead.
     */
    protected ResponseHandlersChain initErrorHandlersChain() {
        ResponseHandlersChain handlersChain = new ResponseHandlersChain();
        handlersChain.addHandler(createHandler(PopulateErrorResponseHandler.class));
        handlersChain.addHandler(createHandler(PopulateResponseStatusHandler.class));
        PopulateResponseMediaTypeHandler populateMediaTypeHandler =
            createHandler(PopulateResponseMediaTypeHandler.class);
        populateMediaTypeHandler.setErrorFlow(true);
        handlersChain.addHandler(populateMediaTypeHandler);
        for (ResponseHandler h : errorUserHandlers) {
            h.init(properties);
            handlersChain.addHandler(h);
        }
        handlersChain.addHandler(createHandler(FlushResultHandler.class));
        return handlersChain;
    }
View Full Code Here

     * Initializes the Response Handlers Chain (the chain that handles the
     * out-bound response). Usually the user won't need to override this method,
     * but <tt>initResponseUserHandlers</tt> instead.
     */
    protected ResponseHandlersChain initResponseHandlersChain() {
        ResponseHandlersChain handlersChain = new ResponseHandlersChain();
        handlersChain.addHandler(createHandler(PopulateResponseStatusHandler.class));
        handlersChain.addHandler(createHandler(PopulateResponseMediaTypeHandler.class));
        if (responseUserHandlers != null) {
            for (ResponseHandler h : responseUserHandlers) {
                h.init(properties);
                handlersChain.addHandler(h);
            }
        }
        handlersChain.addHandler(createHandler(FlushResultHandler.class));
        handlersChain.addHandler(createHandler(HeadMethodHandler.class));
        logger.debug("Response handlers chain is: {}", handlersChain);
        return handlersChain;
    }
View Full Code Here

     * Initializes the Error Handlers Chain (the chain that handles the
     * exceptions). Usually the user won't need to override this method, but
     * <tt>initErrorUserHandlers</tt> instead.
     */
    protected ResponseHandlersChain initErrorHandlersChain() {
        ResponseHandlersChain handlersChain = new ResponseHandlersChain();
        handlersChain.addHandler(createHandler(PopulateErrorResponseHandler.class));
        handlersChain.addHandler(createHandler(PopulateResponseStatusHandler.class));
        PopulateResponseMediaTypeHandler populateMediaTypeHandler =
            createHandler(PopulateResponseMediaTypeHandler.class);
        populateMediaTypeHandler.setErrorFlow(true);
        handlersChain.addHandler(populateMediaTypeHandler);
        if (errorUserHandlers != null) {
            for (ResponseHandler h : errorUserHandlers) {
                h.init(properties);
                handlersChain.addHandler(h);
            }
        }
        handlersChain.addHandler(createHandler(FlushResultHandler.class));
        logger.debug("Error handlers chain is: {}", handlersChain);
        return handlersChain;
    }
View Full Code Here

     * Initializes the Response Handlers Chain (the chain that handles the
     * out-bound response). Usually the user won't need to override this method,
     * but <tt>initResponseUserHandlers</tt> instead.
     */
    protected ResponseHandlersChain initResponseHandlersChain() {
        ResponseHandlersChain handlersChain = new ResponseHandlersChain();
        handlersChain.addHandler(createHandler(PopulateResponseStatusHandler.class));
        handlersChain.addHandler(createHandler(PopulateResponseMediaTypeHandler.class));
        if (responseUserHandlers != null) {
            for (ResponseHandler h : responseUserHandlers) {
                h.init(properties);
                handlersChain.addHandler(h);
            }
        }
        handlersChain.addHandler(createHandler(FlushResultHandler.class));
        handlersChain.addHandler(createHandler(HeadMethodHandler.class));
        logger.debug("Response handlers chain is: {}", handlersChain); //$NON-NLS-1$
        return handlersChain;
    }
View Full Code Here

     * Initializes the Error Handlers Chain (the chain that handles the
     * exceptions). Usually the user won't need to override this method, but
     * <tt>initErrorUserHandlers</tt> instead.
     */
    protected ResponseHandlersChain initErrorHandlersChain() {
        ResponseHandlersChain handlersChain = new ResponseHandlersChain();
        handlersChain.addHandler(createHandler(PopulateErrorResponseHandler.class));
        handlersChain.addHandler(createHandler(PopulateResponseStatusHandler.class));
        PopulateResponseMediaTypeHandler populateMediaTypeHandler =
            createHandler(PopulateResponseMediaTypeHandler.class);
        populateMediaTypeHandler.setErrorFlow(true);
        handlersChain.addHandler(populateMediaTypeHandler);
        if (errorUserHandlers != null) {
            for (ResponseHandler h : errorUserHandlers) {
                h.init(properties);
                handlersChain.addHandler(h);
            }
        }
        handlersChain.addHandler(createHandler(FlushResultHandler.class));
        logger.debug("Error handlers chain is: {}", handlersChain); //$NON-NLS-1$
        return handlersChain;
    }
View Full Code Here

     * Initializes the Response Handlers Chain (the chain that handles the
     * out-bound response). Usually the user won't need to override this method,
     * but <tt>initResponseUserHandlers</tt> instead.
     */
    protected ResponseHandlersChain initResponseHandlersChain() {
        ResponseHandlersChain handlersChain = new ResponseHandlersChain();
        handlersChain.addHandler(createHandler(PopulateResponseStatusHandler.class));
        handlersChain.addHandler(createHandler(PopulateResponseMediaTypeHandler.class));
        if (responseUserHandlers != null) {
            for (ResponseHandler h : responseUserHandlers) {
                h.init(properties);
                handlersChain.addHandler(h);
            }
        }
        handlersChain.addHandler(createHandler(FlushResultHandler.class));
        handlersChain.addHandler(createHandler(HeadMethodHandler.class));
        logger.debug("Response handlers chain is: {}", handlersChain); //$NON-NLS-1$
        return handlersChain;
    }
View Full Code Here

     * Initializes the Error Handlers Chain (the chain that handles the
     * exceptions). Usually the user won't need to override this method, but
     * <tt>initErrorUserHandlers</tt> instead.
     */
    protected ResponseHandlersChain initErrorHandlersChain() {
        ResponseHandlersChain handlersChain = new ResponseHandlersChain();
        handlersChain.addHandler(createHandler(PopulateErrorResponseHandler.class));
        handlersChain.addHandler(createHandler(PopulateResponseStatusHandler.class));
        PopulateResponseMediaTypeHandler populateMediaTypeHandler =
            createHandler(PopulateResponseMediaTypeHandler.class);
        populateMediaTypeHandler.setErrorFlow(true);
        handlersChain.addHandler(populateMediaTypeHandler);
        if (errorUserHandlers != null) {
            for (ResponseHandler h : errorUserHandlers) {
                h.init(properties);
                handlersChain.addHandler(h);
            }
        }
        handlersChain.addHandler(createHandler(FlushResultHandler.class));
        logger.debug("Error handlers chain is: {}", handlersChain); //$NON-NLS-1$
        return handlersChain;
    }
View Full Code Here

        assertEquals(4, Handler2.requests);
        assertEquals(3, Handler3.requests);
    }

    public void testResponseChain() throws Throwable {
        ResponseHandlersChain chain = new ResponseHandlersChain();
        chain.addHandler(new Handler1());
        chain.addHandler(new Handler2());
        chain.addHandler(new Handler3());

        chain.run(null);
        assertEquals(1, Handler1.responses);
        assertEquals(1, Handler2.responses);
        assertEquals(1, Handler3.responses);

        chain.run(null);
        assertEquals(2, Handler1.responses);
        assertEquals(2, Handler2.responses);
        assertEquals(3, Handler3.responses);

        chain.run(null);
        assertEquals(3, Handler1.responses);
        assertEquals(4, Handler2.responses);
        assertEquals(3, Handler3.responses);

        chain.run(null);
        assertEquals(4, Handler1.responses);
        assertEquals(4, Handler2.responses);
        assertEquals(3, Handler3.responses);
    }
View Full Code Here

        assertEquals(4, Handler2.requests);
        assertEquals(3, Handler3.requests);
    }

    public void testResponseChain() throws Throwable {
        ResponseHandlersChain chain = new ResponseHandlersChain();
        chain.addHandler(new Handler1());
        chain.addHandler(new Handler2());
        chain.addHandler(new Handler3());

        chain.run(null);
        assertEquals(1, Handler1.responses);
        assertEquals(1, Handler2.responses);
        assertEquals(1, Handler3.responses);

        chain.run(null);
        assertEquals(2, Handler1.responses);
        assertEquals(2, Handler2.responses);
        assertEquals(3, Handler3.responses);

        chain.run(null);
        assertEquals(3, Handler1.responses);
        assertEquals(4, Handler2.responses);
        assertEquals(3, Handler3.responses);

        chain.run(null);
        assertEquals(4, Handler1.responses);
        assertEquals(4, Handler2.responses);
        assertEquals(3, Handler3.responses);
    }
View Full Code Here

TOP

Related Classes of org.apache.wink.server.handlers.ResponseHandlersChain

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.