www.webdeveloper.com
Results 1 to 4 of 4

Thread: make a dynamic URL shorter?

  1. #1
    Join Date
    May 2012
    Posts
    12

    Exclamation make a dynamic URL shorter?

    Hi, i'm working with a javascript function that fires a netbeans function (deployed through glassfish) that stores data in 119 columns in a postgresql database. My URL right now is:


    Code:
    http://www.mirodinero.com:8080/mirodinero-war/setMisDatos?callback=respuestaGuardarMisDatos&param=%26usuario%3DIsa%20Mirodinero%26nivel%3D109%26gano_sal_neto%3D211113.45%26gano_sal_prof%3D2480%26gano_monet%3D0%26gano_renta_fija%3D0%26gano_renta_vble%3D0%26gano_inmuebles%3D2226.75%26gano_otros%3D2223.73%26gano_otros_ing%3D2411.12%26porc_gano_monet%3D0%26porc_gano_rentaf%3D0%26porc_gano_rentav%3D0%26porc_gano_inm%3D2%26porc_gano_otros%3D2%26porc_gano_otros_ing%3D1%26gasto_casa1%3D1306.46%26gasto_casa2%3D2402.38%26gasto_casa3%3D3999.57%26gasto_prestamo1%3D93475.58%26gasto_prestamo2%3D7325.88%26gasto_prestamo3%3D34090.9%26gasto_tarjetas%3D29443.2%26gasto_ibi%3D5670%26gasto_imp_otros%3D6780%26gasto_seg_inm%3D1320%26gasto_seg_pens%3D3451.22%26gasto_seg_vida%3D2330%26gasto_seg_plan%3D34230%26gasto_seg_medico%3D21220%26gasto_seg_coche%3D220%26gasto_luz%3D620%26gasto_agua%3D4550%26gasto_gas%3D320%26gasto_telef_f%3D22320%26gasto_telef_m%3D2350%26gasto_internet%3D20%26gasto_tv%3D3450%26gasto_hogar%3D20%26gasto_comida%3D20%26gasto_cenas_copas%3D20%26gasto_viajes%3D20%26gasto_vacaciones%3D220%26gasto_mobiliario%3D220%26gasto_ropa%3D2320%26gasto_transp%3D230%26gasto_otros%3D3620%26gasto_colegios%3D240%26gasto_univ%3D340%26gasto_master%3D2230%26gasto_otros_gastos%3D7323433%26porc_gasto_tarjetas%3D0%26porc_gasto_ibi%3D0%26porc_gasto_trib%3D0%26porc_gasto_seg_inm%3D0%26porc_gasto_seg_pens%3D0%26porc_gasto_seg_vida%3D2%26porc_gasto_seg_plan%3D2%26porc_gasto_seg_med%3D0%26porc_gasto_seg_coche%3D0%26porc_gasto_sum_luz%3D2%26porc_gasto_sum_agua%3D2%26porc_gasto_sum_gas%3D0%26porc_gasto_sum_teleff%3D0%26porc_gasto_sum_telefm%3D0%26porc_gasto_sum_int%3D0%26porc_gasto_sum_tv%3D0%26porc_gasto_nivel_hogar%3D0%26porc_gasto_nivel_comida%3D0%26porc_gasto_nivel_cenas%3D0%26porc_gasto_nivel_viajes%3D0%26porc_gasto_nivel_vacac%3D0%26porc_gasto_nivel_mob%3D0%26porc_gasto_nivel_ropa%3D20%26porc_gasto_nivel_transp%3D30%26porc_gasto_nivel_otros%3D30%26porc_gasto_colegios%3D2%26porc_gasto_univ%3D0%26porc_gasto_master%3D0%26porc_gasto_otros_gastos%3D23%26tengo_casa1%3D1231.11%26tengo_casa2%3D10000%26tengo_casa3%3D22240%26tengo_otras%3D23560%26tengo_monetario%3D1212.34%26tengo_planpensiones%3D23230%26tengo_otros%3D23330%26porc_tengo_casa1%3D1%26porc_tengo_casa2%3D0%26porc_tengo_casa3%3D2%26porc_tengo_otras%3D0%26porc_tengo_monet%3D0%26porc_tengo_plan%3D0%26porc_tengo_otros%3D0%26debo_casa1%3D4340%26debo_casa2%3D23450%26debo_casa3%3D23430%26debo_prestamo1%3D23330%26debo_prestamo2%3D6871.11%26debo_prestamo3%3D11340%26debo_tarjetas%3D61340%26porc_debo_casa1%3D30%26porc_debo_casa2%3D10%26porc_debo_casa3%3D12%26porc_debo_prestamo1%3D1%26porc_debo_prestamo2%3D12%26porc_debo_prestamo3%3D1%26porc_debo_tarjetas%3D4%26plazo_debo_casa1%3D230%26plazo_debo_casa2%3D450%26plazo_debo_casa3%3D122%26plazo_debo_prestamo1%3D3%26plazo_debo_prestamo2%3D12%26plazo_debo_prestamo3%3D4
    that is like 2568 characters long, and since i use Apache 2.2.15 (for windows 2008 server edition), i get error on the first time i click. So I would like to change the length of my URL with something like this:

    Code:
    http://www.mirodinero.com:8080/mirodinero-war/setMisDatos?callback=rGMD&p=%26u%3DIsa%20Mirodinero%26n%3D109%26gsn%3D211113.45%26gsp%3D2480%26gm%3D0%26grf%3D0%26grv%3D0%26gi%3D2226.75%26go%3D2223.73%26goi%3D2411.12%26pgm%3D0%26pgr%3D0%26pgr%3D0%26pgi%3D2%26pgo%3D2%26pgoi%3D1%26gc1%3D1306.46%26gc2%3D2402.38%26gc3%3D3999.57%26gp1%3D93475.58%26gp2%3D7325.88%26gp3%3D34090.9%26gt%3D29443.2%26gibi%3D5670%26gimo%3D6780%26gsi%3D1320%26gsegp%3D3451.22%26gsv%3D2330%26gsp%3D34230%26gseg%3D21220%26gasto_seg_coche%3D220%26gl%3D620%26ga%3D4550%26ggas%3D320%26gasto_telef_f%3D22320%26gasto_telef_m%3D2350%26gasto_internet%3D20%26gasto_tv%3D3450%26gasto_hogar%3D20%26gasto_comida%3D20%26gasto_cenas_copas%3D20%26gasto_viajes%3D20%26gasto_vacaciones%3D220%26gasto_mobiliario%3D220%26gasto_ropa%3D2320%26gasto_transp%3D230%26gasto_otros%3D3620%26gasto_colegios%3D240%26gasto_univ%3D340%26gasto_master%3D2230%26gasto_otros_gastos%3D7323433%26porc_gasto_tarjetas%3D0%26porc_gasto_ibi%3D0%26porc_gasto_trib%3D0%26porc_gasto_seg_inm%3D0%26porc_gasto_seg_pens%3D0%26porc_gasto_seg_vida%3D2%26porc_gasto_seg_plan%3D2%26porc_gasto_seg_med%3D0%26porc_gasto_seg_coche%3D0%26porc_gasto_sum_luz%3D2%26porc_gasto_sum_agua%3D2%26porc_gasto_sum_gas%3D0%26porc_gasto_sum_teleff%3D0%26porc_gasto_sum_telefm%3D0%26porc_gasto_sum_int%3D0%26porc_gasto_sum_tv%3D0%26porc_gasto_nivel_hogar%3D0%26porc_gasto_nivel_comida%3D0%26porc_gasto_nivel_cenas%3D0%26porc_gasto_nivel_viajes%3D0%26pgnv%3D0%26pgnm%3D0%26pgnr%3D20%26pgnt%3D30%26pogoo%3D30%26pogc%3D2%26pgu%3D0%26pgma%3D0%26pgog%3D23%26tc1%3D1231.11%26tc2%3D10000%26tc3%3D22240%26toa%3D23560%26tm%3D1212.34%26tpp%3D23230%26too%3D23330%26potc1%3D1%26potc2%3D0%26potc3%3D2%26poto%3D0%26potm%3D0%26potp%3D0%26poto%3D0%26dc1%3D4340%26dc2%3D23450%26dc3%3D23430%26dp1%3D23330%26dp2%3D6871.11%26dp3%3D11340%26dt%3D61340%26podc1%3D30%26podc2%3D10%26pdc3%3D12%26podp1%3D1%26podp2%3D12%26podp3%3D1%26pdt%3D4%26pdc1%3D230%26pdc2%3D450%26pdc3%3D122%26pdp1%3D3%26pdp2%3D12%26pdp3%3D4
    that is 1990 characters long. The problem is that I have been able to change &usuario= to &u= without problem, but then when i tried to change &gano_sal_neto= to &gsn= i get error. I changed gano_sal_neto to gsn in these files:

    - the javascript file of the webpage;
    - the netbeans files;
    - the php code on the drupal page;
    - i created a new column in postgresql.

    What am I missing to make this change work and get a new and shorter URL working?

  2. #2
    Join Date
    Nov 2006
    Location
    Oakland
    Posts
    500
    If you are sending such a long query string, you might want to consider posting that data instead even though the max number of characters in a URL is 2083.

    As to the renaming of of query string parameters, I see no reason why you cannot change gano_sal_neto to gsn. It's not a reserved as far as I know. There source of the error is certainly somewhere else.
    By the way, what does the error message say?

  3. #3
    Join Date
    May 2012
    Posts
    12

    Exclamation

    i have 2 types of error:

    in the netbeans log file, it tells me:

    Code:
    error: 
    java.lang.NullPointerException
    	at com.mirodinero.web.calculos.Calculos.getTotalGano(Calculos.java:182)
    	at com.mirodinero.web.calculos.CalcularSegmentos.ejecutar(CalcularSegmentos.java:65)
    	at com.mirodinero.web.servlets.setMisDatos.actualizarSegmentos(setMisDatos.java:543)
    where getTotalGano at those lines is:

    Code:
    public float getTotalGano() {
            float res = user.getGanoMonet() + user.getGanoRentaFija() + user.getGanoRentaVble() + user.getGanoInmuebles() + user.getGanoOtros() + user.getGanoSalNeto() + user.getGanoSalProf() + user.getGanoOtrosIng();
            return res;
        }
    , ejecutar() is

    Code:
    public void ejecutar() {
            boolean existe = true;
            DatosUsuario datosUser = datosUsuarioFacade.findById(atributosUsuario.getIdUsuario());
            if (datosUser != null) {
                List<Cartera> lc = carteraFacade.findByIdUsuario(atributosUsuario.getIdUsuario());
                Calculos c = new Calculos(datosUser, accionesDatosFacade, fondosDatosFacade, bonosDatosFacade, lc);
                ahorroLiquido = c.getTengoDisponible() / c.getTotalGasto();
                ingresoAnual = c.getTotalGano(); /*this is line 65 */
                diferenciaGanoGasto = c.getSupDefTotal();//indica lo que gano menos lo que gasto
                modificarAtributos(c, datosUser);
            }
    and actualizarSegmentos is:

    private void actualizarSegmentos(String usuario) {
    AtributosUsuario a = atributosUsuarioFacade.find(usuario);
    if (a != null) {//lista vacia
    new CalcularSegmentos(a, segmentosUsuarioFacade, datosUsuarioFacade, carteraFacade, accionesDatosFacade, fondosDatosFacade, bonosDatosFacade, atributosUsuarioFacade).ejecutar();
    }
    }



    on the postgres log file, i get:

    Code:
    2012-05-22 11:10:46 CESTLOG:  could not receive data from client: Unknown winsock error 10061
    2012-05-22 11:10:46 CESTLOG:  unexpected EOF on client connection
    2012-05-22 11:19:12 CESTLOG:  CreateProcess call failed: Unknown winsock error 10004 (error code 1115)
    2012-05-22 11:19:12 CESTLOG:  could not fork autovacuum worker process: Unknown winsock error 10004
    but i don't know what does it mean. Maybe is there something i should do with pgadmin to "upgrade" the database to the changes:i added a column named gsn -real and default 0 like gano_sal_neto-, without deleting the gano_sal_neto (that still has stored the data of the users).

  4. #4
    Join Date
    May 2012
    Posts
    12

    Exclamation

    still nobody able to help me with this? i don't what's the problem with changing columns name in postgres, maybe a procedure i'm missing?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles