001package votorola.a.web.wap; // Copyright 2011-2012, Michael Allan.  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Votorola Software"), to deal in the Votorola Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicence, and/or sell copies of the Votorola Software, and to permit persons to whom the Votorola Software is furnished to do so, subject to the following conditions: The preceding copyright notice and this permission notice shall be included in all copies or substantial portions of the Votorola Software. THE VOTOROLA SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE VOTOROLA SOFTWARE OR THE USE OR OTHER DEALINGS IN THE VOTOROLA SOFTWARE.
002
003import java.io.*;
004import javax.servlet.*;
005import javax.servlet.http.*;
006import votorola.g.lang.*;
007import votorola.g.web.*;
008
009
010/** An independent component within a composite request, incorporating a responder.
011  */
012public abstract @ThreadRestricted("constructor") class Call
013{
014
015
016    /** The class initializer.  This method is called once prior to first construction.
017      * The implementation in the base class is empty and does nothing.
018      */
019    public static @ThreadSafe void init( final WAP wap ) throws ServletException {}
020
021
022
023    /** Constructs a Call.  Each concrete subclass provides a constructor with the same
024      * profile as this, except with public rather than protected access.  In addition,
025      * the subclass may provide a class initializer with the same profile as {@linkplain
026      * #init(WAP) init}(wap).
027      *
028      *     @see #prefix()
029      *     @see #req()
030      */
031    protected Call( String _prefix, Requesting _req, ResponseConfiguration _resConfig )
032      throws HTTPRequestException
033    {
034        prefix = _prefix;
035        req = _req;
036    }
037
038
039
040   // - C a l l --------------------------------------------------------------------------
041
042
043    /** The prefix assigned to this call.
044      */
045    public final String prefix() { return prefix; }
046
047
048        private final String prefix;
049
050
051
052    /** The request context.
053      */
054    public final Requesting req() { return req; }
055
056
057        private final Requesting req;
058
059
060
061    /** Responds to the call.
062      */
063    public abstract void respond( final Responding res ) throws IOException;
064
065
066
067}