• Problem with redirect in dialog

    By Johnny Haugen Sørgård 1 decade ago

    I am working on an application for a customer. The special challenge with this installation is that the Domino server is hidden behind a reverse proxy server. The application is reached from internet using https. The communication between the proxy server and the domino server is http.

     

    Most of the application works, with the exception of some redirects. E.g.I create a document from a template chosen in a dialog. The logic is written in the dialog "Select" button. The final statement in the is context.redirectToPage(newdocumentUNID). In this situation the redirect is to "http://..." while the same statement in a button on the page (i.e. not on the dialog) will continue to redirect to "https://..."

     

    Any ideas?

    • Can you send us more information?

      By Philippe Riand 1 decade ago

      Effectively, redirect is handled differently when partial refresh is set or not. And a dialog automatically sets it, as a dialog is a part of the whole page.

      In this case, the page to redirect to is passed as an custom HTTP header 'X-XspLocation'. The client side JS gets this value and assigns it to window.location. Can you please look at this value and tell us what is being passed?

      • Screenshot

        By Johnny Haugen Sørgård 1 decade ago

         

        Is this what you are looking for?

         

        The redirect command used is: context.redirectToPage("Aktivitet.xsp?documentId=" + aktivitet.getUnid() + "&action=editDocument");

        • Thank you,but...

          By Philippe Riand 1 decade ago

          ... I don't know what happens, unless I have an environment that reproduces the issue.

          Can you display, on the server side, all the parameters provided by the servlet? Then look if there is something that seems suspicious (http/https..)

          Here is a piece of code to do so:

           

          <xp:table>
          
          <xp:tr>
          
          <xp:td>JSF Path Info</xp:td>
          
          <xp:td>
          
          <xp:text escape="true" id="computedField1"
          
          value="#{javascript:facesContext.getExternalContext().getRequestPathInfo()}"></xp:text>
          
          </xp:td>
          
          </xp:tr>
          
          <xp:tr>
          
          <xp:td>JSF Context Path</xp:td>
          
          <xp:td>
          
          <xp:text escape="true" id="computedField2"
          
          value="#{javascript:facesContext.getExternalContext().getRequestContextPath()}"></xp:text>
          
          </xp:td>
          
          </xp:tr>
          
          <xp:tr>
          
          <xp:td>JSF Servlet Path</xp:td>
          
          <xp:td>
          
          <xp:text escape="true" id="computedField3"
          
          value="#{javascript:facesContext.getExternalContext().getRequestServletPath()}"></xp:text>
          
          </xp:td>
          
          </xp:tr>
          
          <xp:tr>
          
          <xp:td>JSF User Principal</xp:td>
          
          <xp:td><xp:text escape="true" id="computedField4" value="#{javascript:facesContext.getExternalContext().getUserPrincipal().toString()}"></xp:text></xp:td>
          
          </xp:tr>
          
          <xp:tr>
          
          <xp:td></xp:td>
          
          <xp:td></xp:td>
          
          </xp:tr>
          
          <xp:tr>
          
          <xp:td>Servlet Path Info</xp:td>
          
          <xp:td><xp:text escape="true" id="computedField5" value="#{javascript:facesContext.getExternalContext().getRequest().getPathInfo()}"></xp:text></xp:td>
          
          </xp:tr>
          
          <xp:tr>
          
          <xp:td>Servlet Query String</xp:td>
          
          <xp:td><xp:text escape="true" id="computedField6" value="#{javascript:facesContext.getExternalContext().getRequest().getQueryString()}"></xp:text></xp:td>
          
          </xp:tr>
          
          <xp:tr>
          
          <xp:td>Servlet Request URI</xp:td>
          
          <xp:td><xp:text escape="true" id="computedField7" value="#{javascript:facesContext.getExternalContext().getRequest().getRequestURI()}"></xp:text></xp:td>
          
          </xp:tr>
          
          <xp:tr>
          
          <xp:td>Servlet Request URL</xp:td>
          
          <xp:td><xp:text escape="true" id="computedField8" value="#{javascript:facesContext.getExternalContext().getRequest().getRequestURL()}"></xp:text></xp:td>
          
          </xp:tr>
          
          <xp:tr>
          
          <xp:td>Servlet Path Translated</xp:td>
          
          <xp:td><xp:text escape="true" id="computedField9" value="#{javascript:facesContext.getExternalContext().getRequest().getPathTranslated()}"></xp:text></xp:td>
          
          </xp:tr>
          
          </xp:table>
          
          • screenshots from xpage and dialg

            By Johnny Haugen Sørgård 1 decade ago

            Here's a screenshot with the information retrieved after xpage load and after dialog load.

            • So can you analyze what's going wrong?

              By Philippe Riand 1 decade ago

              Without being able to reproduce the issue which seems to be related to your environment, I'm afraid that I can't help you more. I can only point you to some tool like the previous piece code and let you debug it.

              • Ok

                By Johnny Haugen Sørgård 1 decade ago

                Thank you for your time.

                 

                Johnny

              • Found a way to create the same problem on an xpage without a dialog

                By Johnny Haugen Sørgård 1 decade ago

                I accidentally stumbled on to this: If I trigger the code "context.redirectToPage(...)" from a button that has refreshMode="complete" all goes well. If the button has refreshMode="partial" then the redirect will fail like described earlier.

                 

                Didn't I read somewhere that dialogs enforces partial refhresh? Any way to override it?

                 

                Again, thanks for all your help.

                 

                Johnny

                • Redirect and partial rerfresh

                  By Philippe Riand 1 decade ago

                  When redirect is emitted from an event with full refresh, then it simply return an HTTP 302 with the next page to reach. When partial refresh is enabled, and because the request is then an ajax request (xhr), then it is done differently. In this case, the runtime passes a custom HTTP header "X-XspLocation" pointing to the next page. This header is then interpreted by the client side runtime JavaScript.

                  Are you seeing the correct value being passed in this header?

                  • X-XspLocation wrong also on button.

                    By Johnny Haugen Sørgård 1 decade ago

                    Hi

                     

                    The X-XspLocation is wrong with partial refresh on the button too. 

                     

                    I have requested a change of environment, so that there will be https all the way through.

                     

                    Johnny

                    • Ok,but will be interesting to understand what happens

                      By Philippe Riand 1 decade ago

                      particularly, what is on the client, the proxy and the server. And why this problem arises, so we might provide a fix if it is a runtime issue.

                      • Environment changed

                        By Johnny Haugen Sørgård 1 decade ago

                        Hi Philippe.

                         

                        The environment have been changed. Now there's https all the way, and I can no longer reproduce the problem.

                         

                        Johnny

                        • Thanks for the update!

                          By Philippe Riand 1 decade ago