Re: Wicket 1.5 migration questions

2012-09-13 Thread Alec Swan
Martin, I tried and came back :) Could you clarify how you suggest
response.renderCSSReference to pass parameters which are then
retrieved in ResourceReference#getName()

On Wed, Sep 12, 2012 at 4:26 PM, Alec Swan alecs...@gmail.com wrote:
 Maybe you could simply use
 response.renderCSSReference(getRequest().getContextPath() + 
 /global/css/styles.css);
 or is there a problem with it?
 That didn't fix request.getUrl().toString() returning an empty string
 when called from ResourceReference.getExtension()

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket 1.5 migration questions

2012-09-13 Thread Martin Grigorov
in YourComponent.java:
PageParameters params = new PageParameters();
params.set(0, css);
params.set(1, styles.css);
url = urlFor(new MountedResourceReference(), params);

response.renderCSSReference(url)


in MyApp#init():
mountResource(global, new MountedResourceReference());


in MountedResourceReference.java:
class MountedResourceReference extends ResourceReference {

   public MountedResourceReference() {
 super(MyApplication.class, globals);
   }

   @Override public void getResource(Attributes attrs) {
  path = attrs.getRequest().getUtl().getPath();
  if (path.endsWith(.css)) {
 return new CssPackageResource(TheAliasedFrom14.class, path);
  }
  else if (path.endsWith(.js)) {
 return new JavaScriptPackageResource(TheAliasedFrom14.class, path);
  }
  else {
 return new PackageResource(TheAliasedFrom14.class, path);
  }
   }
}


On Fri, Sep 14, 2012 at 3:36 AM, Alec Swan alecs...@gmail.com wrote:
 Martin, I tried and came back :) Could you clarify how you suggest
 response.renderCSSReference to pass parameters which are then
 retrieved in ResourceReference#getName()

 On Wed, Sep 12, 2012 at 4:26 PM, Alec Swan alecs...@gmail.com wrote:
 Maybe you could simply use
 response.renderCSSReference(getRequest().getContextPath() + 
 /global/css/styles.css);
 or is there a problem with it?
 That didn't fix request.getUrl().toString() returning an empty string
 when called from ResourceReference.getExtension()

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket 1.5 migration questions

2012-09-12 Thread Alec Swan
Paul, I looked at IResource and ResourceReference classes but still
can't figure out how to implement an alternative to putClassAlias.

In 1.4 you could do putClassAlias(GlobalResourceScope.class, global)
and after that all new ResourceReference(GlobalResourceScope.class,
relative/path/file.js) would automatically be accessible from
http://../global/relative/path/file.js. So, I could easily call
response.renderJavaScript(new
JavaScriptReference(GlobalResourceScope.class,
relative/path/file.js)) anywhere in the code without mounting
relative/path/file.js explicitly in Application#init.

In 1.5 I have three options: mountResource, mountPackage and
mount(IRequestMapper).

mountResource requires me to mount each individual resource file in
Application, which is not what I want because we have a lot of
resource files and we add them often.
mountPackage works with pages only, but reflects the concept that I
need to implement for resource files.
mount(IRequestMapper) - I think I should be able to use this method to
implement what I want. I noticed that there are a few IRequestMapper
implementations, which one should I extend?

Thanks,

Alec

On Tue, Sep 11, 2012 at 2:32 PM, Paul Bors p...@bors.ws wrote:
 I never said that, I just gave you an alternate way of achieving the same
 thing :)

 I'm not familiar nor did I ever use the SharedResources#putClassAlias()
 method, but given the API for SharedResources it seems to have been moved or
 removed.

 Wicket 1.4.x (has it at):
 http://wicket.apache.org/apidocs/1.4/org/apache/wicket/SharedResources.html#
 putClassAlias(java.lang.Class, java.lang.String)

 Wicket 1.5.x (does not list it, at least not in the same class name):
 http://wicket.apache.org/apidocs/1.5/org/apache/wicket/SharedResources.html

 If adding the resources to the root of the war works, why bother?
 Unless you're packaging a reusable component or you use dynamic resources,
 but having a static URL might indicate otherwise.

 Take a look at IResource and the many different implementations of it and
 see which one can help you most, or implement your own either from scratch
 or extending an existing one :)
 http://wicket.apache.org/apidocs/1.5/org/apache/wicket/request/resource/IRes
 ource.html

 ~ Thank you,
   Paul Bors

 -Original Message-
 From: Alec Swan [mailto:alecs...@gmail.com]
 Sent: Tuesday, September 11, 2012 11:42 AM
 To: users@wicket.apache.org
 Subject: Re: Wicket 1.5 migration questions

 I take it by global you mean http://myServer:###/myWebApp/global?
 Yes.

 If so, why don't you just add the folder to the root of your war?
 Good point, I could do that, but I'd rather keep my current folder
 structure.

 So, does it mean that putClassAlias functionality is gone in 1.5?

 Thanks,

 Alec

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket 1.5 migration questions

2012-09-12 Thread Martin Grigorov
Hi Alec,

See my previous response. Try it and then come back.

On Wed, Sep 12, 2012 at 5:43 PM, Alec Swan alecs...@gmail.com wrote:
 Paul, I looked at IResource and ResourceReference classes but still
 can't figure out how to implement an alternative to putClassAlias.

 In 1.4 you could do putClassAlias(GlobalResourceScope.class, global)
 and after that all new ResourceReference(GlobalResourceScope.class,
 relative/path/file.js) would automatically be accessible from
 http://../global/relative/path/file.js. So, I could easily call
 response.renderJavaScript(new
 JavaScriptReference(GlobalResourceScope.class,
 relative/path/file.js)) anywhere in the code without mounting
 relative/path/file.js explicitly in Application#init.

 In 1.5 I have three options: mountResource, mountPackage and
 mount(IRequestMapper).

 mountResource requires me to mount each individual resource file in
 Application, which is not what I want because we have a lot of
 resource files and we add them often.
 mountPackage works with pages only, but reflects the concept that I
 need to implement for resource files.
 mount(IRequestMapper) - I think I should be able to use this method to
 implement what I want. I noticed that there are a few IRequestMapper
 implementations, which one should I extend?

 Thanks,

 Alec

 On Tue, Sep 11, 2012 at 2:32 PM, Paul Bors p...@bors.ws wrote:
 I never said that, I just gave you an alternate way of achieving the same
 thing :)

 I'm not familiar nor did I ever use the SharedResources#putClassAlias()
 method, but given the API for SharedResources it seems to have been moved or
 removed.

 Wicket 1.4.x (has it at):
 http://wicket.apache.org/apidocs/1.4/org/apache/wicket/SharedResources.html#
 putClassAlias(java.lang.Class, java.lang.String)

 Wicket 1.5.x (does not list it, at least not in the same class name):
 http://wicket.apache.org/apidocs/1.5/org/apache/wicket/SharedResources.html

 If adding the resources to the root of the war works, why bother?
 Unless you're packaging a reusable component or you use dynamic resources,
 but having a static URL might indicate otherwise.

 Take a look at IResource and the many different implementations of it and
 see which one can help you most, or implement your own either from scratch
 or extending an existing one :)
 http://wicket.apache.org/apidocs/1.5/org/apache/wicket/request/resource/IRes
 ource.html

 ~ Thank you,
   Paul Bors

 -Original Message-
 From: Alec Swan [mailto:alecs...@gmail.com]
 Sent: Tuesday, September 11, 2012 11:42 AM
 To: users@wicket.apache.org
 Subject: Re: Wicket 1.5 migration questions

 I take it by global you mean http://myServer:###/myWebApp/global?
 Yes.

 If so, why don't you just add the folder to the root of your war?
 Good point, I could do that, but I'd rather keep my current folder
 structure.

 So, does it mean that putClassAlias functionality is gone in 1.5?

 Thanks,

 Alec

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



RE: Wicket 1.5 migration questions

2012-09-12 Thread Paul Bors
Hey Alec,

I think Martin was referring to his earlier reply on Sep 06, 2012; 2:02pm from 
the thread when he asked you to try and extend PackageResourceReference and 
then mount your resources as:
mountResource(/global, new MyPackageResourceReference())

Give that a try and let us know how it works out :)

 ~ Thank you,
   Paul Bors

PS: Martin would know better, he's a developer on Wicket's team (you can tell 
from his e-mail address).
I'm just another fellow Wicket-er.

-Original Message-
From: Martin Grigorov [mailto:mgrigo...@apache.org] 
Sent: Wednesday, September 12, 2012 11:04 AM
To: users@wicket.apache.org
Subject: Re: Wicket 1.5 migration questions

Hi Alec,

See my previous response. Try it and then come back.

On Wed, Sep 12, 2012 at 5:43 PM, Alec Swan alecs...@gmail.com wrote:
 Paul, I looked at IResource and ResourceReference classes but still 
 can't figure out how to implement an alternative to putClassAlias.

 In 1.4 you could do putClassAlias(GlobalResourceScope.class, global) 
 and after that all new ResourceReference(GlobalResourceScope.class,
 relative/path/file.js) would automatically be accessible from 
 http://../global/relative/path/file.js. So, I could easily call 
 response.renderJavaScript(new 
 JavaScriptReference(GlobalResourceScope.class,
 relative/path/file.js)) anywhere in the code without mounting 
 relative/path/file.js explicitly in Application#init.

 In 1.5 I have three options: mountResource, mountPackage and 
 mount(IRequestMapper).

 mountResource requires me to mount each individual resource file in 
 Application, which is not what I want because we have a lot of 
 resource files and we add them often.
 mountPackage works with pages only, but reflects the concept that I 
 need to implement for resource files.
 mount(IRequestMapper) - I think I should be able to use this method to 
 implement what I want. I noticed that there are a few IRequestMapper 
 implementations, which one should I extend?

 Thanks,

 Alec

 On Tue, Sep 11, 2012 at 2:32 PM, Paul Bors p...@bors.ws wrote:
 I never said that, I just gave you an alternate way of achieving the 
 same thing :)

 I'm not familiar nor did I ever use the 
 SharedResources#putClassAlias() method, but given the API for 
 SharedResources it seems to have been moved or removed.

 Wicket 1.4.x (has it at):
 http://wicket.apache.org/apidocs/1.4/org/apache/wicket/SharedResource
 s.html# putClassAlias(java.lang.Class, java.lang.String)

 Wicket 1.5.x (does not list it, at least not in the same class name):
 http://wicket.apache.org/apidocs/1.5/org/apache/wicket/SharedResource
 s.html

 If adding the resources to the root of the war works, why bother?
 Unless you're packaging a reusable component or you use dynamic 
 resources, but having a static URL might indicate otherwise.

 Take a look at IResource and the many different implementations of it 
 and see which one can help you most, or implement your own either 
 from scratch or extending an existing one :) 
 http://wicket.apache.org/apidocs/1.5/org/apache/wicket/request/resour
 ce/IRes
 ource.html

 ~ Thank you,
   Paul Bors

 -Original Message-
 From: Alec Swan [mailto:alecs...@gmail.com]
 Sent: Tuesday, September 11, 2012 11:42 AM
 To: users@wicket.apache.org
 Subject: Re: Wicket 1.5 migration questions

 I take it by global you mean http://myServer:###/myWebApp/global?
 Yes.

 If so, why don't you just add the folder to the root of your war?
 Good point, I could do that, but I'd rather keep my current folder 
 structure.

 So, does it mean that putClassAlias functionality is gone in 1.5?

 Thanks,

 Alec

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket 1.5 migration questions

2012-09-12 Thread Alec Swan
I tried Martin's approach but it didn't work because
RequestCycle.get().getRequest().getRequestParameters() is empty when
accessed from inside getName(). Maybe I am doing it wrong, so here are
some questions:
1. PackageResourceReference does not have a no-arg constructor, so
what parameter should I pass from MyPackageResourceReference() to
super(..)?
2. How are the callers supposed to use MyPackageResourceReference if
its constructor does not take parameters? In the past they would call
request.renderJavaScript(new
MyPackageResourceReference(relative/path/file.js)), but you suggest
that constructor is not taking any parameters.

Thanks,

Alec


On Wed, Sep 12, 2012 at 11:56 AM, Paul Bors p...@bors.ws wrote:
 Hey Alec,

 I think Martin was referring to his earlier reply on Sep 06, 2012; 2:02pm 
 from the thread when he asked you to try and extend PackageResourceReference 
 and then mount your resources as:
 mountResource(/global, new MyPackageResourceReference())

 Give that a try and let us know how it works out :)

  ~ Thank you,
Paul Bors

 PS: Martin would know better, he's a developer on Wicket's team (you can tell 
 from his e-mail address).
 I'm just another fellow Wicket-er.

 -Original Message-
 From: Martin Grigorov [mailto:mgrigo...@apache.org]
 Sent: Wednesday, September 12, 2012 11:04 AM
 To: users@wicket.apache.org
 Subject: Re: Wicket 1.5 migration questions

 Hi Alec,

 See my previous response. Try it and then come back.

 On Wed, Sep 12, 2012 at 5:43 PM, Alec Swan alecs...@gmail.com wrote:
 Paul, I looked at IResource and ResourceReference classes but still
 can't figure out how to implement an alternative to putClassAlias.

 In 1.4 you could do putClassAlias(GlobalResourceScope.class, global)
 and after that all new ResourceReference(GlobalResourceScope.class,
 relative/path/file.js) would automatically be accessible from
 http://../global/relative/path/file.js. So, I could easily call
 response.renderJavaScript(new
 JavaScriptReference(GlobalResourceScope.class,
 relative/path/file.js)) anywhere in the code without mounting
 relative/path/file.js explicitly in Application#init.

 In 1.5 I have three options: mountResource, mountPackage and
 mount(IRequestMapper).

 mountResource requires me to mount each individual resource file in
 Application, which is not what I want because we have a lot of
 resource files and we add them often.
 mountPackage works with pages only, but reflects the concept that I
 need to implement for resource files.
 mount(IRequestMapper) - I think I should be able to use this method to
 implement what I want. I noticed that there are a few IRequestMapper
 implementations, which one should I extend?

 Thanks,

 Alec

 On Tue, Sep 11, 2012 at 2:32 PM, Paul Bors p...@bors.ws wrote:
 I never said that, I just gave you an alternate way of achieving the
 same thing :)

 I'm not familiar nor did I ever use the
 SharedResources#putClassAlias() method, but given the API for
 SharedResources it seems to have been moved or removed.

 Wicket 1.4.x (has it at):
 http://wicket.apache.org/apidocs/1.4/org/apache/wicket/SharedResource
 s.html# putClassAlias(java.lang.Class, java.lang.String)

 Wicket 1.5.x (does not list it, at least not in the same class name):
 http://wicket.apache.org/apidocs/1.5/org/apache/wicket/SharedResource
 s.html

 If adding the resources to the root of the war works, why bother?
 Unless you're packaging a reusable component or you use dynamic
 resources, but having a static URL might indicate otherwise.

 Take a look at IResource and the many different implementations of it
 and see which one can help you most, or implement your own either
 from scratch or extending an existing one :)
 http://wicket.apache.org/apidocs/1.5/org/apache/wicket/request/resour
 ce/IRes
 ource.html

 ~ Thank you,
   Paul Bors

 -Original Message-
 From: Alec Swan [mailto:alecs...@gmail.com]
 Sent: Tuesday, September 11, 2012 11:42 AM
 To: users@wicket.apache.org
 Subject: Re: Wicket 1.5 migration questions

 I take it by global you mean http://myServer:###/myWebApp/global?
 Yes.

 If so, why don't you just add the folder to the root of your war?
 Good point, I could do that, but I'd rather keep my current folder
 structure.

 So, does it mean that putClassAlias functionality is gone in 1.5?

 Thanks,

 Alec

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development

RE: Wicket 1.5 migration questions

2012-09-12 Thread Paul Bors
PackageResourceReference IS-A ResourceReference and neither has a no-arg
constructor.

To see examples of how to implement your own PackageResourceReference take a
look at its children such as CssResourceReference for example and how it
initialized itself via the #getResource() method.

  ~ Thank you,
Paul Bors

PS: Wicket itself is full of examples, the power of open source :)

-Original Message-
From: Alec Swan [mailto:alecs...@gmail.com] 
Sent: Wednesday, September 12, 2012 2:00 PM
To: users@wicket.apache.org
Subject: Re: Wicket 1.5 migration questions

I tried Martin's approach but it didn't work because
RequestCycle.get().getRequest().getRequestParameters() is empty when
accessed from inside getName(). Maybe I am doing it wrong, so here are some
questions:
1. PackageResourceReference does not have a no-arg constructor, so what
parameter should I pass from MyPackageResourceReference() to super(..)?
2. How are the callers supposed to use MyPackageResourceReference if its
constructor does not take parameters? In the past they would call
request.renderJavaScript(new
MyPackageResourceReference(relative/path/file.js)), but you suggest that
constructor is not taking any parameters.

Thanks,

Alec


On Wed, Sep 12, 2012 at 11:56 AM, Paul Bors p...@bors.ws wrote:
 Hey Alec,

 I think Martin was referring to his earlier reply on Sep 06, 2012; 2:02pm
from the thread when he asked you to try and extend PackageResourceReference
and then mount your resources as:
 mountResource(/global, new MyPackageResourceReference())

 Give that a try and let us know how it works out :)

  ~ Thank you,
Paul Bors

 PS: Martin would know better, he's a developer on Wicket's team (you can
tell from his e-mail address).
 I'm just another fellow Wicket-er.

 -Original Message-
 From: Martin Grigorov [mailto:mgrigo...@apache.org]
 Sent: Wednesday, September 12, 2012 11:04 AM
 To: users@wicket.apache.org
 Subject: Re: Wicket 1.5 migration questions

 Hi Alec,

 See my previous response. Try it and then come back.

 On Wed, Sep 12, 2012 at 5:43 PM, Alec Swan alecs...@gmail.com wrote:
 Paul, I looked at IResource and ResourceReference classes but still 
 can't figure out how to implement an alternative to putClassAlias.

 In 1.4 you could do putClassAlias(GlobalResourceScope.class, 
 global) and after that all new 
 ResourceReference(GlobalResourceScope.class,
 relative/path/file.js) would automatically be accessible from 
 http://../global/relative/path/file.js. So, I could easily call 
 response.renderJavaScript(new 
 JavaScriptReference(GlobalResourceScope.class,
 relative/path/file.js)) anywhere in the code without mounting 
 relative/path/file.js explicitly in Application#init.

 In 1.5 I have three options: mountResource, mountPackage and 
 mount(IRequestMapper).

 mountResource requires me to mount each individual resource file in 
 Application, which is not what I want because we have a lot of 
 resource files and we add them often.
 mountPackage works with pages only, but reflects the concept that I 
 need to implement for resource files.
 mount(IRequestMapper) - I think I should be able to use this method 
 to implement what I want. I noticed that there are a few 
 IRequestMapper implementations, which one should I extend?

 Thanks,

 Alec

 On Tue, Sep 11, 2012 at 2:32 PM, Paul Bors p...@bors.ws wrote:
 I never said that, I just gave you an alternate way of achieving the 
 same thing :)

 I'm not familiar nor did I ever use the
 SharedResources#putClassAlias() method, but given the API for 
 SharedResources it seems to have been moved or removed.

 Wicket 1.4.x (has it at):
 http://wicket.apache.org/apidocs/1.4/org/apache/wicket/SharedResourc
 e s.html# putClassAlias(java.lang.Class, java.lang.String)

 Wicket 1.5.x (does not list it, at least not in the same class name):
 http://wicket.apache.org/apidocs/1.5/org/apache/wicket/SharedResourc
 e
 s.html

 If adding the resources to the root of the war works, why bother?
 Unless you're packaging a reusable component or you use dynamic 
 resources, but having a static URL might indicate otherwise.

 Take a look at IResource and the many different implementations of 
 it and see which one can help you most, or implement your own either 
 from scratch or extending an existing one :) 
 http://wicket.apache.org/apidocs/1.5/org/apache/wicket/request/resou
 r
 ce/IRes
 ource.html

 ~ Thank you,
   Paul Bors

 -Original Message-
 From: Alec Swan [mailto:alecs...@gmail.com]
 Sent: Tuesday, September 11, 2012 11:42 AM
 To: users@wicket.apache.org
 Subject: Re: Wicket 1.5 migration questions

 I take it by global you mean http://myServer:###/myWebApp/global?
 Yes.

 If so, why don't you just add the folder to the root of your war?
 Good point, I could do that, but I'd rather keep my current folder 
 structure.

 So, does it mean that putClassAlias functionality is gone in 1.5?

 Thanks,

 Alec

Re: Wicket 1.5 migration questions

2012-09-12 Thread Alec Swan
 PackageResourceReference IS-A ResourceReference and neither has a no-arg 
 constructor.
My point exactly. That's why I can't just do mountResource(/global,
new MyRR()) as Martin suggested.

 To see examples of how to implement your own PackageResourceReference take a
 look at its children such as CssResourceReference for example and how it
 initialized itself via the #getResource() method.
Yes, I already looked at samples and
PackageResourceReference#getResource implementation. Believe me I am
not a big fan of typing emails :)

I understand what Martin is suggesting but I don't see how I can call
mountResource(/global, new MyRR()) with no-arg MyRR constructor.
Moreover, I don't understand how or where to pass request parameters
so that they can be retrieved in my implementation of
ResourceReference#getName().

In 1.4 it was all straightforward:
Application.getSharedResources().putClassAlias(GlobalResourceScope.class,
global)

And then different callers can invoke any of the following and have
all JavaScript URLs prefixed with global/.
request.renderJavaScript(new
GlobalJavascriptResourceReference(GlobalResourceScope.class,
js/common.js));
request.renderJavaScript(new
GlobalJavascriptResourceReference(GlobalResourceScope.class,
js/events.js));
request.renderJavaScript(new
GlobalJavascriptResourceReference(GlobalResourceScope.class,
js/debug.js));

Sorry for being so dense on this one.

Thanks,

Alec

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket 1.5 migration questions

2012-09-12 Thread Christoph Leiter

On 12.09.2012 21:38, Alec Swan wrote:

PackageResourceReference IS-A ResourceReference and neither has a no-arg 
constructor.

My point exactly. That's why I can't just do mountResource(/global,
new MyRR()) as Martin suggested.


My quick try:

public class MyPackageResourceReference extends PackageResourceReference {

private final String prefix;

public MyPackageResourceReference(Class? scope, String prefix) {
super(scope, dummy);
this.prefix = prefix;
}

@Override
public String getName() {
Request request = RequestCycle.get().getRequest();
String url = request.getUrl().toString();
if (!url.startsWith(prefix)) {
throw new IllegalStateException();
}
return url.substring(prefix.length());
}

}

Use it like:
mountResource(/global, new 
MyPackageResourceReference(MyResources.class, global/));


It needs to know where it is mounted so it can remove the prefix. Maybe 
there's a more elegant way around this but it works.



Christoph

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket 1.5 migration questions

2012-09-12 Thread Alec Swan
Thanks, Christoph.

I tested your implementation and was able to pull
global/css/styles.css from the browser.

However, the following code threw an exception:
response.renderCSSReference(new
MyPackageResourceReference(MyResources.class, css/styles.css),
screen);

I also tried:
response.renderCSSReference(new
MyPackageResourceReference(MyResources.class,
global/css/styles.css), screen);

In fact request.getUrl().toString() inside of getName() returns an
empty string when called from ResourceReference.getExtension().

Alec

On Wed, Sep 12, 2012 at 1:56 PM, Christoph Leiter
m...@christophleiter.com wrote:
 On 12.09.2012 21:38, Alec Swan wrote:

 PackageResourceReference IS-A ResourceReference and neither has a no-arg
 constructor.

 My point exactly. That's why I can't just do mountResource(/global,
 new MyRR()) as Martin suggested.


 My quick try:

 public class MyPackageResourceReference extends PackageResourceReference {

 private final String prefix;

 public MyPackageResourceReference(Class? scope, String prefix) {
 super(scope, dummy);
 this.prefix = prefix;
 }

 @Override
 public String getName() {
 Request request = RequestCycle.get().getRequest();
 String url = request.getUrl().toString();
 if (!url.startsWith(prefix)) {
 throw new IllegalStateException();
 }
 return url.substring(prefix.length());
 }

 }

 Use it like:
 mountResource(/global, new MyPackageResourceReference(MyResources.class,
 global/));

 It needs to know where it is mounted so it can remove the prefix. Maybe
 there's a more elegant way around this but it works.


 Christoph


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket 1.5 migration questions

2012-09-12 Thread Christoph Leiter

On 12.09.2012 22:50, Alec Swan wrote:

I tested your implementation and was able to pull
global/css/styles.css from the browser.

However, the following code threw an exception:
response.renderCSSReference(new
MyPackageResourceReference(MyResources.class, css/styles.css),
screen);


Maybe you could simply use
response.renderCSSReference(
getRequest().getContextPath() + /global/css/styles.css);
or is there a problem with it?


Christoph

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket 1.5 migration questions

2012-09-12 Thread Alec Swan
 Maybe you could simply use
 response.renderCSSReference(getRequest().getContextPath() + 
 /global/css/styles.css);
 or is there a problem with it?
That didn't fix request.getUrl().toString() returning an empty string
when called from ResourceReference.getExtension()

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



RE: Wicket 1.5 migration questions

2012-09-11 Thread Paul Bors
I take it by global you mean http://myServer:###/myWebApp/global?

If so, why don't you just add the folder to the root of your war?

See how the static file such as HTML pages and images are handled in a Web
Module:
http://docs.oracle.com/cd/E13222_01/wls/docs70/webapp/basics.html#136976

~ Thank you,
  Paul Bors

-Original Message-
From: Alec Swan [mailto:alecs...@gmail.com] 
Sent: Monday, September 10, 2012 7:43 PM
To: users@wicket.apache.org
Subject: Re: Wicket 1.5 migration questions

Any update on this? How can I mount CSS and JS resources under /global/
without having to do a mountResource() for every such file?

Thanks,

Alec

On Thu, Sep 6, 2012 at 12:07 PM, Alec Swan alecs...@gmail.com wrote:
 But I want JavaScript files to be compresses by 
 JavaScriptResourceReference and CSS be served as 
 PackageResourceReference. How do I mount them both under /global URL 
 suffix?

 On Thu, Sep 6, 2012 at 12:02 PM, Martin Grigorov mgrigo...@apache.org
wrote:
 extend PackageResourceReference and override its #getName() to read 
 the name from the request path/parameters mountResource(/global, 
 new MyPRR())

 On Thu, Sep 6, 2012 at 7:57 PM, Alec Swan alecs...@gmail.com wrote:
 In 1.4 I had the following classes in com.myco.app.res package:

 GlobalJavascriptResourceReference extends 
 JavaScriptResourceReference GlobalCompressedResourceReference 
 extends PackageResourceReference GlobalResourceScope

 And Application had the following code:
 getSharedResources().putClassAlias(GlobalResourceScope.class, 
 global)

 The caller would add resources as follows:
 new GlobalJavascriptResourceReference(GlobalResourceScope.class,
 js/common.js);
 new GlobalCompressedResourceReference(GlobalResourceScope.class,
 css/styles.css);

 How should I port this to 1.5 so that I can still access 
 http://../global/js/common.js and http://../global/js/styles.css?

 Thanks,

 Alec

 On Tue, Sep 4, 2012 at 5:10 PM, Martin Grigorov mgrigo...@apache.org
wrote:
 On Tue, Sep 4, 2012 at 11:17 PM, Alec Swan alecs...@gmail.com wrote:
 Well, mountPackage did not work for me either.

 Basically, what I want to do is access ALL resources in 
 com.myco.app.res package with global URL prefix. For example, 
 access a JavaScript file as global/events.js instead of 
 ../wicket/resource/com.myco.app.res.GlobalResourceScope/events.js URL.
 In 1.4 it was simple with
 putClassAlias(com.myco.app.res.GlobalResourceScope, global).

 How can I do this with 1.5?

 Why #mountResource() didn't work for you ?


 Thanks,

 Alec

 On Tue, Sep 4, 2012 at 10:59 AM, Alec Swan alecs...@gmail.com wrote:
 Tom,

 I have com.myco.app.res.GlobalResourceScope.class and events.js 
 in the same package. So, putClassAlias(GlobalResourceScope.class, 
 global) in 1.4 would allow me to access 
 http://../app/global/events.js in the browser.

 It seems like in 1.5 this is similar to mountPackage(String, Class?
 extends Page) which means I have to change GlobalResourceScope 
 class to extend Page, right? Why does it need to be a Page?

 Thanks,

 Alec

 On Tue, Sep 4, 2012 at 9:42 AM, Thomas Götz t...@decoded.de wrote:
 I didn't get your usecase exactly yet, but maybe this will help you:
 http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/

 Cheers,
-Tom


 On 04.09.2012, at 17:33, Alec Swan alecs...@gmail.com wrote:

 I saw the link explaining how to migrate 
 SharedResources#putClassAlias(GlobalResourceScope.class,
global)
 before but was found it confusing because global and images
 aliases 1.4 version were replaced with imgres in 1.5 example.

 All I need to do is use global in place of 
 GlobalResourceScope.class in the URLs. How do I do this in 1.5?


 
 - To unsubscribe, e-mail: 
 users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


 --
 --- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com

 ---
 -- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


 
 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional

Re: Wicket 1.5 migration questions

2012-09-11 Thread Alec Swan
 I take it by global you mean http://myServer:###/myWebApp/global?
Yes.

 If so, why don't you just add the folder to the root of your war?
Good point, I could do that, but I'd rather keep my current folder structure.

So, does it mean that putClassAlias functionality is gone in 1.5?

Thanks,

Alec

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



RE: Wicket 1.5 migration questions

2012-09-11 Thread Paul Bors
I never said that, I just gave you an alternate way of achieving the same
thing :)

I'm not familiar nor did I ever use the SharedResources#putClassAlias()
method, but given the API for SharedResources it seems to have been moved or
removed.

Wicket 1.4.x (has it at):
http://wicket.apache.org/apidocs/1.4/org/apache/wicket/SharedResources.html#
putClassAlias(java.lang.Class, java.lang.String)

Wicket 1.5.x (does not list it, at least not in the same class name):
http://wicket.apache.org/apidocs/1.5/org/apache/wicket/SharedResources.html

If adding the resources to the root of the war works, why bother?
Unless you're packaging a reusable component or you use dynamic resources,
but having a static URL might indicate otherwise.

Take a look at IResource and the many different implementations of it and
see which one can help you most, or implement your own either from scratch
or extending an existing one :)
http://wicket.apache.org/apidocs/1.5/org/apache/wicket/request/resource/IRes
ource.html

~ Thank you,
  Paul Bors

-Original Message-
From: Alec Swan [mailto:alecs...@gmail.com] 
Sent: Tuesday, September 11, 2012 11:42 AM
To: users@wicket.apache.org
Subject: Re: Wicket 1.5 migration questions

 I take it by global you mean http://myServer:###/myWebApp/global?
Yes.

 If so, why don't you just add the folder to the root of your war?
Good point, I could do that, but I'd rather keep my current folder
structure.

So, does it mean that putClassAlias functionality is gone in 1.5?

Thanks,

Alec

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket 1.5 migration questions

2012-09-10 Thread Alec Swan
Any update on this? How can I mount CSS and JS resources under
/global/ without having to do a mountResource() for every such file?

Thanks,

Alec

On Thu, Sep 6, 2012 at 12:07 PM, Alec Swan alecs...@gmail.com wrote:
 But I want JavaScript files to be compresses by
 JavaScriptResourceReference and CSS be served as
 PackageResourceReference. How do I mount them both under /global URL
 suffix?

 On Thu, Sep 6, 2012 at 12:02 PM, Martin Grigorov mgrigo...@apache.org wrote:
 extend PackageResourceReference and override its #getName() to read
 the name from the request path/parameters
 mountResource(/global, new MyPRR())

 On Thu, Sep 6, 2012 at 7:57 PM, Alec Swan alecs...@gmail.com wrote:
 In 1.4 I had the following classes in com.myco.app.res package:

 GlobalJavascriptResourceReference extends JavaScriptResourceReference
 GlobalCompressedResourceReference extends PackageResourceReference
 GlobalResourceScope

 And Application had the following code:
 getSharedResources().putClassAlias(GlobalResourceScope.class, global)

 The caller would add resources as follows:
 new GlobalJavascriptResourceReference(GlobalResourceScope.class,
 js/common.js);
 new GlobalCompressedResourceReference(GlobalResourceScope.class,
 css/styles.css);

 How should I port this to 1.5 so that I can still access
 http://../global/js/common.js and http://../global/js/styles.css?

 Thanks,

 Alec

 On Tue, Sep 4, 2012 at 5:10 PM, Martin Grigorov mgrigo...@apache.org 
 wrote:
 On Tue, Sep 4, 2012 at 11:17 PM, Alec Swan alecs...@gmail.com wrote:
 Well, mountPackage did not work for me either.

 Basically, what I want to do is access ALL resources in
 com.myco.app.res package with global URL prefix. For example, access
 a JavaScript file as global/events.js instead of
 ../wicket/resource/com.myco.app.res.GlobalResourceScope/events.js URL.
 In 1.4 it was simple with
 putClassAlias(com.myco.app.res.GlobalResourceScope, global).

 How can I do this with 1.5?

 Why #mountResource() didn't work for you ?


 Thanks,

 Alec

 On Tue, Sep 4, 2012 at 10:59 AM, Alec Swan alecs...@gmail.com wrote:
 Tom,

 I have com.myco.app.res.GlobalResourceScope.class and events.js in the
 same package. So, putClassAlias(GlobalResourceScope.class, global)
 in 1.4 would allow me to access http://../app/global/events.js in the
 browser.

 It seems like in 1.5 this is similar to mountPackage(String, Class?
 extends Page) which means I have to change GlobalResourceScope class
 to extend Page, right? Why does it need to be a Page?

 Thanks,

 Alec

 On Tue, Sep 4, 2012 at 9:42 AM, Thomas Götz t...@decoded.de wrote:
 I didn't get your usecase exactly yet, but maybe this will help you:
 http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/

 Cheers,
-Tom


 On 04.09.2012, at 17:33, Alec Swan alecs...@gmail.com wrote:

 I saw the link explaining how to migrate
 SharedResources#putClassAlias(GlobalResourceScope.class, global)
 before but was found it confusing because global and images
 aliases 1.4 version were replaced with imgres in 1.5 example.

 All I need to do is use global in place of GlobalResourceScope.class
 in the URLs. How do I do this in 1.5?


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket 1.5 migration questions

2012-09-06 Thread Alec Swan
In 1.4 I had the following classes in com.myco.app.res package:

GlobalJavascriptResourceReference extends JavaScriptResourceReference
GlobalCompressedResourceReference extends PackageResourceReference
GlobalResourceScope

And Application had the following code:
getSharedResources().putClassAlias(GlobalResourceScope.class, global)

The caller would add resources as follows:
new GlobalJavascriptResourceReference(GlobalResourceScope.class,
js/common.js);
new GlobalCompressedResourceReference(GlobalResourceScope.class,
css/styles.css);

How should I port this to 1.5 so that I can still access
http://../global/js/common.js and http://../global/js/styles.css?

Thanks,

Alec

On Tue, Sep 4, 2012 at 5:10 PM, Martin Grigorov mgrigo...@apache.org wrote:
 On Tue, Sep 4, 2012 at 11:17 PM, Alec Swan alecs...@gmail.com wrote:
 Well, mountPackage did not work for me either.

 Basically, what I want to do is access ALL resources in
 com.myco.app.res package with global URL prefix. For example, access
 a JavaScript file as global/events.js instead of
 ../wicket/resource/com.myco.app.res.GlobalResourceScope/events.js URL.
 In 1.4 it was simple with
 putClassAlias(com.myco.app.res.GlobalResourceScope, global).

 How can I do this with 1.5?

 Why #mountResource() didn't work for you ?


 Thanks,

 Alec

 On Tue, Sep 4, 2012 at 10:59 AM, Alec Swan alecs...@gmail.com wrote:
 Tom,

 I have com.myco.app.res.GlobalResourceScope.class and events.js in the
 same package. So, putClassAlias(GlobalResourceScope.class, global)
 in 1.4 would allow me to access http://../app/global/events.js in the
 browser.

 It seems like in 1.5 this is similar to mountPackage(String, Class?
 extends Page) which means I have to change GlobalResourceScope class
 to extend Page, right? Why does it need to be a Page?

 Thanks,

 Alec

 On Tue, Sep 4, 2012 at 9:42 AM, Thomas Götz t...@decoded.de wrote:
 I didn't get your usecase exactly yet, but maybe this will help you:
 http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/

 Cheers,
-Tom


 On 04.09.2012, at 17:33, Alec Swan alecs...@gmail.com wrote:

 I saw the link explaining how to migrate
 SharedResources#putClassAlias(GlobalResourceScope.class, global)
 before but was found it confusing because global and images
 aliases 1.4 version were replaced with imgres in 1.5 example.

 All I need to do is use global in place of GlobalResourceScope.class
 in the URLs. How do I do this in 1.5?


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket 1.5 migration questions

2012-09-06 Thread Martin Grigorov
extend PackageResourceReference and override its #getName() to read
the name from the request path/parameters
mountResource(/global, new MyPRR())

On Thu, Sep 6, 2012 at 7:57 PM, Alec Swan alecs...@gmail.com wrote:
 In 1.4 I had the following classes in com.myco.app.res package:

 GlobalJavascriptResourceReference extends JavaScriptResourceReference
 GlobalCompressedResourceReference extends PackageResourceReference
 GlobalResourceScope

 And Application had the following code:
 getSharedResources().putClassAlias(GlobalResourceScope.class, global)

 The caller would add resources as follows:
 new GlobalJavascriptResourceReference(GlobalResourceScope.class,
 js/common.js);
 new GlobalCompressedResourceReference(GlobalResourceScope.class,
 css/styles.css);

 How should I port this to 1.5 so that I can still access
 http://../global/js/common.js and http://../global/js/styles.css?

 Thanks,

 Alec

 On Tue, Sep 4, 2012 at 5:10 PM, Martin Grigorov mgrigo...@apache.org wrote:
 On Tue, Sep 4, 2012 at 11:17 PM, Alec Swan alecs...@gmail.com wrote:
 Well, mountPackage did not work for me either.

 Basically, what I want to do is access ALL resources in
 com.myco.app.res package with global URL prefix. For example, access
 a JavaScript file as global/events.js instead of
 ../wicket/resource/com.myco.app.res.GlobalResourceScope/events.js URL.
 In 1.4 it was simple with
 putClassAlias(com.myco.app.res.GlobalResourceScope, global).

 How can I do this with 1.5?

 Why #mountResource() didn't work for you ?


 Thanks,

 Alec

 On Tue, Sep 4, 2012 at 10:59 AM, Alec Swan alecs...@gmail.com wrote:
 Tom,

 I have com.myco.app.res.GlobalResourceScope.class and events.js in the
 same package. So, putClassAlias(GlobalResourceScope.class, global)
 in 1.4 would allow me to access http://../app/global/events.js in the
 browser.

 It seems like in 1.5 this is similar to mountPackage(String, Class?
 extends Page) which means I have to change GlobalResourceScope class
 to extend Page, right? Why does it need to be a Page?

 Thanks,

 Alec

 On Tue, Sep 4, 2012 at 9:42 AM, Thomas Götz t...@decoded.de wrote:
 I didn't get your usecase exactly yet, but maybe this will help you:
 http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/

 Cheers,
-Tom


 On 04.09.2012, at 17:33, Alec Swan alecs...@gmail.com wrote:

 I saw the link explaining how to migrate
 SharedResources#putClassAlias(GlobalResourceScope.class, global)
 before but was found it confusing because global and images
 aliases 1.4 version were replaced with imgres in 1.5 example.

 All I need to do is use global in place of GlobalResourceScope.class
 in the URLs. How do I do this in 1.5?


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket 1.5 migration questions

2012-09-06 Thread Alec Swan
But I want JavaScript files to be compresses by
JavaScriptResourceReference and CSS be served as
PackageResourceReference. How do I mount them both under /global URL
suffix?

On Thu, Sep 6, 2012 at 12:02 PM, Martin Grigorov mgrigo...@apache.org wrote:
 extend PackageResourceReference and override its #getName() to read
 the name from the request path/parameters
 mountResource(/global, new MyPRR())

 On Thu, Sep 6, 2012 at 7:57 PM, Alec Swan alecs...@gmail.com wrote:
 In 1.4 I had the following classes in com.myco.app.res package:

 GlobalJavascriptResourceReference extends JavaScriptResourceReference
 GlobalCompressedResourceReference extends PackageResourceReference
 GlobalResourceScope

 And Application had the following code:
 getSharedResources().putClassAlias(GlobalResourceScope.class, global)

 The caller would add resources as follows:
 new GlobalJavascriptResourceReference(GlobalResourceScope.class,
 js/common.js);
 new GlobalCompressedResourceReference(GlobalResourceScope.class,
 css/styles.css);

 How should I port this to 1.5 so that I can still access
 http://../global/js/common.js and http://../global/js/styles.css?

 Thanks,

 Alec

 On Tue, Sep 4, 2012 at 5:10 PM, Martin Grigorov mgrigo...@apache.org wrote:
 On Tue, Sep 4, 2012 at 11:17 PM, Alec Swan alecs...@gmail.com wrote:
 Well, mountPackage did not work for me either.

 Basically, what I want to do is access ALL resources in
 com.myco.app.res package with global URL prefix. For example, access
 a JavaScript file as global/events.js instead of
 ../wicket/resource/com.myco.app.res.GlobalResourceScope/events.js URL.
 In 1.4 it was simple with
 putClassAlias(com.myco.app.res.GlobalResourceScope, global).

 How can I do this with 1.5?

 Why #mountResource() didn't work for you ?


 Thanks,

 Alec

 On Tue, Sep 4, 2012 at 10:59 AM, Alec Swan alecs...@gmail.com wrote:
 Tom,

 I have com.myco.app.res.GlobalResourceScope.class and events.js in the
 same package. So, putClassAlias(GlobalResourceScope.class, global)
 in 1.4 would allow me to access http://../app/global/events.js in the
 browser.

 It seems like in 1.5 this is similar to mountPackage(String, Class?
 extends Page) which means I have to change GlobalResourceScope class
 to extend Page, right? Why does it need to be a Page?

 Thanks,

 Alec

 On Tue, Sep 4, 2012 at 9:42 AM, Thomas Götz t...@decoded.de wrote:
 I didn't get your usecase exactly yet, but maybe this will help you:
 http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/

 Cheers,
-Tom


 On 04.09.2012, at 17:33, Alec Swan alecs...@gmail.com wrote:

 I saw the link explaining how to migrate
 SharedResources#putClassAlias(GlobalResourceScope.class, global)
 before but was found it confusing because global and images
 aliases 1.4 version were replaced with imgres in 1.5 example.

 All I need to do is use global in place of GlobalResourceScope.class
 in the URLs. How do I do this in 1.5?


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket 1.5 migration questions

2012-09-04 Thread Thomas Götz
Take a look at the migration guide, this will answer some (if not all) of your 
questions:
https://cwiki.apache.org/WICKET/migration-to-wicket-15.html

   -Tom

On 04.09.2012, at 02:36, Alec Swan alecs...@gmail.com wrote:

 Hello,
 
 I finally decided to bite the bullet and migrate to Wicket 1.5. It
 turned out a lot harder than I expected. Here are some of the issues I
 ran into:
 
 * How to implement HybridUrlCodingStrategy in 1.5?
 
 * I saw a ticket related to putClassAlias, but I couldn't figure out
 how to port this one line to 1.5:
getSharedResources().putClassAlias(GlobalResourceScope.class, global);
 
 * How do I modify the following line to use HTTP in DEVELOPMENT mode?
setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), new
 HttpsConfig(80, 443)));
 
 * WicketTester#setupRequestAndResponse() - what should be used instead?
 
 * How do I integrate WicketTester and Spring? I used the following
 code in 1.4.x:
 InjectorHolder.setInjector(new AnnotSpringInjector(new
 MockContextLocator(myAppContext)));
 InjectorHolder.getInjector().inject(this);
 
 Thanks,
 
 Alec


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket 1.5 migration questions

2012-09-04 Thread Alec Swan
I used that migration guide during the migration but none of the
questions in my original post were answered there.

Alec

On Tue, Sep 4, 2012 at 12:44 AM, Thomas Götz t...@decoded.de wrote:
 Take a look at the migration guide, this will answer some (if not all) of 
 your questions:
 https://cwiki.apache.org/WICKET/migration-to-wicket-15.html

-Tom

 On 04.09.2012, at 02:36, Alec Swan alecs...@gmail.com wrote:

 Hello,

 I finally decided to bite the bullet and migrate to Wicket 1.5. It
 turned out a lot harder than I expected. Here are some of the issues I
 ran into:

 * How to implement HybridUrlCodingStrategy in 1.5?

 * I saw a ticket related to putClassAlias, but I couldn't figure out
 how to port this one line to 1.5:
getSharedResources().putClassAlias(GlobalResourceScope.class, global);

 * How do I modify the following line to use HTTP in DEVELOPMENT mode?
setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), new
 HttpsConfig(80, 443)));

 * WicketTester#setupRequestAndResponse() - what should be used instead?

 * How do I integrate WicketTester and Spring? I used the following
 code in 1.4.x:
 InjectorHolder.setInjector(new AnnotSpringInjector(new
 MockContextLocator(myAppContext)));
 InjectorHolder.getInjector().inject(this);

 Thanks,

 Alec


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket 1.5 migration questions

2012-09-04 Thread Thomas Götz
Please see my inline comments.

Cheers,
   -Tom



 On 04.09.2012, at 02:36, Alec Swan alecs...@gmail.com wrote:
 
 * How to implement HybridUrlCodingStrategy in 1.5?

Please have a look at 
http://wicketinaction.com/2011/07/wicket-1-5-mounting-pages/


 * I saw a ticket related to putClassAlias, but I couldn't figure out
 how to port this one line to 1.5:
   getSharedResources().putClassAlias(GlobalResourceScope.class, global);

Please have a look at 
http://alexandros-karypidis.blogspot.de/2011/01/migrating-from-wicket-14-to-15.html


 * How do I modify the following line to use HTTP in DEVELOPMENT mode?
   setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), new
 HttpsConfig(80, 443)));

if (Application.get().getConfigurationType() != 
RuntimeConfigurationType.DEVELOPMENT) {
setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), new 
HttpsConfig(80, 443)));
}


 * WicketTester#setupRequestAndResponse() - what should be used instead?

Nothing, simply do:
WicketTester tester = new WicketTester(new MyApplication());


 * How do I integrate WicketTester and Spring? I used the following
 code in 1.4.x:
InjectorHolder.setInjector(new AnnotSpringInjector(new
 MockContextLocator(myAppContext)));
InjectorHolder.getInjector().inject(this);

See 1.5 Migration guide, chapter Wicket-IOC changes:

InjectorHolder.getInjector().inject(Object object) is replaced with 
org.apache.wicket.injection.Injector.get().inject(Object object).
This is valid for both Wicket-Spring and Wicket-Guice.



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket 1.5 migration questions

2012-09-04 Thread Alec Swan
Thanks, Tom.

I saw the link explaining how to migrate
SharedResources#putClassAlias(GlobalResourceScope.class, global)
before but was found it confusing because global and images
aliases 1.4 version were replaced with imgres in 1.5 example.

All I need to do is use global in place of GlobalResourceScope.class
in the URLs. How do I do this in 1.5?

Thanks,

Alec

On Tue, Sep 4, 2012 at 9:07 AM, Thomas Götz t...@decoded.de wrote:
 Please see my inline comments.

 Cheers,
-Tom



 On 04.09.2012, at 02:36, Alec Swan alecs...@gmail.com wrote:

 * How to implement HybridUrlCodingStrategy in 1.5?

 Please have a look at 
 http://wicketinaction.com/2011/07/wicket-1-5-mounting-pages/


 * I saw a ticket related to putClassAlias, but I couldn't figure out
 how to port this one line to 1.5:
   getSharedResources().putClassAlias(GlobalResourceScope.class, global);

 Please have a look at 
 http://alexandros-karypidis.blogspot.de/2011/01/migrating-from-wicket-14-to-15.html


 * How do I modify the following line to use HTTP in DEVELOPMENT mode?
   setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), new
 HttpsConfig(80, 443)));

 if (Application.get().getConfigurationType() != 
 RuntimeConfigurationType.DEVELOPMENT) {
 setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), new 
 HttpsConfig(80, 443)));
 }


 * WicketTester#setupRequestAndResponse() - what should be used instead?

 Nothing, simply do:
 WicketTester tester = new WicketTester(new MyApplication());


 * How do I integrate WicketTester and Spring? I used the following
 code in 1.4.x:
InjectorHolder.setInjector(new AnnotSpringInjector(new
 MockContextLocator(myAppContext)));
InjectorHolder.getInjector().inject(this);

 See 1.5 Migration guide, chapter Wicket-IOC changes:

 InjectorHolder.getInjector().inject(Object object) is replaced with 
 org.apache.wicket.injection.Injector.get().inject(Object object).
 This is valid for both Wicket-Spring and Wicket-Guice.



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket 1.5 migration questions

2012-09-04 Thread Thomas Götz
I didn't get your usecase exactly yet, but maybe this will help you:
http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/

Cheers,
   -Tom


On 04.09.2012, at 17:33, Alec Swan alecs...@gmail.com wrote:

 I saw the link explaining how to migrate
 SharedResources#putClassAlias(GlobalResourceScope.class, global)
 before but was found it confusing because global and images
 aliases 1.4 version were replaced with imgres in 1.5 example.
 
 All I need to do is use global in place of GlobalResourceScope.class
 in the URLs. How do I do this in 1.5?


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket 1.5 migration questions

2012-09-04 Thread Alec Swan
Tom,

I have com.myco.app.res.GlobalResourceScope.class and events.js in the
same package. So, putClassAlias(GlobalResourceScope.class, global)
in 1.4 would allow me to access http://../app/global/events.js in the
browser.

It seems like in 1.5 this is similar to mountPackage(String, Class?
extends Page) which means I have to change GlobalResourceScope class
to extend Page, right? Why does it need to be a Page?

Thanks,

Alec

On Tue, Sep 4, 2012 at 9:42 AM, Thomas Götz t...@decoded.de wrote:
 I didn't get your usecase exactly yet, but maybe this will help you:
 http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/

 Cheers,
-Tom


 On 04.09.2012, at 17:33, Alec Swan alecs...@gmail.com wrote:

 I saw the link explaining how to migrate
 SharedResources#putClassAlias(GlobalResourceScope.class, global)
 before but was found it confusing because global and images
 aliases 1.4 version were replaced with imgres in 1.5 example.

 All I need to do is use global in place of GlobalResourceScope.class
 in the URLs. How do I do this in 1.5?


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket 1.5 migration questions

2012-09-04 Thread Alec Swan
Well, mountPackage did not work for me either.

Basically, what I want to do is access ALL resources in
com.myco.app.res package with global URL prefix. For example, access
a JavaScript file as global/events.js instead of
../wicket/resource/com.myco.app.res.GlobalResourceScope/events.js URL.
In 1.4 it was simple with
putClassAlias(com.myco.app.res.GlobalResourceScope, global).

How can I do this with 1.5?

Thanks,

Alec

On Tue, Sep 4, 2012 at 10:59 AM, Alec Swan alecs...@gmail.com wrote:
 Tom,

 I have com.myco.app.res.GlobalResourceScope.class and events.js in the
 same package. So, putClassAlias(GlobalResourceScope.class, global)
 in 1.4 would allow me to access http://../app/global/events.js in the
 browser.

 It seems like in 1.5 this is similar to mountPackage(String, Class?
 extends Page) which means I have to change GlobalResourceScope class
 to extend Page, right? Why does it need to be a Page?

 Thanks,

 Alec

 On Tue, Sep 4, 2012 at 9:42 AM, Thomas Götz t...@decoded.de wrote:
 I didn't get your usecase exactly yet, but maybe this will help you:
 http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/

 Cheers,
-Tom


 On 04.09.2012, at 17:33, Alec Swan alecs...@gmail.com wrote:

 I saw the link explaining how to migrate
 SharedResources#putClassAlias(GlobalResourceScope.class, global)
 before but was found it confusing because global and images
 aliases 1.4 version were replaced with imgres in 1.5 example.

 All I need to do is use global in place of GlobalResourceScope.class
 in the URLs. How do I do this in 1.5?


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



RE: Wicket 1.5 migration questions

2012-09-04 Thread Paul Bors
In an older reply on this topic, Martijn Dashorst suggested to another user
to mount the page using one of the strategies that already exist or
implement your own.

Older thread urlFor and putClassAlias:
http://apache-wicket.1842946.n4.nabble.com/urlFor-and-putClassAlias-tp186414
2p1864143.html

-Original Message-
From: Alec Swan [mailto:alecs...@gmail.com] 
Sent: Tuesday, September 04, 2012 5:18 PM
To: users@wicket.apache.org
Subject: Re: Wicket 1.5 migration questions

Well, mountPackage did not work for me either.

Basically, what I want to do is access ALL resources in com.myco.app.res
package with global URL prefix. For example, access a JavaScript file as
global/events.js instead of
../wicket/resource/com.myco.app.res.GlobalResourceScope/events.js URL.
In 1.4 it was simple with
putClassAlias(com.myco.app.res.GlobalResourceScope, global).

How can I do this with 1.5?

Thanks,

Alec

On Tue, Sep 4, 2012 at 10:59 AM, Alec Swan alecs...@gmail.com wrote:
 Tom,

 I have com.myco.app.res.GlobalResourceScope.class and events.js in the 
 same package. So, putClassAlias(GlobalResourceScope.class, global) 
 in 1.4 would allow me to access http://../app/global/events.js in the 
 browser.

 It seems like in 1.5 this is similar to mountPackage(String, Class?
 extends Page) which means I have to change GlobalResourceScope class 
 to extend Page, right? Why does it need to be a Page?

 Thanks,

 Alec

 On Tue, Sep 4, 2012 at 9:42 AM, Thomas Götz t...@decoded.de wrote:
 I didn't get your usecase exactly yet, but maybe this will help you:
 http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/

 Cheers,
-Tom


 On 04.09.2012, at 17:33, Alec Swan alecs...@gmail.com wrote:

 I saw the link explaining how to migrate 
 SharedResources#putClassAlias(GlobalResourceScope.class, global)
 before but was found it confusing because global and images
 aliases 1.4 version were replaced with imgres in 1.5 example.

 All I need to do is use global in place of 
 GlobalResourceScope.class in the URLs. How do I do this in 1.5?


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket 1.5 migration questions

2012-09-04 Thread Martin Grigorov
On Tue, Sep 4, 2012 at 11:17 PM, Alec Swan alecs...@gmail.com wrote:
 Well, mountPackage did not work for me either.

 Basically, what I want to do is access ALL resources in
 com.myco.app.res package with global URL prefix. For example, access
 a JavaScript file as global/events.js instead of
 ../wicket/resource/com.myco.app.res.GlobalResourceScope/events.js URL.
 In 1.4 it was simple with
 putClassAlias(com.myco.app.res.GlobalResourceScope, global).

 How can I do this with 1.5?

Why #mountResource() didn't work for you ?


 Thanks,

 Alec

 On Tue, Sep 4, 2012 at 10:59 AM, Alec Swan alecs...@gmail.com wrote:
 Tom,

 I have com.myco.app.res.GlobalResourceScope.class and events.js in the
 same package. So, putClassAlias(GlobalResourceScope.class, global)
 in 1.4 would allow me to access http://../app/global/events.js in the
 browser.

 It seems like in 1.5 this is similar to mountPackage(String, Class?
 extends Page) which means I have to change GlobalResourceScope class
 to extend Page, right? Why does it need to be a Page?

 Thanks,

 Alec

 On Tue, Sep 4, 2012 at 9:42 AM, Thomas Götz t...@decoded.de wrote:
 I didn't get your usecase exactly yet, but maybe this will help you:
 http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/

 Cheers,
-Tom


 On 04.09.2012, at 17:33, Alec Swan alecs...@gmail.com wrote:

 I saw the link explaining how to migrate
 SharedResources#putClassAlias(GlobalResourceScope.class, global)
 before but was found it confusing because global and images
 aliases 1.4 version were replaced with imgres in 1.5 example.

 All I need to do is use global in place of GlobalResourceScope.class
 in the URLs. How do I do this in 1.5?


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org