Reputation: 2910
We have the following scenario.
A web URL is exposed and we want to get and post requests to it in order to receive information about a user.
e.g. http://example.com/getBalance?userid=1234&username=example
The plan is to create a class that will have a number of methods that will be like
public class ClassA {
public int getBalance(string userId, string userName){
URL url= new URL("http://www.yahoo.com/");
URLConnection yc = url.openConnection();
BufferedReader in = new BufferedReader(
new InputStreamReader(
yc.getInputStream()));
return in.readLine())
}
...
}
And then use this class to make the http calls.
ClassA a = new Class();
a.getBalance(tdks123, name1);
Is this scenario a Facade pattern or an adapter pattern?
Upvotes: 1
Views: 211
Reputation: 4539
This is actually Session Facade design pattern ( J2EE design patterns). and in plain old patterns it is subset of Facade pattern.
Session facade pattern is used when :
You want to expose business components and services to remote clients.
RESTful web service is good example of session facade.
More info on Session Facade
Upvotes: 1