Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
jerry-http - Common Java Functionality Copyright (c) 2012-2014, Sandeep Gupta http://sangupta.com/projects/jerry-http Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
package com.sangupta.jerry.http;

Contract for an interceptor that can be added to the WebInvoker utility classes to add hooks before and after invocation.

Author(s):
sangupta
Since:
0.2.0
public interface WebInvocationInterceptor {

Intercepting method that is invoked before each request of WebInvoker is made thus providing a way to add hooks to modify the request originating from somewhere else. The URL provided here contains all query parameters that might have been added. In case of POST requests the query parameters are not added.

Parameters:
url the URL whose invocation has been requested
method the HTTP verb for the invocation
Returns:
a WebResponse object that may be returned back to the calling code if continueInvocation() returns false. If continueInvocation() returns true, the return value of this method is ignored.
Indicates whether invocation should continue as per the original plan.

Returns:
true if invocation needs to be continues, false otherwise.
	public boolean continueInvocation();

Intercepting method that is invoked after each request of WebInvoker thus providing a way to add hooks to update the response received from the server. This may be needed in scenarios like mock testing.

Parameters:
response the response as received from the server
Returns:
response that needs to be sent back to the calling code
New to GrepCode? Check out our FAQ X