01: /*
02: * (C) Copyright 2000 - 2005 Nabh Information Systems, Inc.
03: *
04: * This program is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU General Public License
06: * as published by the Free Software Foundation; either version 2
07: * of the License, or (at your option) any later version.
08: *
09: * This program is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: * GNU General Public License for more details.
13: *
14: * You should have received a copy of the GNU General Public License
15: * along with this program; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17: *
18: */
19:
20: package com.nabhinc.ws.server;
21:
22: import java.io.IOException;
23:
24: import com.nabhinc.ws.core.WebServiceException;
25:
26: /**
27: * A component that intercepts a Web service request. Stringbeans
28: * Web service framework allows the deployer to attach interceptors
29: * globally, or on selective methods of specified Web services.
30: *
31: * @author Padmanabh Dabke
32: * (c) 2005 Nabh Information Systems, Inc. All Rights Reserved.
33: */
34: public interface Interceptor extends ServerObject {
35:
36: /**
37: * Invoked when the container receives a Web service method
38: * invocation request that this interceptor is attached to.
39: * The interceptor has access to service info, method, and
40: * request arguments and can choose to modify that information.
41: * After it's processing it done, the interceptor has three options:
42: * <ul>
43: * <li>
44: * Process
45: * rest of the chain via <code>doIntercept</code> method on
46: * <code>InterceptorChain</code> supplied as an argument. In some
47: * rare cases, an interceptor can also re-position the interceptor
48: * invocation by invoking <code>setCurrentPosition</code> method
49: * on <code>InterceptorChain</code>.
50: * </li>
51: * <li>
52: * Set up the result and return without invoking the
53: * rest of the chain
54: * </li>
55: * <li>
56: * Set the <code>redirect</code> attribute on <code>RequestInfo</code>
57: * object and return, resulting in the request being redirected.
58: * </li>
59: * <li>
60: * Throw <code>WebServiceException</code> or
61: * <code>WebServiceSecurityException</code> if the request cannot
62: * be passed on to the next interceptor based on application logic
63: * (for example, the use is not authenticated).
64: * </li>
65: * <li>Throw <code>InterceptorUnavailableException</code> if there
66: * is an internal error that prevents the interceptor from executing
67: * its business logic. If this happens, the interceptor will be
68: * unloaded. If it is marked critical, the current request will fail.
69: * Otherwise the next interceptor will be called (or service method
70: * is invoked if this was the last interceptor).
71: * </li>
72: * </ul>
73: * @param reqInfo Object providing information about current request
74: * @param chain Interceptor chain
75: * @throws WebServiceException
76: * @throws InterceptorUnavailableException Thrown if the interceptor
77: * encounters an internal exception.
78: * @throws IOException
79: */
80: void intercept(RequestInfo reqInfo, InterceptorChain chain)
81: throws WebServiceException,
82: InterceptorUnavailableException, IOException;
83:
84: }
|