001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.wicket.jmx;
018
019import java.io.UnsupportedEncodingException;
020
021import org.apache.wicket.Session;
022import org.apache.wicket.markup.html.pages.BrowserInfoPage;
023
024/**
025 * Request cycle settings.
026 * 
027 * @author eelcohillenius
028 */
029public interface RequestCycleSettingsMBean
030{
031        /**
032         * @return True if this application buffers its responses
033         */
034        boolean getBufferResponse();
035
036        /**
037         * Gets whether Wicket should try to get extensive client info by redirecting to
038         * {@link BrowserInfoPage a page that polls for client capabilities}. This method is used by the
039         * default implementation of {@link Session#getClientInfo()}, so if that method is
040         * overridden, there is no guarantee this method will be taken into account.
041         * 
042         * @return Whether to gather extensive client info
043         */
044        boolean getGatherExtendedBrowserInfo();
045
046        /**
047         * In order to do proper form parameter decoding it is important that the response and the
048         * following request have the same encoding. see
049         * http://www.crazysquirrel.com/computing/general/form-encoding.jspx for additional information.
050         * 
051         * @return The request and response encoding
052         */
053        String getResponseRequestEncoding();
054
055        /**
056         * Gets the time (in milliseconds) that a request will by default be waiting for the previous request to be
057         * handled before giving up.
058         * 
059         * @return The time out in milliseconds
060         */
061        String getTimeout();
062
063        /**
064         * @param bufferResponse
065         *            True if this application should buffer responses.
066         */
067        void setBufferResponse(boolean bufferResponse);
068
069        /**
070         * Sets whether Wicket should try to get extensive client info by redirecting to
071         * {@link BrowserInfoPage a page that polls for client capabilities}. This method is used by the
072         * default implementation of {@link Session#getClientInfo()}, so if that method is
073         * overridden, there is no guarantee this method will be taken into account.
074         * 
075         * @param gatherExtendedBrowserInfo
076         *            Whether to gather extensive client info
077         */
078        void setGatherExtendedBrowserInfo(boolean gatherExtendedBrowserInfo);
079
080        /**
081         * In order to do proper form parameter decoding it is important that the response and the
082         * following request have the same encoding. see
083         * http://www.crazysquirrel.com/computing/general/form-encoding.jspx for additional information.
084         * 
085         * Default encoding: UTF-8
086         * 
087         * @param responseRequestEncoding
088         *            The request and response encoding to be used.
089         * @throws UnsupportedEncodingException
090         *             is encoding is not supported
091         */
092        void setResponseRequestEncoding(final String responseRequestEncoding)
093                throws UnsupportedEncodingException;
094
095        /**
096         * Sets the time (in milliseconds) that a request will by default be waiting for the previous request to be
097         * handled before giving up.
098         * 
099         * @param timeout in milliseconds
100         */
101        void setTimeout(String timeout);
102
103
104        /**
105         * Sets how many attempts Wicket will make to render the exception request handler before
106         *         giving up.
107         * @param retries
108         *      the number of attempts
109         */
110        void setExceptionRetryCount(int retries);
111
112        /**
113         * @return How many times will Wicket attempt to render the exception request handler before
114         *         giving up.
115         */
116        int getExceptionRetryCount();
117}