Você está na página 1de 2

EI1021 Sistemas Distribuidos

Clases y métodos
Sockets

public class MiSocketStream { public class ServerSocket{


public MiSocketStream(InetAddress host, int port) {...} public ServerSocket(int puerto) { … }
public MiSocketStream(Socket socket) {....} public Socket accept() { … }
public String recibeMensaje() { …. } …
public void enviaMensaje(String resp) { …. } }
public void close() { …. }

RMI

Métodos de la clase Naming:


void rebind(String URLName, Remote obj);
Remote lookup(String URLName);

Métodos de la clase Map<K,V>:


boolean containsKey(Object key); // true si key ya está en el Map
boolean containsValue(Object value) // true si el Map contiene una o más keys
asociadas a value
V get(Object key); // Devuelve el valor asociado a key
V remove(Object key); // Borra el objeto asociado a key si existe, sino devuelve null
V put(K key, V value); // Devuelve el valor previo asociado con key o null si no había
ninguno
int size(); // Devuelve el tamaño del Map
Set<K> keySet(); // Devuelve un conjunto con las claves

Servlets

Métodos de la clase HttpServletRequest


String getMethod();
String getQueryString();
String getParameter(String name);
String[] getParameterValues(String name);
HttpSession getSession(boolean create);
Métodos de la clase HttpServletResponse
void setContentType(String type);
ServletOutputStream getOutputStream() throws java.io.IOException;
PrintWriter getWriter() throws java.io.IOException;
void sendRedirect(string location) throws java.io.IOException;
Métodos de la clase HttpSession
Object getAttribute(String name);
void setAttribute(String name, Object value);
void removeAttribute(name);
void invalidate();

1
Servicios web con JAX-RS

CLIENTE

* Class ClientBuilder
Client newClient();

* Class Client
WebTarget target(String URI);

* Class WebTarget
WebTarget path(String path);
WebTarget queryParam(String name, Object value);
Invocation.Builder request();
URI getUri();

* A partir de un Invocation.Builder
Response put(Entity<?> entity);
Response get();
Response delete();
Response post(Entity<?> entity);

* Class Entity
Entity<T> html(T entity); // tipo “text/html”
Entity<T> json(T entity); // tipo “application/json
Entity<T> text(T entity); // tipo “text/plain”

SERVIDOR

* Class ResponseBuilder
Response build();

CLIENTE y SERVIDOR

* Class Response
ResponseBuilder created(URI location); // añade el URI a la cabecera ‘Location’
ResponseBuilder ok();
ResponseBuilder ok(Object entity);
ResponseBuilder status(Response.Status status); // p.e.
status(Response.Status.NOT_FOUND)
URI getLocation();
Response.StatusType getStatus();
T readEntity(Class<T> entityType); // p.e. readEntity(String.class)
void close();

Você também pode gostar