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(Responses.class));
        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.trace("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();

        Responses responsesHandler = createHandler(Responses.class);
        responsesHandler.setIsErrorFlow(true);
        handlersChain.addHandler(responsesHandler);

        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.trace("Error handlers chain is: {}", handlersChain); //$NON-NLS-1$
        return handlersChain;
    }
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.