You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Frans Stofberg (JIRA)" <ji...@apache.org> on 2011/03/03 10:47:37 UTC

[jira] Created: (WICKET-3497) Request.getUrl() not returning correct data

Request.getUrl() not returning correct data
-------------------------------------------

                 Key: WICKET-3497
                 URL: https://issues.apache.org/jira/browse/WICKET-3497
             Project: Wicket
          Issue Type: Bug
          Components: wicket-core
    Affects Versions: 1.5-RC2
         Environment: Linux, Firefox, IBM WebSphere 6.1
            Reporter: Frans Stofberg


There are 2 parts to this issue

assume 2 servlet mappings in web.xml
 - /app/*
 - /longapp/*

1. Calling Request.getUrl().toString() use to (v 1.4.x) return everything after the context root (eg app/somePage/). Now in 1.5 this only returns somePage
2. When multiple servlet mappings are specified in web.xml, only the first one is loaded on servlet/filter startup. This causes problems when accessing the app thru any of the mappings other than the first one.

[11/03/03 11:58:50:507 SAST] 00000028 WebApp        E   [Servlet Error]-[wicket.getUrlTest]: java.lang.StringIndexOutOfBoundsException: String index out of range: 17
	at java.lang.String.substring(String.java:1067)
	at org.apache.wicket.protocol.http.servlet.ServletWebRequest.getUrl(ServletWebRequest.java:159)
	at org.apache.wicket.protocol.http.servlet.ServletWebRequest.<init>(ServletWebRequest.java:98)
	at org.apache.wicket.protocol.http.servlet.ServletWebRequest.<init>(ServletWebRequest.java:73)
	at org.apache.wicket.protocol.http.WebApplication.newWebRequest(WebApplication.java:384)
	at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:133)
	at org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)



-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (WICKET-3497) Request.getUrl() not returning correct data

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13005144#comment-13005144 ] 

Igor Vaynberg commented on WICKET-3497:
---------------------------------------

public abstract class Request {
	/**
	 * Returns the path to which wicket Filter is mapped or an empty string if the filter is mapped
	 * to {@code /*}. Returned path, unless an empty string, will always start with a slash and will
	 * never end with a slash.
	 * 
	 * @return filter path
	 */
	public String getFilterPath()
	{
		return "";
	}

> Request.getUrl() not returning correct data
> -------------------------------------------
>
>                 Key: WICKET-3497
>                 URL: https://issues.apache.org/jira/browse/WICKET-3497
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 1.5-RC2
>         Environment: Linux, Firefox, IBM WebSphere 6.1
>            Reporter: Frans Stofberg
>            Assignee: Igor Vaynberg
>         Attachments: getUrlTest.zip
>
>
> There are 2 parts to this issue
> assume 2 servlet mappings in web.xml
>  - /app/*
>  - /longapp/*
> 1. Calling Request.getUrl().toString() use to (v 1.4.x) return everything after the context root (eg app/somePage/). Now in 1.5 this only returns somePage
> 2. When multiple servlet mappings are specified in web.xml, only the first one is loaded on servlet/filter startup. This causes problems when accessing the app thru any of the mappings other than the first one.
> [11/03/03 11:58:50:507 SAST] 00000028 WebApp        E   [Servlet Error]-[wicket.getUrlTest]: java.lang.StringIndexOutOfBoundsException: String index out of range: 17
> 	at java.lang.String.substring(String.java:1067)
> 	at org.apache.wicket.protocol.http.servlet.ServletWebRequest.getUrl(ServletWebRequest.java:159)
> 	at org.apache.wicket.protocol.http.servlet.ServletWebRequest.<init>(ServletWebRequest.java:98)
> 	at org.apache.wicket.protocol.http.servlet.ServletWebRequest.<init>(ServletWebRequest.java:73)
> 	at org.apache.wicket.protocol.http.WebApplication.newWebRequest(WebApplication.java:384)
> 	at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:133)
> 	at org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Resolved: (WICKET-3497) Request.getUrl() not returning correct data

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3497?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg resolved WICKET-3497.
-----------------------------------

    Resolution: Invalid
      Assignee: Igor Vaynberg

as the javadoc of Request#getUrl() in 1.5 says:
/**
	 * Returns the URL for this request. URL is relative to Wicket filter path.
	 * 
	 * @return Url instance
	 */

you can use request.getfilterpath() and request.getcontextpath() to construct the absolute url.

> Request.getUrl() not returning correct data
> -------------------------------------------
>
>                 Key: WICKET-3497
>                 URL: https://issues.apache.org/jira/browse/WICKET-3497
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 1.5-RC2
>         Environment: Linux, Firefox, IBM WebSphere 6.1
>            Reporter: Frans Stofberg
>            Assignee: Igor Vaynberg
>         Attachments: getUrlTest.zip
>
>
> There are 2 parts to this issue
> assume 2 servlet mappings in web.xml
>  - /app/*
>  - /longapp/*
> 1. Calling Request.getUrl().toString() use to (v 1.4.x) return everything after the context root (eg app/somePage/). Now in 1.5 this only returns somePage
> 2. When multiple servlet mappings are specified in web.xml, only the first one is loaded on servlet/filter startup. This causes problems when accessing the app thru any of the mappings other than the first one.
> [11/03/03 11:58:50:507 SAST] 00000028 WebApp        E   [Servlet Error]-[wicket.getUrlTest]: java.lang.StringIndexOutOfBoundsException: String index out of range: 17
> 	at java.lang.String.substring(String.java:1067)
> 	at org.apache.wicket.protocol.http.servlet.ServletWebRequest.getUrl(ServletWebRequest.java:159)
> 	at org.apache.wicket.protocol.http.servlet.ServletWebRequest.<init>(ServletWebRequest.java:98)
> 	at org.apache.wicket.protocol.http.servlet.ServletWebRequest.<init>(ServletWebRequest.java:73)
> 	at org.apache.wicket.protocol.http.WebApplication.newWebRequest(WebApplication.java:384)
> 	at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:133)
> 	at org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (WICKET-3497) Request.getUrl() not returning correct data

Posted by "Frans Stofberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13005549#comment-13005549 ] 

Frans Stofberg commented on WICKET-3497:
----------------------------------------

Okay, I must be going crazy, or we are not looking at the same source... I do'nt have that in my 1.5rc2 source...

Here is what the whole Request looks like...

What am I missing here?

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.wicket.request;

import java.nio.charset.Charset;
import java.util.Locale;

import org.apache.wicket.request.parameter.CombinedRequestParametersAdapter;
import org.apache.wicket.request.parameter.EmptyRequestParameters;
import org.apache.wicket.request.parameter.UrlRequestParametersAdapter;

/**
 * Request object.
 * 
 * @author Matej Knopp
 */
public abstract class Request
{
	/**
	 * Returns the URL for this request. URL is relative to Wicket filter path.
	 * 
	 * @return Url instance
	 */
	public abstract Url getUrl();

	/**
	 * Returns the url against which the client, usually the browser, will resolve relative urls in
	 * the rendered markup. If the client is a browser this is the url in the browser's address bar.
	 * 
	 * <p>
	 * Under normal circumstances the client and request ({@link #getUrl()}) urls are the same.
	 * Handling an Ajax request, however, is a good example of when they may be different.
	 * Technologies such as XHR are free to request whatever url they wish <strong>without
	 * modifying</strong> the client url; however, any produced urls will be evaluated by the client
	 * against the client url - not against the request url.
	 * </p>
	 * <p>
	 * Lets take a simple example: <br>
	 * 
	 * Suppose we are on a client detail page. This page contains an Ajax link which opens a list of
	 * client's orders. Each order has a link that goes to the order detail page.
	 * 
	 * The client detail page is located at
	 * 
	 * <pre>
	 * /detail/customer/15
	 * </pre>
	 * 
	 * and the order detail page is located at
	 * 
	 * <pre>
	 * /order/22
	 * </pre>
	 * 
	 * The Ajax link which renders the detail section is located at
	 * 
	 * <pre>
	 *  /detail/wicket?page 3
	 * </pre>
	 * 
	 * Lets run through the execution and see what happens when the XHR request is processed:
	 * 
	 * <pre>
	 * request 1: /details/customer/15
	 * client url: details/customer/15 (the url in the browser's address bar)
	 * request url: details/customer/15
	 * Wicket renders relative Ajax details anchor as ../../wicket/page?3  
	 * 
	 * ../../wicket/page?3 resolved against current client url details/customer/15 yields:
	 * request 2: /wicket/page?3
	 * client url: customer/15 (unchanged since XHRs requests dont change it)
	 * request url: wicket/ajax/page?3
	 * 
	 * now Wicket has to render a relative url to /details/order/22. If Wicket renders 
	 * it against the request url it will be: ../order/22, and later evaluated on the
	 * client will result in /customer/order/22 which is incorrect.
	 * </pre>
	 * 
	 * This is why implementations of {@link Request} must track the client url, so that relative
	 * urls can be rendered against the same url they will be evaluated against on the client -
	 * which is not always the same as the request url. For example, Wicket's Ajax implementation
	 * always sends the current client url in a header along with the XHR request so that Wicket can
	 * correctly render relative urls against it.
	 * </p>
	 * 
	 * @return client url
	 */
	public abstract Url getClientUrl();

	/**
	 * In case this request has been created using {@link #cloneWithUrl(Url)}, this method should
	 * return the original URL.
	 * 
	 * @return original URL
	 */
	public Url getOriginalUrl()
	{
		return getUrl();
	}

	/**
	 * @return POST request parameters for this request.
	 */
	public IRequestParameters getPostParameters()
	{
		return EmptyRequestParameters.INSTANCE;
	}

	/**
	 * @return GET request parameters for this request.
	 */
	public IRequestParameters getQueryParameters()
	{
		return new UrlRequestParametersAdapter(getUrl());
	}

	/**
	 * @return all request parameters for this request (both POST and GET parameters)
	 */
	public IRequestParameters getRequestParameters()
	{
		return new CombinedRequestParametersAdapter(getQueryParameters(), getPostParameters());
	}

	/**
	 * Returns locale for this request.
	 * 
	 * @return locale
	 */
	public abstract Locale getLocale();

	/**
	 * Returns request with specified URL and same POST parameters as this request.
	 * 
	 * @param url
	 *            Url instance
	 * @return request with specified URL.
	 */
	public Request cloneWithUrl(final Url url)
	{
		return new Request()
		{
			@Override
			public Url getUrl()
			{
				return url;
			}

			@Override
			public Url getOriginalUrl()
			{
				return Request.this.getOriginalUrl();
			}

			@Override
			public Locale getLocale()
			{
				return Request.this.getLocale();
			}

			@Override
			public IRequestParameters getPostParameters()
			{
				return Request.this.getPostParameters();
			}

			@Override
			public Charset getCharset()
			{
				return Request.this.getCharset();
			}

			@Override
			public Url getClientUrl()
			{
				return getUrl();
			}

			@Override
			public Object getContainerRequest()
			{
				return Request.this.getContainerRequest();
			}
		};
	}

	/**
	 * Returns prefix from Wicket Filter mapping to context path. This method does not take the
	 * actual URL into account.
	 * <p>
	 * For example if Wicket filter is mapped to hello/* this method should return ../ regardless of
	 * actual URL (after Wicket filter)
	 * 
	 * @return prefix to context path for this request.
	 * 
	 */
	public String getPrefixToContextPath()
	{
		return "";
	}

	/**
	 * Gets charset of the request
	 * 
	 * @return request charset
	 */
	public abstract Charset getCharset();

	/**
	 * Provides access to the low-level container request object that implementaion of this
	 * {@link Request} delegate to. This allows users to access features provided by the container
	 * requests but not by generalized Wicket {@link Request} objects.
	 * 
	 * @return low-level container request object, or {@code null} if none
	 */
	public abstract Object getContainerRequest();
}


> Request.getUrl() not returning correct data
> -------------------------------------------
>
>                 Key: WICKET-3497
>                 URL: https://issues.apache.org/jira/browse/WICKET-3497
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 1.5-RC2
>         Environment: Linux, Firefox, IBM WebSphere 6.1
>            Reporter: Frans Stofberg
>            Assignee: Igor Vaynberg
>         Attachments: getUrlTest.zip
>
>
> There are 2 parts to this issue
> assume 2 servlet mappings in web.xml
>  - /app/*
>  - /longapp/*
> 1. Calling Request.getUrl().toString() use to (v 1.4.x) return everything after the context root (eg app/somePage/). Now in 1.5 this only returns somePage
> 2. When multiple servlet mappings are specified in web.xml, only the first one is loaded on servlet/filter startup. This causes problems when accessing the app thru any of the mappings other than the first one.
> [11/03/03 11:58:50:507 SAST] 00000028 WebApp        E   [Servlet Error]-[wicket.getUrlTest]: java.lang.StringIndexOutOfBoundsException: String index out of range: 17
> 	at java.lang.String.substring(String.java:1067)
> 	at org.apache.wicket.protocol.http.servlet.ServletWebRequest.getUrl(ServletWebRequest.java:159)
> 	at org.apache.wicket.protocol.http.servlet.ServletWebRequest.<init>(ServletWebRequest.java:98)
> 	at org.apache.wicket.protocol.http.servlet.ServletWebRequest.<init>(ServletWebRequest.java:73)
> 	at org.apache.wicket.protocol.http.WebApplication.newWebRequest(WebApplication.java:384)
> 	at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:133)
> 	at org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (WICKET-3497) Request.getUrl() not returning correct data

Posted by "Frans Stofberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13003855#comment-13003855 ] 

Frans Stofberg commented on WICKET-3497:
----------------------------------------

Okay, This is fine for my 1st point, but point nr.2 is still an issue.

If I have two filter mappings in web.xml, only the 1st one gets loaded on the servlet/filter startup. When calling request.getUrl() you get either an array index out of bounds exception or part of the filter mapping in the url when you access the app with the second mapping.

here is an example

2 mappings

/app/*
/longapp/*

when accessing with /app/ request.getUrl() works fine.
when accessing with /longapp/ request.getUrl() will return gapp/ (it takes the length of /app/ as the star for the substring)

-------ServletWebRequest.getUrl()--------------
...
final int start = request.getContextPath().length() + filterPrefix.length() + 1;
url.append(uri.substring(start));
...
-------------------------------------------------------------
filterPrefix was loaded on the startup of the filter, which in this case is /app/ (this is can not be correct)

you can see that if the mappings were reversed (/longapp/* before /app/*) in web.xml the above code will throw an array/string index out of bounds exception (and it does)

please have another look Igor

Thanks






> Request.getUrl() not returning correct data
> -------------------------------------------
>
>                 Key: WICKET-3497
>                 URL: https://issues.apache.org/jira/browse/WICKET-3497
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 1.5-RC2
>         Environment: Linux, Firefox, IBM WebSphere 6.1
>            Reporter: Frans Stofberg
>            Assignee: Igor Vaynberg
>         Attachments: getUrlTest.zip
>
>
> There are 2 parts to this issue
> assume 2 servlet mappings in web.xml
>  - /app/*
>  - /longapp/*
> 1. Calling Request.getUrl().toString() use to (v 1.4.x) return everything after the context root (eg app/somePage/). Now in 1.5 this only returns somePage
> 2. When multiple servlet mappings are specified in web.xml, only the first one is loaded on servlet/filter startup. This causes problems when accessing the app thru any of the mappings other than the first one.
> [11/03/03 11:58:50:507 SAST] 00000028 WebApp        E   [Servlet Error]-[wicket.getUrlTest]: java.lang.StringIndexOutOfBoundsException: String index out of range: 17
> 	at java.lang.String.substring(String.java:1067)
> 	at org.apache.wicket.protocol.http.servlet.ServletWebRequest.getUrl(ServletWebRequest.java:159)
> 	at org.apache.wicket.protocol.http.servlet.ServletWebRequest.<init>(ServletWebRequest.java:98)
> 	at org.apache.wicket.protocol.http.servlet.ServletWebRequest.<init>(ServletWebRequest.java:73)
> 	at org.apache.wicket.protocol.http.WebApplication.newWebRequest(WebApplication.java:384)
> 	at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:133)
> 	at org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (WICKET-3497) Request.getUrl() not returning correct data

Posted by "Frans Stofberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13004999#comment-13004999 ] 

Frans Stofberg commented on WICKET-3497:
----------------------------------------

Sorry for carrying on in this but

There is no request.getfilterpath(), only WicketFilter.getfilterpath() which again only returns the first mapping in web.xml.

now according Peter Ertl who updated my other issue (WICKET-3518) wicket does not support multiple filter/servlet mappings.

I find this hard to accept as this was not an issue in 1.4.

only change I would suggest is to get the filterPrefix from the request instead of the web.xml (httpServletRequest.getServletPath())


I really don't think that we are the only ones utilising multiple mappings




> Request.getUrl() not returning correct data
> -------------------------------------------
>
>                 Key: WICKET-3497
>                 URL: https://issues.apache.org/jira/browse/WICKET-3497
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 1.5-RC2
>         Environment: Linux, Firefox, IBM WebSphere 6.1
>            Reporter: Frans Stofberg
>            Assignee: Igor Vaynberg
>         Attachments: getUrlTest.zip
>
>
> There are 2 parts to this issue
> assume 2 servlet mappings in web.xml
>  - /app/*
>  - /longapp/*
> 1. Calling Request.getUrl().toString() use to (v 1.4.x) return everything after the context root (eg app/somePage/). Now in 1.5 this only returns somePage
> 2. When multiple servlet mappings are specified in web.xml, only the first one is loaded on servlet/filter startup. This causes problems when accessing the app thru any of the mappings other than the first one.
> [11/03/03 11:58:50:507 SAST] 00000028 WebApp        E   [Servlet Error]-[wicket.getUrlTest]: java.lang.StringIndexOutOfBoundsException: String index out of range: 17
> 	at java.lang.String.substring(String.java:1067)
> 	at org.apache.wicket.protocol.http.servlet.ServletWebRequest.getUrl(ServletWebRequest.java:159)
> 	at org.apache.wicket.protocol.http.servlet.ServletWebRequest.<init>(ServletWebRequest.java:98)
> 	at org.apache.wicket.protocol.http.servlet.ServletWebRequest.<init>(ServletWebRequest.java:73)
> 	at org.apache.wicket.protocol.http.WebApplication.newWebRequest(WebApplication.java:384)
> 	at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:133)
> 	at org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (WICKET-3497) Request.getUrl() not returning correct data

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13005559#comment-13005559 ] 

Martin Grigorov commented on WICKET-3497:
-----------------------------------------

getFilterPath() and getContextPath() are recently added to trunk. They will be available in RC3.

> Request.getUrl() not returning correct data
> -------------------------------------------
>
>                 Key: WICKET-3497
>                 URL: https://issues.apache.org/jira/browse/WICKET-3497
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 1.5-RC2
>         Environment: Linux, Firefox, IBM WebSphere 6.1
>            Reporter: Frans Stofberg
>            Assignee: Igor Vaynberg
>         Attachments: getUrlTest.zip
>
>
> There are 2 parts to this issue
> assume 2 servlet mappings in web.xml
>  - /app/*
>  - /longapp/*
> 1. Calling Request.getUrl().toString() use to (v 1.4.x) return everything after the context root (eg app/somePage/). Now in 1.5 this only returns somePage
> 2. When multiple servlet mappings are specified in web.xml, only the first one is loaded on servlet/filter startup. This causes problems when accessing the app thru any of the mappings other than the first one.
> [11/03/03 11:58:50:507 SAST] 00000028 WebApp        E   [Servlet Error]-[wicket.getUrlTest]: java.lang.StringIndexOutOfBoundsException: String index out of range: 17
> 	at java.lang.String.substring(String.java:1067)
> 	at org.apache.wicket.protocol.http.servlet.ServletWebRequest.getUrl(ServletWebRequest.java:159)
> 	at org.apache.wicket.protocol.http.servlet.ServletWebRequest.<init>(ServletWebRequest.java:98)
> 	at org.apache.wicket.protocol.http.servlet.ServletWebRequest.<init>(ServletWebRequest.java:73)
> 	at org.apache.wicket.protocol.http.WebApplication.newWebRequest(WebApplication.java:384)
> 	at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:133)
> 	at org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Updated: (WICKET-3497) Request.getUrl() not returning correct data

Posted by "Frans Stofberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3497?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Frans Stofberg updated WICKET-3497:
-----------------------------------

    Attachment: getUrlTest.zip

Quickstart for checking this issue

> Request.getUrl() not returning correct data
> -------------------------------------------
>
>                 Key: WICKET-3497
>                 URL: https://issues.apache.org/jira/browse/WICKET-3497
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 1.5-RC2
>         Environment: Linux, Firefox, IBM WebSphere 6.1
>            Reporter: Frans Stofberg
>         Attachments: getUrlTest.zip
>
>
> There are 2 parts to this issue
> assume 2 servlet mappings in web.xml
>  - /app/*
>  - /longapp/*
> 1. Calling Request.getUrl().toString() use to (v 1.4.x) return everything after the context root (eg app/somePage/). Now in 1.5 this only returns somePage
> 2. When multiple servlet mappings are specified in web.xml, only the first one is loaded on servlet/filter startup. This causes problems when accessing the app thru any of the mappings other than the first one.
> [11/03/03 11:58:50:507 SAST] 00000028 WebApp        E   [Servlet Error]-[wicket.getUrlTest]: java.lang.StringIndexOutOfBoundsException: String index out of range: 17
> 	at java.lang.String.substring(String.java:1067)
> 	at org.apache.wicket.protocol.http.servlet.ServletWebRequest.getUrl(ServletWebRequest.java:159)
> 	at org.apache.wicket.protocol.http.servlet.ServletWebRequest.<init>(ServletWebRequest.java:98)
> 	at org.apache.wicket.protocol.http.servlet.ServletWebRequest.<init>(ServletWebRequest.java:73)
> 	at org.apache.wicket.protocol.http.WebApplication.newWebRequest(WebApplication.java:384)
> 	at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:133)
> 	at org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Issue Comment Edited: (WICKET-3497) Request.getUrl() not returning correct data

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13004000#comment-13004000 ] 

Igor Vaynberg edited comment on WICKET-3497 at 3/8/11 3:44 PM:
---------------------------------------------------------------

you should create a separate issue

      was (Author: ivaynberg):
    you should create a separate
  
> Request.getUrl() not returning correct data
> -------------------------------------------
>
>                 Key: WICKET-3497
>                 URL: https://issues.apache.org/jira/browse/WICKET-3497
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 1.5-RC2
>         Environment: Linux, Firefox, IBM WebSphere 6.1
>            Reporter: Frans Stofberg
>            Assignee: Igor Vaynberg
>         Attachments: getUrlTest.zip
>
>
> There are 2 parts to this issue
> assume 2 servlet mappings in web.xml
>  - /app/*
>  - /longapp/*
> 1. Calling Request.getUrl().toString() use to (v 1.4.x) return everything after the context root (eg app/somePage/). Now in 1.5 this only returns somePage
> 2. When multiple servlet mappings are specified in web.xml, only the first one is loaded on servlet/filter startup. This causes problems when accessing the app thru any of the mappings other than the first one.
> [11/03/03 11:58:50:507 SAST] 00000028 WebApp        E   [Servlet Error]-[wicket.getUrlTest]: java.lang.StringIndexOutOfBoundsException: String index out of range: 17
> 	at java.lang.String.substring(String.java:1067)
> 	at org.apache.wicket.protocol.http.servlet.ServletWebRequest.getUrl(ServletWebRequest.java:159)
> 	at org.apache.wicket.protocol.http.servlet.ServletWebRequest.<init>(ServletWebRequest.java:98)
> 	at org.apache.wicket.protocol.http.servlet.ServletWebRequest.<init>(ServletWebRequest.java:73)
> 	at org.apache.wicket.protocol.http.WebApplication.newWebRequest(WebApplication.java:384)
> 	at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:133)
> 	at org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (WICKET-3497) Request.getUrl() not returning correct data

Posted by "Frans Stofberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13005573#comment-13005573 ] 

Frans Stofberg commented on WICKET-3497:
----------------------------------------

Thanks Martin.

I thought I was losing my mind

> Request.getUrl() not returning correct data
> -------------------------------------------
>
>                 Key: WICKET-3497
>                 URL: https://issues.apache.org/jira/browse/WICKET-3497
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 1.5-RC2
>         Environment: Linux, Firefox, IBM WebSphere 6.1
>            Reporter: Frans Stofberg
>            Assignee: Igor Vaynberg
>         Attachments: getUrlTest.zip
>
>
> There are 2 parts to this issue
> assume 2 servlet mappings in web.xml
>  - /app/*
>  - /longapp/*
> 1. Calling Request.getUrl().toString() use to (v 1.4.x) return everything after the context root (eg app/somePage/). Now in 1.5 this only returns somePage
> 2. When multiple servlet mappings are specified in web.xml, only the first one is loaded on servlet/filter startup. This causes problems when accessing the app thru any of the mappings other than the first one.
> [11/03/03 11:58:50:507 SAST] 00000028 WebApp        E   [Servlet Error]-[wicket.getUrlTest]: java.lang.StringIndexOutOfBoundsException: String index out of range: 17
> 	at java.lang.String.substring(String.java:1067)
> 	at org.apache.wicket.protocol.http.servlet.ServletWebRequest.getUrl(ServletWebRequest.java:159)
> 	at org.apache.wicket.protocol.http.servlet.ServletWebRequest.<init>(ServletWebRequest.java:98)
> 	at org.apache.wicket.protocol.http.servlet.ServletWebRequest.<init>(ServletWebRequest.java:73)
> 	at org.apache.wicket.protocol.http.WebApplication.newWebRequest(WebApplication.java:384)
> 	at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:133)
> 	at org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (WICKET-3497) Request.getUrl() not returning correct data

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13004000#comment-13004000 ] 

Igor Vaynberg commented on WICKET-3497:
---------------------------------------

you should create a separate

> Request.getUrl() not returning correct data
> -------------------------------------------
>
>                 Key: WICKET-3497
>                 URL: https://issues.apache.org/jira/browse/WICKET-3497
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 1.5-RC2
>         Environment: Linux, Firefox, IBM WebSphere 6.1
>            Reporter: Frans Stofberg
>            Assignee: Igor Vaynberg
>         Attachments: getUrlTest.zip
>
>
> There are 2 parts to this issue
> assume 2 servlet mappings in web.xml
>  - /app/*
>  - /longapp/*
> 1. Calling Request.getUrl().toString() use to (v 1.4.x) return everything after the context root (eg app/somePage/). Now in 1.5 this only returns somePage
> 2. When multiple servlet mappings are specified in web.xml, only the first one is loaded on servlet/filter startup. This causes problems when accessing the app thru any of the mappings other than the first one.
> [11/03/03 11:58:50:507 SAST] 00000028 WebApp        E   [Servlet Error]-[wicket.getUrlTest]: java.lang.StringIndexOutOfBoundsException: String index out of range: 17
> 	at java.lang.String.substring(String.java:1067)
> 	at org.apache.wicket.protocol.http.servlet.ServletWebRequest.getUrl(ServletWebRequest.java:159)
> 	at org.apache.wicket.protocol.http.servlet.ServletWebRequest.<init>(ServletWebRequest.java:98)
> 	at org.apache.wicket.protocol.http.servlet.ServletWebRequest.<init>(ServletWebRequest.java:73)
> 	at org.apache.wicket.protocol.http.WebApplication.newWebRequest(WebApplication.java:384)
> 	at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:133)
> 	at org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira