gnu.xml.pipeline
Class CallFilter
- EventConsumer
Input is sent as an XML request to given URI, and the output of this
filter is the parsed response to that request.
A connection is opened to the remote URI when the startDocument call is
issued through this filter, and the request is finished when the
endDocument call is issued. Events should be written quickly enough to
prevent the remote HTTP server from aborting the connection due to
inactivity; you may want to buffer text in an earlier pipeline stage.
If your application requires validity checking of such
outputs, have the output pipeline include a validation stage.
In effect, this makes a remote procedure call to the URI, with the
request and response document syntax as chosen by the application.
Note that all the input events must be seen, and sent to the URI,
before the first output event can be seen. Clients are delayed
at least by waiting for the server to respond, constraining concurrency.
Services can thus be used to synchronize concurrent activities, and
even to prioritize service among different clients.
You are advised to avoid restricting yourself to an "RPC" model
for distributed computation. With a World Wide Web, network latencies
and failures (e.g. non-availability)
are significant; adopting a "procedure" model, rather than a workflow
model where bulk requests are sent and worked on asynchronously, is not
generally an optimal system-wide architecture. When the messages may
need authentication, such as with an OpenPGP signature, or when server
loads don't argue in favor of immediate responses, non-RPC models can
be advantageous. (So-called "peer to peer" computing models are one
additional type of model, though too often that term is applied to
systems that still have a centralized control structure.)
Be strict in what you send, liberal in what you accept, as
the Internet tradition goes. Strictly conformant data should never cause
problems to its receiver; make your request pipeline be very strict, and
don't compromise on that. Make your response pipeline strict as well,
but be ready to tolerate specific mild, temporary, and well-documented
variations from specific communications peers.
CallFilter(String uri, EventConsumer next) - Initializes a call filter so that its inputs are sent to the
specified URI, and its outputs are sent to the next consumer
provided.
|
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
CallFilter
public CallFilter(String uri,
EventConsumer next)
throws IOException
Initializes a call filter so that its inputs are sent to the
specified URI, and its outputs are sent to the next consumer
provided.
setCallTarget
public final void setCallTarget(String uri)
throws IOException
Assigns the URI of the call target to be used.
Does not affect calls currently being made.
CallFilter.java --
Copyright (C) 1999,2000,2001 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.