Брамка + WAS: выклік URL выклікае перанакіраванне на няправільны URL выклікае 404

Выкарыстанне <�моцны> Websphere Application Server + брамка 1,6 У мяне паўсталі некаторыя праблемы з маёй усталяванай URL.

Калі я запушчу URL падобна: LOCALHOST: 9080/danesCooking/Пірагі/мяса Я бачу наступны на ўкладцы сеткі Chrome:

localhost:9080/danesCooking/pies/meat status code 302
localhost:9080/danesCooking/meat?2 status code 404

Так што здаецца/піражкі/частка губляецца. Такія паводзіны не адбываецца, калі я раскрываю маё прыкладанне да Tomcat \ JBoss \ ....

Магчыма, гэта дарэчы, пірагоў сябе не ўсталяваная старонка.

Я ўжо прагледзеў некаторыя з пытанняў, брамак \ форумаў і, здаецца, большасць пытанняў, як ўяўляюцца, альбо дазволіць \ канфліктуючыя адказы \ павінны рабіць з адноснымі спасылкамі (<�моцнага> фіксуецца ў 1.5.x ).

Хто-небудзь сутыкаўся з гэтым пытаннем і да гэтага часу ўзгадвае, як вырашыць гэтую праблему?

Б WAS * Версіі 7 і 8,5 * свабода.

3

8 адказы

This issue is actually outlined here; https://issues.apache.org/jira/browse/WICKET-3258

Маё рашэнне па гэтым пытанні ў Wicket 6.9.1 быў;

public class MyApplication extends WebApplication {

    @Override
    public Class<? extends WebPage> getHomePage() {
        return MyHomePage.class;
    }

    /* *********************************************** */
   //Resolve Websphere Relative URL "sendRedirect" Bug

    @Override
    protected WebResponse newWebResponse(WebRequest webRequest, HttpServletResponse httpServletResponse) {
        return new FixedServletWebResponse((ServletWebRequest) webRequest, httpServletResponse);
    }

    /**
     * Websphere incorrectly handles relative redirect pages when "HttpServletResponse.sendRedirect(url)" is called.
     * 
     * This small fix ensures that Websphere is only ever provided with absolute URLs so that this issue never occurs.
     */
    private static class FixedServletWebResponse extends ServletWebResponse {
        private final ServletWebRequest webRequest;

        protected FixedServletWebResponse(ServletWebRequest webRequest, HttpServletResponse httpServletResponse) {
            super(webRequest, httpServletResponse);
            this.webRequest = webRequest;
        }

        @Override
        public String encodeRedirectURL(CharSequence url) {
            Url relativeUrl = Url.parse(url);
            return new UrlRenderer(webRequest).renderFullUrl(relativeUrl);
        }
    }

    /* *********************************************** */
}
6
дададзена

This issue is actually outlined here; https://issues.apache.org/jira/browse/WICKET-3258

Маё рашэнне па гэтым пытанні ў Wicket 6.9.1 быў;

public class MyApplication extends WebApplication {

    @Override
    public Class<? extends WebPage> getHomePage() {
        return MyHomePage.class;
    }

    /* *********************************************** */
   //Resolve Websphere Relative URL "sendRedirect" Bug

    @Override
    protected WebResponse newWebResponse(WebRequest webRequest, HttpServletResponse httpServletResponse) {
        return new FixedServletWebResponse((ServletWebRequest) webRequest, httpServletResponse);
    }

    /**
     * Websphere incorrectly handles relative redirect pages when "HttpServletResponse.sendRedirect(url)" is called.
     * 
     * This small fix ensures that Websphere is only ever provided with absolute URLs so that this issue never occurs.
     */
    private static class FixedServletWebResponse extends ServletWebResponse {
        private final ServletWebRequest webRequest;

        protected FixedServletWebResponse(ServletWebRequest webRequest, HttpServletResponse httpServletResponse) {
            super(webRequest, httpServletResponse);
            this.webRequest = webRequest;
        }

        @Override
        public String encodeRedirectURL(CharSequence url) {
            Url relativeUrl = Url.parse(url);
            return new UrlRenderer(webRequest).renderFullUrl(relativeUrl);
        }
    }

    /* *********************************************** */
}
6
дададзена

This issue is actually outlined here; https://issues.apache.org/jira/browse/WICKET-3258

Маё рашэнне па гэтым пытанні ў Wicket 6.9.1 быў;

public class MyApplication extends WebApplication {

    @Override
    public Class<? extends WebPage> getHomePage() {
        return MyHomePage.class;
    }

    /* *********************************************** */
   //Resolve Websphere Relative URL "sendRedirect" Bug

    @Override
    protected WebResponse newWebResponse(WebRequest webRequest, HttpServletResponse httpServletResponse) {
        return new FixedServletWebResponse((ServletWebRequest) webRequest, httpServletResponse);
    }

    /**
     * Websphere incorrectly handles relative redirect pages when "HttpServletResponse.sendRedirect(url)" is called.
     * 
     * This small fix ensures that Websphere is only ever provided with absolute URLs so that this issue never occurs.
     */
    private static class FixedServletWebResponse extends ServletWebResponse {
        private final ServletWebRequest webRequest;

        protected FixedServletWebResponse(ServletWebRequest webRequest, HttpServletResponse httpServletResponse) {
            super(webRequest, httpServletResponse);
            this.webRequest = webRequest;
        }

        @Override
        public String encodeRedirectURL(CharSequence url) {
            Url relativeUrl = Url.parse(url);
            return new UrlRenderer(webRequest).renderFullUrl(relativeUrl);
        }
    }

    /* *********************************************** */
}
6
дададзена

This issue is actually outlined here; https://issues.apache.org/jira/browse/WICKET-3258

Маё рашэнне па гэтым пытанні ў Wicket 6.9.1 быў;

public class MyApplication extends WebApplication {

    @Override
    public Class<? extends WebPage> getHomePage() {
        return MyHomePage.class;
    }

    /* *********************************************** */
   //Resolve Websphere Relative URL "sendRedirect" Bug

    @Override
    protected WebResponse newWebResponse(WebRequest webRequest, HttpServletResponse httpServletResponse) {
        return new FixedServletWebResponse((ServletWebRequest) webRequest, httpServletResponse);
    }

    /**
     * Websphere incorrectly handles relative redirect pages when "HttpServletResponse.sendRedirect(url)" is called.
     * 
     * This small fix ensures that Websphere is only ever provided with absolute URLs so that this issue never occurs.
     */
    private static class FixedServletWebResponse extends ServletWebResponse {
        private final ServletWebRequest webRequest;

        protected FixedServletWebResponse(ServletWebRequest webRequest, HttpServletResponse httpServletResponse) {
            super(webRequest, httpServletResponse);
            this.webRequest = webRequest;
        }

        @Override
        public String encodeRedirectURL(CharSequence url) {
            Url relativeUrl = Url.parse(url);
            return new UrlRenderer(webRequest).renderFullUrl(relativeUrl);
        }
    }

    /* *********************************************** */
}
6
дададзена

Вы таксама можаце вырашыць, што з дапамогай ананімнага класа, як апісана ў Налада і разгортванне Open Source з WebSphere Application Server Liberty профіль раздзел 5.2.4. (Выпрабавана з WLP 8.5.5.3 і Wicket 6.8.0)

Override наступны метад у WebApplication Клас:

    @Override
    protected WebResponse newWebResponse(final WebRequest webRequest, final
    HttpServletResponse httpServletResponse)
    {
        return new ServletWebResponse((ServletWebRequest) webRequest,
                httpServletResponse)
        {
            @Override
            public String encodeRedirectURL(final CharSequence relativeURL)
            {
                return new UrlRenderer(webRequest).renderFullUrl(Url.parse(relativeURL));
            }
        };
    }

UPDATE
Other solution, instead of code change, is to set the following property in the webcontainer (works in 8.5.5.3):


0
дададзена

Вы таксама можаце вырашыць, што з дапамогай ананімнага класа, як апісана ў Налада і разгортванне Open Source з WebSphere Application Server Liberty профіль раздзел 5.2.4. (Выпрабавана з WLP 8.5.5.3 і Wicket 6.8.0)

Override наступны метад у WebApplication Клас:

    @Override
    protected WebResponse newWebResponse(final WebRequest webRequest, final
    HttpServletResponse httpServletResponse)
    {
        return new ServletWebResponse((ServletWebRequest) webRequest,
                httpServletResponse)
        {
            @Override
            public String encodeRedirectURL(final CharSequence relativeURL)
            {
                return new UrlRenderer(webRequest).renderFullUrl(Url.parse(relativeURL));
            }
        };
    }

UPDATE
Other solution, instead of code change, is to set the following property in the webcontainer (works in 8.5.5.3):


0
дададзена

Вы таксама можаце вырашыць, што з дапамогай ананімнага класа, як апісана ў Налада і разгортванне Open Source з WebSphere Application Server Liberty профіль раздзел 5.2.4. (Выпрабавана з WLP 8.5.5.3 і Wicket 6.8.0)

Override наступны метад у WebApplication Клас:

    @Override
    protected WebResponse newWebResponse(final WebRequest webRequest, final
    HttpServletResponse httpServletResponse)
    {
        return new ServletWebResponse((ServletWebRequest) webRequest,
                httpServletResponse)
        {
            @Override
            public String encodeRedirectURL(final CharSequence relativeURL)
            {
                return new UrlRenderer(webRequest).renderFullUrl(Url.parse(relativeURL));
            }
        };
    }

UPDATE
Other solution, instead of code change, is to set the following property in the webcontainer (works in 8.5.5.3):


0
дададзена

Вы таксама можаце вырашыць, што з дапамогай ананімнага класа, як апісана ў Налада і разгортванне Open Source з WebSphere Application Server Liberty профіль раздзел 5.2.4. (Выпрабавана з WLP 8.5.5.3 і Wicket 6.8.0)

Override наступны метад у WebApplication Клас:

    @Override
    protected WebResponse newWebResponse(final WebRequest webRequest, final
    HttpServletResponse httpServletResponse)
    {
        return new ServletWebResponse((ServletWebRequest) webRequest,
                httpServletResponse)
        {
            @Override
            public String encodeRedirectURL(final CharSequence relativeURL)
            {
                return new UrlRenderer(webRequest).renderFullUrl(Url.parse(relativeURL));
            }
        };
    }

UPDATE
Other solution, instead of code change, is to set the following property in the webcontainer (works in 8.5.5.3):


0
дададзена