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:Interfaz.MenuLista.java

private void btnGraficarListaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGraficarListaActionPerformed
    // TODO add your handling code here:
    String palabra = "";
    RequestBody formBody = new FormEncodingBuilder().add("palabra", palabra).build();
    String r = getString("graficarLista", formBody);
    System.out.println(r);/*from  w  w  w  . java  2s. c o  m*/
    txtSalidaLista.setText(r);
}

From source file:Interfaz.MenuMatriz.java

private void btnAgregarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAgregarActionPerformed
    // TODO add your handling code here:
    String correo = txtInsertarCorreo.getText();
    RequestBody formBody = new FormEncodingBuilder().add("dato", correo).build();
    String r = getString("insertarMatriz", formBody);
    System.out.println(r);/*w ww  .ja  v a2 s .  com*/
    txtSalidaMatriz.setText(r);
    // this.txtInsertarCorreo.setText("");
}

From source file:Interfaz.MenuMatriz.java

private void btnGraficarMatrizActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGraficarMatrizActionPerformed
    // TODO add your handling code here:
    String palabra = "";
    RequestBody formBody = new FormEncodingBuilder().add("dato", palabra).build();
    String r = getString("graficarMatriz", formBody);
    System.out.println(r);/*  w  w w .  j a  va2s. co  m*/
    txtSalidaMatriz.setText(r);
}

From source file:Interfaz.MenuPila.java

private void btnGraficarPilaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGraficarPilaActionPerformed
    // TODO add your handling code here:
    String palabra = "";
    RequestBody formBody = new FormEncodingBuilder().add("dato", palabra).build();
    String r = getString("graficarPila", formBody);
    System.out.println(r);//from  w  w w.j a  v  a2s .c o  m
    txtSalidaPila.setText(r);
}

From source file:Interfaz.MenuPila.java

private void btnPushActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPushActionPerformed
    // TODO add your handling code here:
    String palabra = txtNumPila.getText();
    RequestBody formBody = new FormEncodingBuilder().add("dato", palabra).build();
    String r = getString("pushPila", formBody);
    System.out.println(r);//w  ww.j  a v  a  2  s.  c  o m
    txtSalidaPila.setText(r);
    this.txtNumPila.setText("");
}

From source file:Interfaz.MenuPila.java

private void btnPopActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPopActionPerformed
    // TODO add your handling code here:
    String palabra = "";
    RequestBody formBody = new FormEncodingBuilder().add("dato", palabra).build();
    String r = getString("popPila", formBody);
    System.out.println(r);/*from   www  .  ja v  a2  s .com*/
    txtSalidaPila.setText(r);
}

From source file:interfaz.practica2.ModificarLista.java

private void btnAgregar2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAgregar2ActionPerformed
    String nombre = txtAgregar.getText();
    formBody = new FormEncodingBuilder().add("dato", nombre).add("dato2", "Apellido").build();
    String r = getStringAgregar(formBody);
    System.out.println(r + "---");

}

From source file:io.github.hidroh.materialistic.accounts.UserServicesClient.java

License:Apache License

@Override
public void login(final String username, final String password, boolean createAccount,
        final Callback callback) {
    FormEncodingBuilder formBuilder = new FormEncodingBuilder().add(LOGIN_PARAM_ACCT, username)
            .add(LOGIN_PARAM_PW, password).add(LOGIN_PARAM_GOTO, DEFAULT_REDIRECT);
    if (createAccount) {
        formBuilder.add(LOGIN_PARAM_CREATING, CREATING_TRUE);
    }/*from   w  w w  .  j av a2  s  .  co m*/
    mClient.newCall(new Request.Builder()
            .url(HttpUrl.parse(BASE_WEB_URL).newBuilder().addPathSegment(LOGIN_PATH).build())
            .post(formBuilder.build()).build()).enqueue(wrap(callback));
}

From source file:io.github.hidroh.materialistic.accounts.UserServicesClient.java

License:Apache License

@Override
public void voteUp(Context context, String itemId, final Callback callback) {
    Pair<String, String> credentials = AppUtils.getCredentials(context);
    if (credentials == null) {
        callback.onDone(false);/*from   w  w  w  .  j  a  v a2s. co m*/
        return;
    }
    Toast.makeText(context, R.string.sending, Toast.LENGTH_SHORT).show();
    mClient.newCall(new Request.Builder()
            .url(HttpUrl.parse(BASE_WEB_URL).newBuilder().addPathSegment(VOTE_PATH).build())
            .post(new FormEncodingBuilder().add(LOGIN_PARAM_ACCT, credentials.first)
                    .add(LOGIN_PARAM_PW, credentials.second).add(VOTE_PARAM_FOR, itemId)
                    .add(VOTE_PARAM_DIR, VOTE_DIR_UP).add(VOTE_PARAM_WHENCE, DEFAULT_REDIRECT).build())
            .build()).enqueue(wrap(callback));
}

From source file:io.github.hidroh.materialistic.accounts.UserServicesClient.java

License:Apache License

@Override
public void reply(Context context, String parentId, String text, Callback callback) {
    Pair<String, String> credentials = AppUtils.getCredentials(context);
    if (credentials == null) {
        callback.onDone(false);//from ww  w  .j a v a2  s .co m
        return;
    }
    mClient.newCall(new Request.Builder()
            .url(HttpUrl.parse(BASE_WEB_URL).newBuilder().addPathSegment(COMMENT_PATH).build())
            .post(new FormEncodingBuilder().add(LOGIN_PARAM_ACCT, credentials.first)
                    .add(LOGIN_PARAM_PW, credentials.second).add(COMMENT_PARAM_PARENT, parentId)
                    .add(COMMENT_PARAM_TEXT, text).build())
            .build()).enqueue(wrap(callback));
}