com.linkedin.r2.message.BaseRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of r2-core Show documentation
Show all versions of r2-core Show documentation
Pegasus is a framework for building robust, scalable service architectures using dynamic discovery and simple asychronous type-checked REST + JSON APIs.
The newest version!
package com.linkedin.r2.message;
import com.linkedin.util.ArgumentUtil;
import java.net.URI;
import java.util.List;
import java.util.Map;
/**
* Abstract base class for request.
*
* @author Zhenkai Zhu
*/
public abstract class BaseRequest extends BaseMessage implements Request
{
private final URI _uri;
private final String _method;
protected BaseRequest(Map headers, List cookies, URI uri, String method)
{
super(headers, cookies);
ArgumentUtil.notNull(uri, "uri");
ArgumentUtil.notNull(method, "method");
_uri = uri;
_method = method;
}
@Override
public URI getURI()
{
return _uri;
}
@Override
public String getMethod()
{
return _method;
}
@Override
public boolean equals(Object o)
{
if (this == o)
{
return true;
}
if (!(o instanceof BaseRequest))
{
return false;
}
if (!super.equals(o))
{
return false;
}
BaseRequest that = (BaseRequest) o;
return _method.equals(that._method) && _uri.equals(that._uri);
}
@Override
public int hashCode()
{
int result = super.hashCode();
result = 31 * result + _uri.hashCode();
result = 31 * result + _method.hashCode();
return result;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy