4 Replies Latest reply on Sep 5, 2012 7:48 AM by smithadsouza

    JSF image file name has space and h:graphicImage replaces the space with + symbol

    smithadsouza

      Does anyone know why it works like that...

        • 1. Re: JSF image file name has space and h:graphicImage replaces the space with + symbol
          healeyb

          It's the protocol for MIME type application/x-www-form-urlencoded Does it work ok?

           

          http://en.wikipedia.org/wiki/URL_encoding

           


           

          Regards,

          Brendan.

           

           


          Freelance Java Enterprise Developer


          JSF Richfaces Ajax Java 6/7 (scjp) EE 6 HTML CSS JavaScript jQuery MySQL JPA Hibernate Eclipselink

          Spring Oracle SQL JPQL Sybase EJB CDI Glassfish Apache JAX-RS Primefaces UNIX Paypal and more..

          • 2. Re: JSF image file name has space and h:graphicImage replaces the space with + symbol
            smithadsouza

            @BRENDAN no it doesnt show image at all since it is not getting replced with %20.Do u have any solution???

            • 3. Re: JSF image file name has space and h:graphicImage replaces the space with + symbol
              healeyb

              Yep, see this: http://stackoverflow.com/questions/11189644/hgraphicimage-value-tag-parses-spaces-as

               

              looks like I was wrong in saying that is was standard encoding, the man himself says it's a bug so it surely

              is a bug.

               

              Regards,

              Brendan.

               

              p.s. looks like you'll need JSF 2 for this exact solution, is that what you're using? there will be an alternative

              way of doing it if you're on 1.2.

              • 4. Re: JSF image file name has space and h:graphicImage replaces the space with + symbol
                smithadsouza

                I will explain what exactly am doing ok.at the backend am checking that whether that image url exists or not..

                By foolowing code:

                in those image files names spaces are there....problem is here only while check it is saying that it gives 404 exception.

                 

                try

                        {

                            HttpURLConnection.setFollowRedirects(false);

                            HttpURLConnection con = (HttpURLConnection) new URL(URLName).openConnection();

                            con.setRequestMethod("HEAD");

                 

                            LOGGER.info("URLName------" + URLName);

                            LOGGER.info("HttpURLConnection con------" + con);

                 

                            LOGGER.info("con.getResponseCode()------" + con.getResponseCode());

                            LOGGER.info("HttpURLConnection.HTTP_OK------" + HttpURLConnection.HTTP_OK);

                            boolean urlExists = false;

                            if (con.getResponseCode() == HttpURLConnection.HTTP_OK)

                            {

                                urlExists = true;

                                LOGGER.info("inside urlExists------" + urlExists);

                            }

                            LOGGER.info("outside urlExists------" + urlExists);

                            return urlExists;

                        }

                        catch (Exception e)

                        {

                            LOGGER.error("Error while urlExists---" + e.getMessage());

                            return false;

                        }

                 

                 

                 

                am using JSF 2.0 version only...