Example usage for com.squareup.okhttp FormEncodingBuilder FormEncodingBuilder

List of usage examples for com.squareup.okhttp FormEncodingBuilder FormEncodingBuilder

Introduction

In this page you can find the example usage for com.squareup.okhttp FormEncodingBuilder FormEncodingBuilder.

Prototype

FormEncodingBuilder

Source Link

Usage

From source file:practica2_edd.Conec.java

public static String eliminarLista(int dato) {
    RequestBody formBody = new FormEncodingBuilder().add("dato", dato + "").build();
    try {/*from   w ww.j  ava 2s. c o  m*/
        URL url = new URL("http://0.0.0.0:5000/eliminarLista");
        Request request = new Request.Builder().url(url).post(formBody).build();
        // System.out.println(request);
        Response response = webClient.newCall(request).execute();
        //System.out.println(response);
        String response_string = response.body().string();//y este seria el string de las respuesta
        System.out.println(response_string);
        return response_string;
    } catch (MalformedURLException ex) {
        System.out.println(ex.toString());
    } catch (IOException ex) {
        System.out.println(ex.toString());
    }

    return null;
}

From source file:practica2_edd.Conec.java

public static String SacarPila() {
    RequestBody formBody = new FormEncodingBuilder().add("dato", "").build();
    try {//from w ww.  j  a  v a 2  s .com
        URL url = new URL("http://0.0.0.0:5000/salePila");
        Request request = new Request.Builder().url(url).post(formBody).build();
        Response response = webClient.newCall(request).execute();
        String response_string = response.body().string();//y este seria el string de las respuesta
        System.out.println(response_string);
        return response_string;
    } catch (MalformedURLException ex) {
        System.out.println(ex.toString());
    } catch (IOException ex) {
        System.out.println(ex.toString());
    }
    return null;
}

From source file:practica2_edd.Conec.java

public static String ingresarMatriz(String entrada) {
    RequestBody formBody = new FormEncodingBuilder().add("entrada", entrada).add("fila", entrada)
            .add("columna", entrada).add("orden1", entrada).build();
    try {/*  w w w  .  j a v a 2  s .  c om*/
        URL url = new URL("http://0.0.0.0:5000/insertarMatriz");
        Request request = new Request.Builder().url(url).post(formBody).build();
        Response response = webClient.newCall(request).execute();
        String response_string = response.body().string();//y este seria el string de las respuesta
        System.out.println(response_string);

        return response_string;
    } catch (MalformedURLException ex) {
        System.out.println(ex.toString());
    } catch (IOException ex) {
        System.out.println(ex.toString());
    }
    return null;
}

From source file:Proyecto1.Datos.java

public String hola() {
    String nombre = "lMMl";
    RequestBody formBody = new FormEncodingBuilder().add("dato", nombre).build();
    String r = getString("metodoWeb", formBody);
    return r;/*from  w  ww. j a v  a  2s.c om*/
}

From source file:Proyecto1.Datos.java

public String AgregaraMatriz(String Usuario, String pass, String nom, String depto, String empresa) {
    RequestBody formBody = new FormEncodingBuilder().add("user", Usuario).add("password", pass).add("name", nom)
            .add("depto", depto).add("empresa", empresa).build();
    String r = getString("insertarMatriz", formBody);
    System.out.println(r);//from  www  .  j a  v  a 2 s  . c  o m
    return r;

}

From source file:Proyecto1.Datos.java

public String VerificarUsuario(String Usuario, String pass, String empresa, String depto) {
    RequestBody formBody = new FormEncodingBuilder().add("user", Usuario).add("password", pass)
            .add("empresa", empresa).add("depto", depto).build();
    String r = getString("verificarUsuario", formBody);
    System.out.println("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%    " + r);
    return r;/* w  w w.  j  av  a 2  s .c om*/

}

From source file:Proyecto1.Datos.java

public String ModoficarA(String Usuario, String empresa, String depto, String id, String desc) {
    RequestBody formBody = new FormEncodingBuilder().add("user", Usuario).add("empresa", empresa)
            .add("depto", depto).add("id", id).add("desc", desc).build();
    String r = getString("modificarAVL", formBody);
    System.out.println("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%    " + r);
    return r;// www.  j av a2 s .c o  m

}

From source file:Proyecto1.Datos.java

public String EliminarA(String Usuario, String empresa, String depto, String id) {
    RequestBody formBody = new FormEncodingBuilder().add("user", Usuario).add("empresa", empresa)
            .add("depto", depto).add("id", id).build();
    String r = getString("eliminarAVL", formBody);
    System.out.println("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%    " + r);
    return r;/*  w  w w . ja v a 2s  . com*/

}

From source file:Proyecto1.Datos.java

public String CrearActivo(String Usuario, String empresa, String depto, String nombre, String descripcion) {
    RequestBody formBody = new FormEncodingBuilder().add("user", Usuario).add("empresa", empresa)
            .add("depto", depto).add("nombre", nombre).add("desc", descripcion).build();
    String r = getString("insertarAVL", formBody);
    System.out.println("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%    " + r);
    return r;//w  ww.j av  a  2  s  . c o  m

}

From source file:prue.Prueba.java

public static String Matriz(String Usuario, String Departamento, String Empresa, String Contrasena,
        String Nombre) {/*  w  ww  . j av a 2s  .c o  m*/
    RequestBody formBody = new FormEncodingBuilder().add("user", Usuario).add("departamento", Departamento)
            .add("empresa", Empresa).add("password", Contrasena).add("nombre", Nombre).build();

    try {
        URL url = new URL("http://192.168.43.223:5000/addMatrizDispersa");
        Request request = new Request.Builder().url(url).post(formBody).build();
        Response response = webClient.newCall(request).execute();
        String response_string = response.body().string();
        return response_string;
    } catch (MalformedURLException ex) {
        System.out.println(ex.toString());
    } catch (IOException ex) {
        System.out.println(ex.toString());
    }
    return null;
}