001    /*
002      Copyright (C) 2002 Laurent Martelli <laurent@aopsys.com>
003    
004      This program is free software; you can redistribute it and/or modify
005      it under the terms of the GNU Lesser General Public License as
006      published by the Free Software Foundation; either version 2 of the
007      License, or (at your option) any later version.
008    
009      This program is distributed in the hope that it will be useful,
010      but WITHOUT ANY WARRANTY; without even the implied warranty of
011      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012      GNU Lesser General Public License for more details.
013    
014      You should have received a copy of the GNU Lesser General Public License
015      along with this program; if not, write to the Free Software
016      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
017    
018    package org.objectweb.jac.aspects.gui.web;
019    
020    
021    /**
022     * This interface represents an HttpRequest.
023     */
024    public interface JacRequest {
025        /**
026         * Tells wether there is a parameter with a given name
027         * @param name the parameter's name whose presence to test
028         */
029        boolean contains(String name);
030    
031        /**
032         * Returns a parameter. The result can be a String or a FileParameter object.
033         * @param name the name of the parameter
034         * @return the value of the parameter (a String a or FileParameter)
035         * if the parameter exists in the request, null otherwise.
036         */
037        Object getParameter(String name);
038    
039        /**
040         * Returns a parameter. The result can be a String or a FileParameter object.
041         * @param name the name of the parameter
042         * @return the value of the parameter (a String a or FileParameter)
043         * if the parameter exists in the request, null otherwise.
044         */
045        Object[] getParameters(String name);
046    
047        /**
048         * Tells if the user agent of the request is Internet Explorer
049         *
050         * @return true if the user agent is Internet Explorer, false otherwise
051         * @see #userAgentMatch(String)
052         */
053        boolean isIEUserAgent();
054    
055        /**
056         * Tells if the user agent contains a given string
057         *
058         * @param s string to be searched in user agent
059         * @return true if the user agent is Internet Explorer, false otherwise
060         */
061        boolean userAgentMatch(String s);
062    
063        /**
064         * Returns the user agent of this request
065         * @return the user agent of this request
066         */
067        String getUserAgent();
068       
069        /**
070         * Gets the value of a header.
071         *
072         * @param name name of the header
073         * @return the value of the header
074         */
075        String getHeader(String name);
076    
077        /**
078         * Makes the current requesting thread block and wait until the
079         * response is available.
080         *
081         * <p>The thread that call this method waits until a call to
082         * <code>setResponse</code> occurs or a timeout occurs.
083         *
084         * @return false if a timeout occured, true otherwise.
085         *
086         * @see #setResponse() 
087         */
088        boolean waitForResponse();
089    
090        /**
091         * Unblock a thread that was blocked by a <code>waitForResult</code> call.
092         *
093         * @see #waitForResponse() 
094         */
095        void setResponse();
096    
097    }