see ContextImage.
Martijn
On Mon, Jun 16, 2008 at 5:07 PM, Frank Silbermann
<[EMAIL PROTECTED]> wrote:
> I did a few more experiments with static images in Wicket 1.3 and
> narrowed the problem down to my use of AttributeModifier:
>
> Consider a Wicket home page with no components that displays a static
> image via the following HTML:
>
> <html>
> <head>
> <title>Wicket Quickstart Archetype Homepage</title>
> </head>
> <body>
> <strong>Wicket Quickstart Archetype Homepage</strong>
> <br/><br/>
> <img alt="Picture" src="imageName.png"/>
> </body>
> </html>
>
> The image appears, and with the QuickStart's filter URL of "/*" the HTML
> delivered to my browser is essentially the same as the HTML of my Wicket
> home page. However, when I changed the Wicket filter's URL from "/*" to
> "/test/*" then the source HTML of the delivered page changes the <img>
> tag to:
>
> <img alt="Picture" src="../imageName.png"/>
>
> Notice the "../" prepended to "imageName.png".
>
> The code that gives me trouble sets the image name via AttributeModifier
> and WebComponent. Change the home page HTML to:
>
> <html>
> <head>
> <title>Wicket Quickstart Archetype Homepage</title>
> </head>
> <body>
> <strong>Wicket Quickstart Archetype Homepage</strong>
> <br/><br/>
> <img wicket:id = "picture" alt="Picture"
> src="imageNameGoesHere.png"/>
> </body>
> </html>
>
> Adding a component, the constructor of my HomePage becomes:
>
> public HomePage(final PageParameters parameters) {
> WebComponent wmc = new WebComponent("picture");
> wmc.add( new AttributeModifier( "src", true, new
> Model("imageName.png") ) );
> add( wmc );
> }
>
> Whether or not I re-map the filter's URL, the HTML delivered to my
> browser is:
>
> <html>
> <head>
> <title>Wicket Quickstart Archetype Homepage</title>
> </head>
> <body>
> <strong>Wicket Quickstart Archetype Homepage</strong>
> <br/><br/>
> <img alt="Picture" src="imageName.png" wicket:id="picture"/>
> </body>
> </html>
>
> The image is found using the "/*" URL that comes with the QuickStart,
> but if I change the URL of the filter to "/test/*" then it no longer
> finds the image -- because no "../" is prepended to "imageName.png", as
> was the case with the purely static reference.
>
> However, re-mapping the Wicket filter to "/test/*", I can get the image
> to appear if I change the model of my AttributeModifier as follows:
>
> public HomePage(final PageParameters parameters) {
> WebComponent wmc = new WebComponent("picture");
> wmc.add( new AttributeModifier( "src", true, new
> Model("../imageName.png") ) );
> add( wmc );
> }
>
> Now, the HTML is delivered with an image source of "../imageName.png".
>
> With Wicket 1.2, my use of AttributeModifier worked no matter what URL I
> used to deploy the application. Is there an better way of coding this
> that will work with whatever URL I use in my web.xml, or do I still need
> to create a JIRA issue?
>
> -----Original Message-----
> From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
> Sent: Friday, June 13, 2008 4:52 PM
> To: [email protected]
> Subject: Re: Wicket 1.2 -> 1.3 upgrade question
>
> well, package an example project that demonstrates it and attach it to
> jira
>
> -igor
>
> On Fri, Jun 13, 2008 at 1:19 PM, Frank Silbermann
> <[EMAIL PROTECTED]> wrote:
>> Adding the filterMappingUrlPattern didn't seem to make any difference.
>> When both are set to "/*" I see the image; when both are set to
>> "/test/*" then I don't see the image.
>>
>> -----Original Message-----
>> From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
>> Sent: Friday, June 13, 2008 3:10 PM
>> To: [email protected]
>> Subject: Re: Wicket 1.2 -> 1.3 upgrade question
>>
>> guess so
>>
>> -igor
>>
>> On Fri, Jun 13, 2008 at 1:04 PM, Frank Silbermann
>> <[EMAIL PROTECTED]> wrote:
>>> Like this?
>>>
>>> <?xml version="1.0" encoding="ISO-8859-1"?> <web-app
>>> xmlns="http://java.sun.com/xml/ns/j2ee"
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
>>> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
>>>
>>> <display-name>myproject</display-name>
>>>
>>> <filter>
>>> <filter-name>wicket.myproject</filter-name>
>>>
>>> <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-cl
>>> a
>>> ss
>>>>
>>> <init-param>
>>> <param-name>applicationClassName</param-name>
>>>
>>> <param-value>com.mycompany.WicketApplication</param-value>
>>> </init-param>
>>> <init-param>
>>>
>> <param-name>filterMappingUrlPattern</param-name>
>>> <param-value>/test/*</param-value>
>>> </init-param>
>>> </filter>
>>>
>>> <filter-mapping>
>>> <filter-name>wicket.myproject</filter-name>
>>> <url-pattern>/test/*</url-pattern>
>>> </filter-mapping>
>>>
>>> </web-app>
>>>
>>> -----Original Message-----
>>> From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
>>> Sent: Friday, June 13, 2008 2:45 PM
>>> To: [email protected]
>>> Subject: Re: Wicket 1.2 -> 1.3 upgrade question
>>>
>>> the filter itself takes a configuration param where you have to
>>> repeat
>>
>>> the mapping...
>>>
>>> class WicketFilter {
>>> /**
>>> * The name of the root path parameter that specifies the root
>
>>> dir of the app.
>>> */
>>> public static final String FILTER_MAPPING_PARAM =
>>> "filterMappingUrlPattern";
>>>
>>> String filterMapping =
>>> filterConfig.getInitParameter(WicketFilter.FILTER_MAPPING_PARAM);
>>> }
>>>
>>> -igor
>>>
>>> On Fri, Jun 13, 2008 at 11:09 AM, Frank Silbermann
>>> <[EMAIL PROTECTED]> wrote:
>>>> Yes, there is a <filter-mapping> element that maps <filter-name> to
>>>> <url-pattern>.
>>>>
>>>> However, as I mentioned in
>>>> http://www.nabble.com/Re%3A-%28Class%3C--extends-Page%3C-%3E%3E%29-c
>>>> a s ti ng-troubles-td17640954i40.html#a17824049, when I changed the
>>>> <url-pattern> from "/*" to "/something/*" -- my static images
>>>> (referenced by the HTML such as
>>>>
>>>> < img wicket:id="picture" src="image1.png" alt="Picture"/ >
>>>>
>>>> where "image1.png" was set via AttributeModifyer) no longer
> appeared.
>>>>
>>>> That suggested to me that perhaps I wasn't supposed to change the
>>>> <url-pattern> of the filter. Should I submit this as a JIRA issue?
>>>>
>>>> -----Original Message-----
>>>> From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
>>>> Sent: Friday, June 13, 2008 12:53 PM
>>>> To: [email protected]
>>>> Subject: Re: Wicket 1.2 -> 1.3 upgrade question
>>>>
>>>> you have to give the mapping as a config param to the filter also, i
>
>>>> forget the exact name right now...
>>>>
>>>> -igor
>>>>
>>>> On Fri, Jun 13, 2008 at 10:00 AM, Frank Silbermann
>>>> <[EMAIL PROTECTED]> wrote:
>>>>> Wicket 1.3 is configured as a filter rather than as a servlet. The
>
>>>>> Quickstart shows a filter whose URL-PATTERN is "/*".
>>>>>
>>>>> The project that I wish to upgrade contains two Wicket 1.2
>>>>> application
>>>>
>>>>> servlets (two different home-pages accessed via different URLs),
>>>>> and
>>
>>>>> one plain-vanilla non-Wicket servlet. They are deployed together
>>>>> because they share the same code-base.
>>>>>
>>>>> This is my Wicket 1.2 project's web.xml file. How do I do this
>>>>> sort
>>
>>>>> of thing in Wicket 1.3?
>>>>>
>>>>> <?xml version="1.0" encoding="UTF-8"?> <web-app
>>>>> xmlns="http://java.sun.com/xml/ns/j2ee
>>>>> <http://java.sun.com/xml/ns/j2ee> "
>>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
>>>>> <http://www.w3.org/2001/XMLSchema-instance> "
>>>>> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
>>>>> <http://java.sun.com/xml/ns/j2ee>
>>>>> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd
>>>>> <http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd> " version="2.4">
>>>>> <display-name>MEMSpssWebModule</display-name>
>>>>> <context-param>
>>>>> <param-name>configuration</param-name>
>>>>> <param-value>development</param-value>
>>>>> </context-param>
>>>>> <servlet>
>>>>> <servlet-name>MEM_Application</servlet-name>
>>>>>
> <servlet-class>wicket.protocol.http.WicketServlet</servlet-class>
>>>>> <init-param>
>>>>> <param-name>applicationClassName</param-name>
>>>>> <param-value>mem.MEM_Application</param-value>
>>>>> </init-param>
>>>>> <load-on-startup>1</load-on-startup>
>>>>> </servlet>
>>>>> <servlet-mapping>
>>>>> <servlet-name>MEM_Application</servlet-name>
>>>>> <url-pattern>/mem/*</url-pattern> </servlet-mapping>
>>>>>
>>>>> <servlet>
>>>>> <servlet-name>MEMTestApplication</servlet-name>
>>>>>
> <servlet-class>wicket.protocol.http.WicketServlet</servlet-class>
>>>>> <init-param>
>>>>> <param-name>applicationClassName</param-name>
>>>>> <param-value>mem.TestApplication</param-value>
>>>>> </init-param>
>>>>> <load-on-startup>1</load-on-startup>
>>>>> </servlet>
>>>>> <servlet-mapping>
>>>>> <servlet-name>MEMTestApplication</servlet-name>
>>>>> <url-pattern>/MEMTest/*</url-pattern>
>>>>> </servlet-mapping>
>>>>>
>>>>>
>>>>> <servlet>
>>>>> <servlet-name>trackingnumbers</servlet-name>
>>>>> <servlet-class>mem.TrackingNumbers</servlet-class>
>>>>> </servlet>
>>>>> <servlet-mapping>
>>>>> <servlet-name>trackingnumbers</servlet-name>
>>>>> <url-pattern>/trackingnumbers</url-pattern>
>>>>> </servlet-mapping>
>>>>>
>>>>> <resource-ref>
>>>>> <description>Resource reference to a factory for
>>>> java.sql.Connection
>>>>> instances that may be used for talking to a particular
>>>>> database that is configured in the server.xml
>>> file.</description>
>>>>> <res-ref-name>jdbc/database</res-ref-name>
>>>>> <res-type>javax.sql.DataSource</res-type>
>>>>> <res-auth>Container</res-auth>
>>>>> </resource-ref>
>>>>> </web-app>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> --------------------------------------------------------------------
>>>> - To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>
>>>>
>>>> --------------------------------------------------------------------
>>>> - To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.3 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.3
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]