All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.xins.client.XINSCallConfig Maven / Gradle / Ivy

There is a newer version: 3.0
Show newest version
/*
 * $Id: XINSCallConfig.java,v 1.22 2007/03/15 17:08:27 agoubard Exp $
 *
 * Copyright 2003-2007 Orange Nederland Breedband B.V.
 * See the COPYRIGHT file for redistribution and use restrictions.
 */
package org.xins.client;

import org.xins.common.MandatoryArgumentChecker;
import org.xins.common.http.HTTPCallConfig;
import org.xins.common.http.HTTPMethod;
import org.xins.common.service.CallConfig;
import org.xins.common.text.TextUtils;

/**
 * Call configuration for the XINS service caller. The HTTP method can be configured.
 * By default it is set to POST.
 *
 * 

This class is not thread safe

* * @version $Revision: 1.22 $ $Date: 2007/03/15 17:08:27 $ * @author Ernst de Haan * * @since XINS 1.1.0 */ public final class XINSCallConfig extends CallConfig { /** * The underlying HTTP call config. Cannot be null. */ private HTTPCallConfig _httpCallConfig; /** * Constructs a new XINSCallConfig object. */ public XINSCallConfig() { // Construct an underlying HTTPCallConfig _httpCallConfig = new HTTPCallConfig(); // Configure the User-Agent header String userAgent = "XINS/Java Client Framework " + Library.getVersion(); _httpCallConfig.setUserAgent(userAgent); // NOTE: HTTPCallConfig already defaults to HTTP POST } /** * Returns an HTTPCallConfig object that corresponds with this * XINS call configuration object. * * @return * an {@link HTTPCallConfig} object, never null. */ HTTPCallConfig getHTTPCallConfig() { return _httpCallConfig; } /** * Returns the HTTP method associated with this configuration. * * @return * the HTTP method, never null. */ public HTTPMethod getHTTPMethod() { return _httpCallConfig.getMethod(); } /** * Sets the HTTP method associated with this configuration. * * @param method * the HTTP method to be associated with this configuration, cannot be * null. * * @throws IllegalArgumentException * if method == null. */ public void setHTTPMethod(HTTPMethod method) throws IllegalArgumentException { // Check preconditions MandatoryArgumentChecker.check("method", method); // Store the setting in the HTTP call configuration _httpCallConfig.setMethod(method); } /** * Describes this configuration. * * @return * the description of this configuration, should never be * null, should never be empty and should never start or * end with whitespace characters. */ public String describe() { String description = "XINS call config [failOverAllowed=" + isFailOverAllowed() + "; method=" + TextUtils.quote(_httpCallConfig.getMethod().toString()) + ']'; return description; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy