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

esendex.sdk.java.service.resource.base.XmlResponderResource Maven / Gradle / Ivy

Go to download

The Esendex Java SDK is an easy to use client for our REST API that you can use to integrate SMS and Voice messaging into your Java application.

The newest version!

package esendex.sdk.java.service.resource.base;

import esendex.sdk.java.EsendexException;
import esendex.sdk.java.http.HttpQuery;
import esendex.sdk.java.model.transfer.Dto;
import esendex.sdk.java.service.auth.Authenticator;

/**
 * An XmlResponderResource is a resource that receives XML data
 * it does not send it.
 * 
 * @param  the Dto type that is expected in response
 */
public abstract class XmlResponderResource extends Resource {
	
	private XmlResponder responder;

	/**
	 * Instantiates a new xml responder resource.
	 * @param auth the authenticator
	 * @param account the account
	 * @param id the id
	 * @param query the query 
	 */
	public XmlResponderResource(Authenticator auth, String account, String id, HttpQuery query) {
		super(auth, account, id, query);
	}
	
	/**
	 * {@inheritDoc}
	 */
	@Override
	public void execute() throws EsendexException {
		super.execute();
		responder = new XmlResponder(getResponse().getContent());
	}
	
	/**
	 * Gets the response object.
	 * @return the response object
	 */
	public S getResponseObject() {
		return responder.getResponseObject();
	}
	
}