Re: Re: Basic JUnit Test

2012-08-16 Thread JCoder
Hi Vineet,

"wickettester#ajaxEvent(button,"onclick") " is what I already tried. And it 
worked better but not finally finsihed.
The cause of the next problem is that I need to provide some request parameter 
for this request since my application reads request and throws an exception if 
it can't find special parameters.
Then I changed my code to provide some ajax request parameter because the 
button click is an instance of AjaxButton:

"
Component comp = tester

.getComponentFromLastRenderedPage("myForm:myAjaxButton");
AjaxEventBehavior behavior = new 
AjaxFormSubmitBehavior("onclick") {

@Override
protected void onSubmit(AjaxRequestTarget target) {
System.out.println("hh");
}

@Override
protected void onError(AjaxRequestTarget target) {
// TODO Auto-generated method stub

}
};

comp.add(behavior);
tester.executeAjaxEvent(comp, "onclick");
"

Is this the correct to provide ajax request parameter?
If so, I guess I need to chance something in "onSubmit(AjaxRequestTarget)", 
true ?

Regards,
Y

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



Re: Regarding "WARN - (WebPageRenderer.java:162)" v1.5.7

2012-08-16 Thread Martin Grigorov
Hi,

If you are able to reproduce this in a quickstart app then please
attach it to a ticket in Jira.

On Wed, Aug 15, 2012 at 2:06 PM, yesotaso  wrote:
> Sorry for non-informative title. The whole warning is:
> WARN  - (WebPageRenderer.java:162) - The Buffered response should be handled
> by BufferedResponseRequestHandler
> I know in various places it is said to be harmless and I dont know if other
> people seeing this warning for the same reason as me...
> Mine's cuase is as it seems "If I access a page via either a link or typing
> adress to a mounted page this warning pops up. In addition I use
> *org.apache.wicket.request.mapper.CryptoMapper* in my authorization strategy
> class. Somehow root request mapper pass response twice and at second time
> since the stored response is still in the buffer it complains."
>
> Question is : Is there any solution to avoid this warning?
>
> PS: if I remove authorization strategy this warning does not show up.
>
>
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Regarding-WARN-WebPageRenderer-java-162-v1-5-7-tp4651245.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> 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: [6.0] resource management

2012-08-16 Thread Martin Grigorov
Hi,

You can set your JQueryResRef with
application.getJavaScriptLibrarySettings().setJQueryResourceReference(MyJQueryResRef);

Wicket 6 uses and is tested for JQuery 1.7.2. It also works fine with
1.8.0 (i.e. all available tests pass). It wont work with JQuery 1.6
and older.

On Thu, Aug 16, 2012 at 4:24 PM, Pierre Goupil  wrote:
> Good afternoon,
>
> I'm currently playing with Wicket 6.0 resource management, as found here:
> http://wicketinaction.com/2012/07/wicket-6-resource-management/
>
> Martin's website introduces us to the concept of resource dependencies. It
> works great for my own provided JS, but there is still one problem:
> wicket-core 6.0.0-beta3 contributes its own JSs and I'd like Wicket not to
> contribute jquery.js, because I'll provide it myself.
>
> Is there any way of doing this? I have some JQuery-related JS that I
> contribute myself to the (beginning of the) , so Wicket's
> contribution of jquery.js (at the end of the ) is undesirable because
> the JS file is then duplicated, which breaks my dependency graph.
>
> As an additional request, is there any way to tell Wicket to contribute its
> JS files, but at the very beginning of the  tag?
>
> Lastly, which JQuery version should I use if I must contribute the
> jquery.js myself? Is 1.6.0 up to 1.8.0 all OK?
>
> Thanks in advance & best regards,
>
> Pierre
>
>
>
> --
> Le bonheur n'est pas une destination, mais une façon de voyager.
>
> Papa d'une petite Lou-Ann depuis le 30 juin.



-- 
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: Request mapping question

2012-08-16 Thread Rama Kesara
Thanks Martin, I will take a look and let you know.

Martin Grigorov  wrote:


Hi,

Take a look at 
https://github.com/apache/wicket/tree/master/wicket-examples/src/main/java/org/apache/wicket/examples/requestmapper
and more specifically the usage of LocaleFirstMapper.

On Thu, Aug 16, 2012 at 10:19 PM, Rama Kesara  wrote:
> We have been used Wicket for developing our web applications so far and 
> currently we are trying to tackle one issue where an optional language 
> parameters comes in the url for all applications. We are trying to see how 
> can we customize our applications to have a common page mapper or common 
> processor which interprets the request first to identify if there is any 
> language parameter that is being passed and if not just resolve the page 
> usually however wicket does it.
>
> Let me detail it further with an example. For example, if we have two web 
> application say FirstApp and SecondApp that are running in our environment 
> associated to their own contexts.
>
> Now for FirstApp, lets say we have following mountPage option in that 
> particular webapplication:
> mountPage("/firstpage/${someinput}", FirstPage.class);
>
> And for SecondApp, lets say we have following mountPage option in that 
> particular webapplication:
> mountPage("/secondpage/${someinput}", SecondPage.class);
>
> Now say,
> http://www.abcd.com/firstpage/xyz -> goes to First application and it 
> resolves to that FirstPage and does whatever it is supposed to do
> http://www.abcd.com/secondpage/xyz -> goes to Second application and it 
> resolves to that SecondPage and does whatever it is supposed to do
>
> Now if we have a optional language parameter in the request path, how can we 
> handle request mapping for that case without altering those applications 
> mount options.
>
> http://www.abcd.com/fr/firstpage/xyz
> http://www.abcd.com/es/firstpage/xyz
>
> Now, I know that we can change mount options as follows and tackle that each 
> application will expect an optional language param.
>
> mountPage("/#{language}/firstpage/${someinput}", FirstPage.class);
> mountPage("/#{language}/secondpage/${someinput}", SecondPage.class);
>
> But is it possible to handle it before even the request comes to 
> WicketFilter? If yes, can anyone share any thoughts or views on that. I am 
> not looking to edit all webapplications and all page paths to edit and add 
> that optional language param, instead if I can handle the request url before 
> even wicketFilter tries to resolve that page.. it would help. Also, I am 
> stressing if that can be a common level because we might have multiple 
> applications coming up and we want to tackle that issue in a common place..
>
> Any pointers will be of great help.. Appreciate you help in advance.
>
> Thanks
> Rama



--
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: Request mapping question

2012-08-16 Thread Martin Grigorov
Hi,

Take a look at 
https://github.com/apache/wicket/tree/master/wicket-examples/src/main/java/org/apache/wicket/examples/requestmapper
and more specifically the usage of LocaleFirstMapper.

On Thu, Aug 16, 2012 at 10:19 PM, Rama Kesara  wrote:
> We have been used Wicket for developing our web applications so far and 
> currently we are trying to tackle one issue where an optional language 
> parameters comes in the url for all applications. We are trying to see how 
> can we customize our applications to have a common page mapper or common 
> processor which interprets the request first to identify if there is any 
> language parameter that is being passed and if not just resolve the page 
> usually however wicket does it.
>
> Let me detail it further with an example. For example, if we have two web 
> application say FirstApp and SecondApp that are running in our environment 
> associated to their own contexts.
>
> Now for FirstApp, lets say we have following mountPage option in that 
> particular webapplication:
> mountPage("/firstpage/${someinput}", FirstPage.class);
>
> And for SecondApp, lets say we have following mountPage option in that 
> particular webapplication:
> mountPage("/secondpage/${someinput}", SecondPage.class);
>
> Now say,
> http://www.abcd.com/firstpage/xyz -> goes to First application and it 
> resolves to that FirstPage and does whatever it is supposed to do
> http://www.abcd.com/secondpage/xyz -> goes to Second application and it 
> resolves to that SecondPage and does whatever it is supposed to do
>
> Now if we have a optional language parameter in the request path, how can we 
> handle request mapping for that case without altering those applications 
> mount options.
>
> http://www.abcd.com/fr/firstpage/xyz
> http://www.abcd.com/es/firstpage/xyz
>
> Now, I know that we can change mount options as follows and tackle that each 
> application will expect an optional language param.
>
> mountPage("/#{language}/firstpage/${someinput}", FirstPage.class);
> mountPage("/#{language}/secondpage/${someinput}", SecondPage.class);
>
> But is it possible to handle it before even the request comes to 
> WicketFilter? If yes, can anyone share any thoughts or views on that. I am 
> not looking to edit all webapplications and all page paths to edit and add 
> that optional language param, instead if I can handle the request url before 
> even wicketFilter tries to resolve that page.. it would help. Also, I am 
> stressing if that can be a common level because we might have multiple 
> applications coming up and we want to tackle that issue in a common place..
>
> Any pointers will be of great help.. Appreciate you help in advance.
>
> Thanks
> Rama



-- 
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: How to control IMG/CSS URL-Rewriting in mounted pages?

2012-08-16 Thread Martin Grigorov
The markup filter that is responsible for this is:
org.apache.wicket.markup.parser.filter.RelativePathPrefixHandler
You can setup a custom MarkupParser that doesn't use this markup
filter to solve your issue.

On Fri, Aug 17, 2012 at 3:06 AM, Joachim Schrod  wrote:
> Thanks for these pointers! I'll check the classes out and see how I
> can influence their behavior.
>
> Cheers,
> Joachim
>
>
> Bertrand Guay-Paquet wrote:
>> Hi Joachim,
>>
>> I have never inspected them closely, but I think the classes in
>> play are :
>> WicketLinkTagHandler
>> AutoLinkResolver
>>
>> As for the usefulness of this process, consider panels. Panels can
>> be instantiated on any mount path so their links must be adjusted.
>>
>> Good luck!
>> Bertrand
>>
>> On 15/08/2012 5:37 PM, Joachim Schrod wrote:
>>> Well, one answer yet, with an assertion that Wicket does what I
>>> don't want it to do. :-(
>>>
>>> So, is it really not possible to exchange bidirectionally HTML
>>> files with an HTML designer who does *not* put all his HTML files
>>> in web root? I thought being able to share files bidirectionally
>>> with HTML designers was one of the major selling points of Wicket?!
>>>
>>> I assume nobody has the energy to really look at my issue. Would it
>>> help if I put up a minimal example project for download that shows
>>> my problem? Anybody willing to look then at it?
>>>
>>> I don't need a full solution. An hint like "class X does the URL
>>> rewriting for images" would be most welcome, overwriting that
>>> behavior with appropriate subclassing is something I can well do on
>>> my own.
>>>
>>> Best,
>>> Joachim
>>>
>>>
>>> Joachim Schrod wrote:
 Hi,

 I'm new to Wicket and write my first application in it. I use
 "Wicket in Action" and online resources as documentation. (I
 stumbled already about the 1st few roadblocks owing to changes from
 Wicket 1.4 to 1.5. ;-)) So, if there's an easy pointer to answer my
 question, don't hesitate to just send it.

 My problem: I have a page that's mounted as URL "cat/entry". In the
 page's HTML there are links to images and CSS files that start with
 "..", e.g., "../images/bg_blabla.img". These are no Wicket
 components, just plain HTML.

 When Wicket renders the page, it rewrites the image URLs and
 prepends "../", e.g., the image URL now is output as
 "../../images/bg_blabla.img". I suppose it tries to adept to the
 extra path level that I introduced during mount and compensates
 for it.

 How can I stop Wicket from adding this "../" prefix? I searched via
 Google and read through Javadocs, but to no avail.

 For background: The URL in the HTML file is right... My HTML
 designers deliver their design files as "cat/entry.html", my mounts
 just follow their lead. I would like to change their files as
 little as possible, it makes files swapping back to/with them much
 easier.

 I hope somebody here may help me, thanks in advance.

 Joachim

>
> --
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> Joachim Schrod, Roedermark, Germany
> Email: jsch...@acm.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: JGrowlBehavior

2012-08-16 Thread Martin Grigorov
Hi,

At 
https://github.com/wicketstuff/core/tree/master/jdk-1.6-parent/jquery-parent/jquery/src/main/java/org/wicketstuff/jquery/jgrowl
you may find JGrowl based implementation of FeedbackPanel.

On Fri, Aug 17, 2012 at 12:18 AM, Tom Norton
 wrote:
> We use JGrowl on our website, and now that we've moved to wicket, I've been
> trying to create a JGrowlBehavior.  The only time we want this behavior to
> run is AFTER the ajax events of other behaviors and components.  Because of
> this, I cannot use AbstractAjaxBehavior or AbstractDefaultAjaxBehavior,
> since they require round trips.  Does anyone have any ideas?  We use wicket
> 1.5.4.
>
> Thanks,
> Tom



-- 
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: WicketTester best practices

2012-08-16 Thread James Eliyezar
Thanks Tom for the suggestions. I didn't know these things.

On Fri, Aug 17, 2012 at 12:14 PM, Tom Norton <
tomwnorton.mailing.li...@gmail.com> wrote:

> My unit tests construct the WicketTester in the setUp method.  I also
> extend WicketTester so that I can mock our database-driven content system
> and Spring Application Context (wicket provides a mock for this:
> http://wicket.apache.org/**apidocs/1.5/org/apache/wicket/**spring/test/**
> ApplicationContextMock.html).
> This page talks about extending WicketTester:  https://cwiki.apache.org/**
> WICKET/testing-pages.html
>
> Tom
>
>
> On Thu 16 Aug 2012 09:14:22 PM EDT, James Eliyezar wrote:
>
>> Any suggestions regarding this? Thank you.
>>
>> On Thu, Aug 16, 2012 at 10:04 AM, James Eliyezar > >wrote:
>>
>>  Friends,
>>>
>>> Just curious to find out what best practices do you all follow when using
>>> WicketTester.
>>>
>>> FYI, to improve the performance of unit tests, we decided to use a shared
>>> instance of WicketTester across our unit tests.
>>> The tests worked fine in Wicket 1.4.x but fail after upgrading to 1.5.x
>>> when run using Maven.
>>> However, Wicket 1.5 based tests pass when the tests are run using maven
>>> fork mode "always".
>>>
>>> Is it advisable to use a shared instance of WicketTester across multiple
>>> unit test classes?
>>> Or should WicketTester should be instantiated and destroyed in the
>>> "setUp"
>>> and "tearDown" methods in every unit test class?
>>>
>>> --
>>> Thanks & regards
>>> James Selvakumar
>>> mcruncher.com
>>>
>>>
>>>
>>
>>
>
>
> --**--**-
> To unsubscribe, e-mail: 
> users-unsubscribe@wicket.**apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Thanks & regards
James Selvakumar
mcruncher.com


Re: WicketTester best practices

2012-08-16 Thread Tom Norton
My unit tests construct the WicketTester in the setUp method.  I also 
extend WicketTester so that I can mock our database-driven content 
system and Spring Application Context (wicket provides a mock for this: 
http://wicket.apache.org/apidocs/1.5/org/apache/wicket/spring/test/ApplicationContextMock.html). 
This page talks about extending WicketTester:  
https://cwiki.apache.org/WICKET/testing-pages.html


Tom

On Thu 16 Aug 2012 09:14:22 PM EDT, James Eliyezar wrote:

Any suggestions regarding this? Thank you.

On Thu, Aug 16, 2012 at 10:04 AM, James Eliyezar wrote:


Friends,

Just curious to find out what best practices do you all follow when using
WicketTester.

FYI, to improve the performance of unit tests, we decided to use a shared
instance of WicketTester across our unit tests.
The tests worked fine in Wicket 1.4.x but fail after upgrading to 1.5.x
when run using Maven.
However, Wicket 1.5 based tests pass when the tests are run using maven
fork mode "always".

Is it advisable to use a shared instance of WicketTester across multiple
unit test classes?
Or should WicketTester should be instantiated and destroyed in the "setUp"
and "tearDown" methods in every unit test class?

--
Thanks & regards
James Selvakumar
mcruncher.com









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



Re: JGrowlBehavior

2012-08-16 Thread Thomas Götz
You could use Wicket's default ajax event (using the inter-component event API):
https://cwiki.apache.org/WICKET/migration-to-wicket-15.html#MigrationtoWicket1.5-Defaultajaxevent

If you don't want to react upon *each* ajax event you need to explicitly 
trigger an event, put some playload (e.g. a marker class "MyEvent"), check for 
that payload in onEvent and trigger your update respectively.

   -Tom



On 16.08.2012, at 23:18, Tom Norton  wrote:

> We use JGrowl on our website, and now that we've moved to wicket, I've been
> trying to create a JGrowlBehavior.  The only time we want this behavior to
> run is AFTER the ajax events of other behaviors and components.  Because of
> this, I cannot use AbstractAjaxBehavior or AbstractDefaultAjaxBehavior,
> since they require round trips.  Does anyone have any ideas?  We use wicket
> 1.5.4.
> 
> Thanks,
> Tom


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



Re: WicketTester best practices

2012-08-16 Thread James Eliyezar
Any suggestions regarding this? Thank you.

On Thu, Aug 16, 2012 at 10:04 AM, James Eliyezar wrote:

> Friends,
>
> Just curious to find out what best practices do you all follow when using
> WicketTester.
>
> FYI, to improve the performance of unit tests, we decided to use a shared
> instance of WicketTester across our unit tests.
> The tests worked fine in Wicket 1.4.x but fail after upgrading to 1.5.x
> when run using Maven.
> However, Wicket 1.5 based tests pass when the tests are run using maven
> fork mode "always".
>
> Is it advisable to use a shared instance of WicketTester across multiple
> unit test classes?
> Or should WicketTester should be instantiated and destroyed in the "setUp"
> and "tearDown" methods in every unit test class?
>
> --
> Thanks & regards
> James Selvakumar
> mcruncher.com
>
>


-- 
Thanks & regards
James Selvakumar
mcruncher.com


Re: How to control IMG/CSS URL-Rewriting in mounted pages?

2012-08-16 Thread Joachim Schrod
Thanks for these pointers! I'll check the classes out and see how I
can influence their behavior.

Cheers,
Joachim


Bertrand Guay-Paquet wrote:
> Hi Joachim,
> 
> I have never inspected them closely, but I think the classes in
> play are :
> WicketLinkTagHandler
> AutoLinkResolver
> 
> As for the usefulness of this process, consider panels. Panels can
> be instantiated on any mount path so their links must be adjusted.
> 
> Good luck!
> Bertrand
> 
> On 15/08/2012 5:37 PM, Joachim Schrod wrote:
>> Well, one answer yet, with an assertion that Wicket does what I
>> don't want it to do. :-(
>>
>> So, is it really not possible to exchange bidirectionally HTML
>> files with an HTML designer who does *not* put all his HTML files
>> in web root? I thought being able to share files bidirectionally
>> with HTML designers was one of the major selling points of Wicket?!
>>
>> I assume nobody has the energy to really look at my issue. Would it
>> help if I put up a minimal example project for download that shows
>> my problem? Anybody willing to look then at it?
>>
>> I don't need a full solution. An hint like "class X does the URL
>> rewriting for images" would be most welcome, overwriting that
>> behavior with appropriate subclassing is something I can well do on
>> my own.
>>
>> Best,
>> Joachim
>>
>>
>> Joachim Schrod wrote:
>>> Hi,
>>>
>>> I'm new to Wicket and write my first application in it. I use
>>> "Wicket in Action" and online resources as documentation. (I
>>> stumbled already about the 1st few roadblocks owing to changes from
>>> Wicket 1.4 to 1.5. ;-)) So, if there's an easy pointer to answer my
>>> question, don't hesitate to just send it.
>>>
>>> My problem: I have a page that's mounted as URL "cat/entry". In the
>>> page's HTML there are links to images and CSS files that start with
>>> "..", e.g., "../images/bg_blabla.img". These are no Wicket
>>> components, just plain HTML.
>>>
>>> When Wicket renders the page, it rewrites the image URLs and
>>> prepends "../", e.g., the image URL now is output as
>>> "../../images/bg_blabla.img". I suppose it tries to adept to the
>>> extra path level that I introduced during mount and compensates
>>> for it.
>>>
>>> How can I stop Wicket from adding this "../" prefix? I searched via
>>> Google and read through Javadocs, but to no avail.
>>>
>>> For background: The URL in the HTML file is right... My HTML
>>> designers deliver their design files as "cat/entry.html", my mounts
>>> just follow their lead. I would like to change their files as
>>> little as possible, it makes files swapping back to/with them much
>>> easier.
>>>
>>> I hope somebody here may help me, thanks in advance.
>>>
>>> Joachim
>>>

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Joachim Schrod, Roedermark, Germany
Email: jsch...@acm.org


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



Request mapping question

2012-08-16 Thread Rama Kesara
We have been used Wicket for developing our web applications so far and 
currently we are trying to tackle one issue where an optional language 
parameters comes in the url for all applications. We are trying to see how can 
we customize our applications to have a common page mapper or common processor 
which interprets the request first to identify if there is any language 
parameter that is being passed and if not just resolve the page usually however 
wicket does it.

Let me detail it further with an example. For example, if we have two web 
application say FirstApp and SecondApp that are running in our environment 
associated to their own contexts.

Now for FirstApp, lets say we have following mountPage option in that 
particular webapplication:
mountPage("/firstpage/${someinput}", FirstPage.class);

And for SecondApp, lets say we have following mountPage option in that 
particular webapplication:
mountPage("/secondpage/${someinput}", SecondPage.class);

Now say,
http://www.abcd.com/firstpage/xyz -> goes to First application and it resolves 
to that FirstPage and does whatever it is supposed to do
http://www.abcd.com/secondpage/xyz -> goes to Second application and it 
resolves to that SecondPage and does whatever it is supposed to do

Now if we have a optional language parameter in the request path, how can we 
handle request mapping for that case without altering those applications mount 
options.

http://www.abcd.com/fr/firstpage/xyz
http://www.abcd.com/es/firstpage/xyz

Now, I know that we can change mount options as follows and tackle that each 
application will expect an optional language param.

mountPage("/#{language}/firstpage/${someinput}", FirstPage.class);
mountPage("/#{language}/secondpage/${someinput}", SecondPage.class);

But is it possible to handle it before even the request comes to WicketFilter? 
If yes, can anyone share any thoughts or views on that. I am not looking to 
edit all webapplications and all page paths to edit and add that optional 
language param, instead if I can handle the request url before even 
wicketFilter tries to resolve that page.. it would help. Also, I am stressing 
if that can be a common level because we might have multiple applications 
coming up and we want to tackle that issue in a common place..

Any pointers will be of great help.. Appreciate you help in advance.

Thanks
Rama


Panel Inheritance with TransparentWebMarkupContainer

2012-08-16 Thread brad steiner
Can you please elaborate on the use of TransparentWebMarkupContainer in 1.5 for 
use with Panel inheritance? I have a page with tabbed panels, each of which has 
its own left nav. Each panel subclass thus inherits from the base class / 
markup where the corresponding left nav is defined. When I attempt this using 
panels I receive an error indicating the  tag is not present, 
presumably because it's not expected within the  tag(?). I've 
switched my base class to inherit from TransparentWebMarkupContainer instead of 
Panel but now "[Panel]" is displayed on the page with no indication my content 
panel markup is being read. Obviously I would prefer not to duplicate the left 
nav code across all components in a given panel. Below is my markup using the 
TransparentWMC approach. 

Thanks in advance for your help.
Brad


http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd";>

.
.
.









http://www.w3.org/1999/xhtml";>
Welcome to the Main Content Panel!
.
.
.



final AbstractTab inboundShipmentTab = new AbstractTab(new Model<>("Inbound 
Shipments")) {
@Override
public TransparentWebMarkupContainer getPanel(final String panelId) {
return new SubclassPanel(panelId);
}
};


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



Re: Dataview: need a differente css for negative values

2012-08-16 Thread Sven Meier
Overwrite #newRowItem() and tweak the CSS class with a behavior.

Sven

Delange  schrieb:

>Hi, in my DataView I have a column with amounts.
>I want to give the positive ones a green color, and the negative ones a red
>color;
>
>How to accomplish that?
>
>
>
>--
>View this message in context: 
>http://apache-wicket.1842946.n4.nabble.com/Dataview-need-a-differente-css-for-negative-values-tp4651270.html
>Sent from the Users forum mailing list archive at Nabble.com.
>
>-
>To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>For additional commands, e-mail: users-h...@wicket.apache.org
>


Re: form inputs to Labels

2012-08-16 Thread Sven Meier
I've used XsltTransformerBehavior on the containing Panel for such things.
Behaviors (possibly added by a IComponentInstantiationListener) could 
'transform' the tag too.

Sven

Steve Lowery  schrieb:

>We have forms throughout our application that can be toggled from read-only
>to editable.  The wicket framework will disable the form components which
>is great, but we'd rather have it display just the texts in a label.  We
>can subclass TextField, TextArea, DropDownChoice, etc and override the
>onComponentTag() and onComponentTagBody() methods where applicable, but was
>wondering if anyone had a more elegant solution or wicket had something out
>of the box that would turn FormComponents into Labels.
>
>Here's example for a TextField we could do by subclassing TextField and
>overriding onComponentTag:
>
>@Override
>protected void onComponentTag(ComponentTag tag) {
>if (!isEnabledInHierarchy()) {
>tag.setName("span");
>tag.remove("type");
>tag.remove("disabled");
>tag.remove("name");
>tag.remove("value");
>tag.setType(XmlTag.TagType.OPEN);
>}
>}


Re: Need some help creating dynamic resources from database-inputstream please!

2012-08-16 Thread Michael M
Ok I think I got it now! Simply using a ResourceStreamResource instead of a
ByteArrayResource, duh... I think the reason why I just couldn't see clear
before is all the different obsolete examples and tutorials for older
versions. The problem is, when you are new to Wicket, you are still
figuring out how stuff works, and when trying to implement certain things
you hit road-blocks because those code-examples don't work anymore, and you
don't know why.

Here is my solution: http://pastebin.com/yQFh5gk8

This is how I'm doing it for now, returning the stream on-the-fly from the
database when the ResourceLink is clicked.

However, I get huge stacks of exceptions now: *java.lang.IllegalStateException:
Header was already written to the resonse!*
*
*
Here is an example, I get lots of those: http://pastebin.com/5LuDqp5a

Thanks! I'm almost there I think :)

2012/8/16 Michael M 

> I think I just made a huge step forward by overriding getData() of
> ByteArrayResource. I've read that in the documentation before, but at that
> time was too deep into the concept of resources that I didn't get it (I'm
> completely new to Wicket).
>
> So, right now it works that I read my attachment, convert it into a
> byte-array and deliver it, only when the link is clicked. I still get a URL
> I can use for other functions (pass a .mp4-ByteArrayResource to a JW Player
> instance e.g.) No creating of static resources at page-load anymore.
>
> Next step would be to skip the byte-array completely. How could I do my
> own Resource that delivers the data as a stream, but has the same
> functionality otherwise (usable in some kind of Link so that I can get the
> URL)? Something like
>
> Resource attachmentResource = new WebResource() {
>> @Override
>> public IResourceStream getResourceStream() {
>> // return my stream somehow
>>  }
>> }
>
>
> doesn't work anymore if I'm not mistaken.
>
> Appreciate your help so far!
>
> 2012/8/16 Michael M 
>
>> Hi, thanks for for quick answer! I already played around with
>> ResourceStreams, but my problem was that I couldn't do the bridge from a
>> Stream to a Resource with a URL.
>>
>> I should add, I'm not offering my ByteArrayResources as a download. I
>> pass the content-type and filename, and (with the help I got from a user
>> here) return it as INLINE. So, when the user clicks, the browser opens the
>> filetype if it can (e.g. a picture, or a PDF with a built-in viewer).
>>
>> Also (and that's important) I then have a real URL which I can pass to
>> Javascript functions. E.g. if the attachment is an mp3 or a video, I
>> additionally use the URL of the ResourceLink to open a custom flash-player
>> (JW Player).. I need a solid URL for that, for that session.
>>
>> When I played around I just couldn't manage to get that kind of URL when
>> I worked with Streams. But I will give it another try.
>>
>> PS: I found this example a while ago, and wanted to implement my own
>> IResourceStream to fetch the attachments from the DB, but the example is
>> outdated and I couldn't figure out how to do it with a newer version of
>> Wicket: http://goo.gl/imGrl
>>
>>
>> 2012/8/16 Sven Meier 
>>
>>> Take a look at DownloadLink and FileResourceStream, and replace all File
>>> related API to your CouchDB access.
>>>
>>> Sven
>>>
>>> Michael M  schrieb:
>>>
>>> >Hi, in my project I use a CouchDB with files as attachments. Currently I
>>> >have a page that makes those attachments available via a ResourceLink.
>>> What
>>> >I do when creating that page is:
>>> >
>>> >   - I read all attachments (I get them as an InputStream),
>>> >   - create a byte[] out of it,
>>> >   - create a static Wicket ByteArrayResource
>>> >   - and put the link to that resource on the page.
>>> >
>>> >That works for smaller files, but a huge problem is of course: it's
>>> static,
>>> >and I get memory problems if the attachments get too big. Also,
>>> currently
>>> >obviously each session does this.
>>> >
>>> >What I would like to do instead is:
>>> >
>>> >   - create Resources that will load my attachments dynamically if the
>>> link
>>> >   is clicked,
>>> >   - and add ResourceLinks to those resources on my page instead.
>>> >   - If possible, maybe deliver the attachments directly from the
>>> >   InputStream my CouchDB delivers, so I don't have to have any static
>>> >   byte-arrays on my server.
>>> >
>>> >That way I could make the page load immediately and deliver attachments
>>> >only if required.
>>> >
>>> >I've wrapped my head around IResourceStreams, but I just can't see clear
>>> >anymore and am confused about how to create those dynamic resources
>>> (also
>>> >because some old examples don't work anymore with Wicket 1.5 or 6beta3).
>>> >
>>> >I'd be very thankful for a short example, or a hint about how to design
>>> >this. Thank you!
>>>
>>
>>
>


Re: Read POST based request from external site

2012-08-16 Thread Andrea Del Bene
I think there's a bug with class WebApplication which doesn't create a 
MultipartServletWebRequestImpl when the original request is multipart. 
In the meantime a possible workaround is to override method 
newWebRequest of your application class and put the following code 
inside it:


{
ServletWebRequest newWebRequest = new 
ServletWebRequest(servletRequest, filterPath);

String contentType = servletRequest.getContentType();

if (!Strings.isEmpty(contentType) &&
contentType.toLowerCase().contains("multipart/form-data"))
{
try
{
return newWebRequest.newMultipartWebRequest(
getApplicationSettings().getDefaultMaximumUploadSize(), "externalForm");
}
catch (FileUploadException e)
{
throw new RuntimeException(e);
}
}

return newWebRequest;
}

this should solve your problem with post parameters.

Thanks for your replies:

This is my plain html code:

  
 
 
 
 
 
 

This is my Wicket class:

public class UploadPage extends WebPage {

 final Logger LOG = LoggerFactory.getLogger(getClass());

 public UploadPage() {

for(String str :

getRequest().getRequestParameters().getParameterNames()){
LOG.debug("==> " + str);
}

 }
}


I cannot read a single param.

Pls. keep in mind:
The form is NO wicket form as I try to simulate an external access to my
page.

Thanks for your help




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Read-POST-based-request-from-external-site-tp4651269p4651279.html
Sent from the Users forum mailing list archive at Nabble.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: How to control IMG/CSS URL-Rewriting in mounted pages?

2012-08-16 Thread Bertrand Guay-Paquet

Hi Joachim,

I have never inspected them closely, but I think the classes in play are :
WicketLinkTagHandler
AutoLinkResolver

As for the usefulness of this process, consider panels. Panels can be 
instantiated on any mount path so their links must be adjusted.


Good luck!
Bertrand

On 15/08/2012 5:37 PM, Joachim Schrod wrote:

Well, one answer yet, with an assertion that Wicket does what I
don't want it to do. :-(

So, is it really not possible to exchange bidirectionally HTML
files with an HTML designer who does *not* put all his HTML files
in web root? I thought being able to share files bidirectionally
with HTML designers was one of the major selling points of Wicket?!

I assume nobody has the energy to really look at my issue. Would it
help if I put up a minimal example project for download that shows
my problem? Anybody willing to look then at it?

I don't need a full solution. An hint like "class X does the URL
rewriting for images" would be most welcome, overwriting that
behavior with appropriate subclassing is something I can well do on
my own.

Best,
Joachim


Joachim Schrod wrote:

Hi,

I'm new to Wicket and write my first application in it. I use
"Wicket in Action" and online resources as documentation. (I
stumbled already about the 1st few roadblocks owing to changes from
Wicket 1.4 to 1.5. ;-)) So, if there's an easy pointer to answer my
question, don't hesitate to just send it.

My problem: I have a page that's mounted as URL "cat/entry". In the
page's HTML there are links to images and CSS files that start with
"..", e.g., "../images/bg_blabla.img". These are no Wicket
components, just plain HTML.

When Wicket renders the page, it rewrites the image URLs and
prepends "../", e.g., the image URL now is output as
"../../images/bg_blabla.img". I suppose it tries to adept to the
extra path level that I introduced during mount and compensates for it.

How can I stop Wicket from adding this "../" prefix? I searched via
Google and read through Javadocs, but to no avail.

For background: The URL in the HTML file is right... My HTML
designers deliver their design files as "cat/entry.html", my mounts
just follow their lead. I would like to change their files as
little as possible, it makes files swapping back to/with them much
easier.

I hope somebody here may help me, thanks in advance.

Joachim




Joachim




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



Re: Basic JUnit Test

2012-08-16 Thread vineet semwal
sorry typo  i meant wickettester#executeAjaxEvent(button,"onclick")

On Thu, Aug 16, 2012 at 8:11 PM, vineet semwal  wrote:
>  that is expected behavior try
> wickettester#ajaxEvent(button,"onclick") or it's path equivalent
>
>
> On Thu, Aug 16, 2012 at 7:00 PM, JCoder  wrote:
>> Furthermore, I found out that my test code calls "public void onSubmit();" 
>> instead of calling the overridden "protected void onSubmit(AjaxRequestTarget 
>> target, Form form);"
>> These overriden methods reside in my anonymous inner subclass of AjaxButton.
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>
>
>
> --
> regards,
>
> Vineet Semwal



-- 
regards,

Vineet Semwal

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



Re: Basic JUnit Test

2012-08-16 Thread vineet semwal
 that is expected behavior try
wickettester#ajaxEvent(button,"onclick") or it's path equivalent


On Thu, Aug 16, 2012 at 7:00 PM, JCoder  wrote:
> Furthermore, I found out that my test code calls "public void onSubmit();" 
> instead of calling the overridden "protected void onSubmit(AjaxRequestTarget 
> target, Form form);"
> These overriden methods reside in my anonymous inner subclass of AjaxButton.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>



-- 
regards,

Vineet Semwal

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



Re: AjaxFormSubmitBehavior causing page refresh in IE

2012-08-16 Thread kshitiz
Solved...actually IE cannot read onSubmit action. So, I used onkeydown as
stated in
http://apache-wicket.1842946.n4.nabble.com/TextField-submit-via-Ajax-td3002094.html

That will solve the problem..:)



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxFormSubmitBehavior-causing-page-refresh-in-IE-tp4651267p4651290.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Wicket / Liferay help

2012-08-16 Thread Doug Leeper
Yes I had success.

I obtained the jar wicket-portlet-1.5.7.2.jar and added it to my local repo.

$MVN_CMD install:install-file \
-DgroupId=org.apache.wicket.portlet \
-DgeneratePom=true \
-DartifactId=wicket-portlet \
-Dversion=1.5.7.2 \
-Dpackaging=jar \
-Dfile=wicket-portlet-1.5.7.2.jar


Make sure your pom has the following entries:

1.5.7
7.5.0.v20110901



javax.portlet
portlet-api
2.0
provided



org.apache.wicket
wicket-core
${wicket.version}


org.apache.wicket
wicket-extensions
${wicket.version}



org.apache.portals.bridges
portals-bridges-common
2.0


org.apache.wicket.portlet
wicket-portlet
1.5.7.2



I followed the naming convention of naming convention outlined on the Wicket
Wiki.

With Liferay 6.1.1, I also had to include

WEB-INF/liferay-plugin-package.properties

and add liferay-web-xml-enabled=false

If need be I can send my quick start / test app so you can see.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-Liferay-help-tp4651140p4651289.html
Sent from the Users forum mailing list archive at Nabble.com.

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



form inputs to Labels

2012-08-16 Thread Steve Lowery
We have forms throughout our application that can be toggled from read-only
to editable.  The wicket framework will disable the form components which
is great, but we'd rather have it display just the texts in a label.  We
can subclass TextField, TextArea, DropDownChoice, etc and override the
onComponentTag() and onComponentTagBody() methods where applicable, but was
wondering if anyone had a more elegant solution or wicket had something out
of the box that would turn FormComponents into Labels.

Here's example for a TextField we could do by subclassing TextField and
overriding onComponentTag:

@Override
protected void onComponentTag(ComponentTag tag) {
if (!isEnabledInHierarchy()) {
tag.setName("span");
tag.remove("type");
tag.remove("disabled");
tag.remove("name");
tag.remove("value");
tag.setType(XmlTag.TagType.OPEN);
}
}


Re: Dataview: need a differente css for negative values

2012-08-16 Thread Bertrand Guay-Paquet

Assuming you use a Label for your amounts:

new Label( ... ) {
@Override
protected void onComponentTag(ComponentTag tag) {
super.onComponentTag(tag);
if( isNumberPositive() )
tag.append("class", "positive_num_css", " ");
else
tag.append("class", "negative_num_css", " ");
}
}

Bertrand

On 16/08/2012 6:20 AM, Delange wrote:

Hi, in my DataView I have a column with amounts.
I want to give the positive ones a green color, and the negative ones a red
color;

How to accomplish that?



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Dataview-need-a-differente-css-for-negative-values-tp4651270.html
Sent from the Users forum mailing list archive at Nabble.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: Basic JUnit Test

2012-08-16 Thread JCoder
Furthermore, I found out that my test code calls "public void onSubmit();" 
instead of calling the overridden "protected void onSubmit(AjaxRequestTarget 
target, Form form);"
These overriden methods reside in my anonymous inner subclass of AjaxButton.

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



Re: Need some help creating dynamic resources from database-inputstream please!

2012-08-16 Thread Michael M
I think I just made a huge step forward by overriding getData() of
ByteArrayResource. I've read that in the documentation before, but at that
time was too deep into the concept of resources that I didn't get it (I'm
completely new to Wicket).

So, right now it works that I read my attachment, convert it into a
byte-array and deliver it, only when the link is clicked. I still get a URL
I can use for other functions (pass a .mp4-ByteArrayResource to a JW Player
instance e.g.) No creating of static resources at page-load anymore.

Next step would be to skip the byte-array completely. How could I do my own
Resource that delivers the data as a stream, but has the same functionality
otherwise (usable in some kind of Link so that I can get the URL)?
Something like

Resource attachmentResource = new WebResource() {
> @Override
> public IResourceStream getResourceStream() {
> // return my stream somehow
> }
> }


doesn't work anymore if I'm not mistaken.

Appreciate your help so far!

2012/8/16 Michael M 

> Hi, thanks for for quick answer! I already played around with
> ResourceStreams, but my problem was that I couldn't do the bridge from a
> Stream to a Resource with a URL.
>
> I should add, I'm not offering my ByteArrayResources as a download. I pass
> the content-type and filename, and (with the help I got from a user here)
> return it as INLINE. So, when the user clicks, the browser opens the
> filetype if it can (e.g. a picture, or a PDF with a built-in viewer).
>
> Also (and that's important) I then have a real URL which I can pass to
> Javascript functions. E.g. if the attachment is an mp3 or a video, I
> additionally use the URL of the ResourceLink to open a custom flash-player
> (JW Player).. I need a solid URL for that, for that session.
>
> When I played around I just couldn't manage to get that kind of URL when I
> worked with Streams. But I will give it another try.
>
> PS: I found this example a while ago, and wanted to implement my own
> IResourceStream to fetch the attachments from the DB, but the example is
> outdated and I couldn't figure out how to do it with a newer version of
> Wicket: http://goo.gl/imGrl
>
>
> 2012/8/16 Sven Meier 
>
>> Take a look at DownloadLink and FileResourceStream, and replace all File
>> related API to your CouchDB access.
>>
>> Sven
>>
>> Michael M  schrieb:
>>
>> >Hi, in my project I use a CouchDB with files as attachments. Currently I
>> >have a page that makes those attachments available via a ResourceLink.
>> What
>> >I do when creating that page is:
>> >
>> >   - I read all attachments (I get them as an InputStream),
>> >   - create a byte[] out of it,
>> >   - create a static Wicket ByteArrayResource
>> >   - and put the link to that resource on the page.
>> >
>> >That works for smaller files, but a huge problem is of course: it's
>> static,
>> >and I get memory problems if the attachments get too big. Also, currently
>> >obviously each session does this.
>> >
>> >What I would like to do instead is:
>> >
>> >   - create Resources that will load my attachments dynamically if the
>> link
>> >   is clicked,
>> >   - and add ResourceLinks to those resources on my page instead.
>> >   - If possible, maybe deliver the attachments directly from the
>> >   InputStream my CouchDB delivers, so I don't have to have any static
>> >   byte-arrays on my server.
>> >
>> >That way I could make the page load immediately and deliver attachments
>> >only if required.
>> >
>> >I've wrapped my head around IResourceStreams, but I just can't see clear
>> >anymore and am confused about how to create those dynamic resources (also
>> >because some old examples don't work anymore with Wicket 1.5 or 6beta3).
>> >
>> >I'd be very thankful for a short example, or a hint about how to design
>> >this. Thank you!
>>
>
>


Re: Wicket / Liferay help

2012-08-16 Thread Vanessa Busch

I have the exact same issue with wicket 1.5.7, liferay 6.1.1, and
org.apache.portals.bridges:portals-bridges-common version 2.  Maybe these
versions are incompatible?

Have you had any success?



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-Liferay-help-tp4651140p4651281.html
Sent from the Users forum mailing list archive at Nabble.com.

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



[6.0] resource management

2012-08-16 Thread Pierre Goupil
Good afternoon,

I'm currently playing with Wicket 6.0 resource management, as found here:
http://wicketinaction.com/2012/07/wicket-6-resource-management/

Martin's website introduces us to the concept of resource dependencies. It
works great for my own provided JS, but there is still one problem:
wicket-core 6.0.0-beta3 contributes its own JSs and I'd like Wicket not to
contribute jquery.js, because I'll provide it myself.

Is there any way of doing this? I have some JQuery-related JS that I
contribute myself to the (beginning of the) , so Wicket's
contribution of jquery.js (at the end of the ) is undesirable because
the JS file is then duplicated, which breaks my dependency graph.

As an additional request, is there any way to tell Wicket to contribute its
JS files, but at the very beginning of the  tag?

Lastly, which JQuery version should I use if I must contribute the
jquery.js myself? Is 1.6.0 up to 1.8.0 all OK?

Thanks in advance & best regards,

Pierre



-- 
Le bonheur n'est pas une destination, mais une façon de voyager.

Papa d'une petite Lou-Ann depuis le 30 juin.


Re: Read POST based request from external site

2012-08-16 Thread tmaus
Thanks for your replies:

This is my plain html code:

 







This is my Wicket class:

public class UploadPage extends WebPage {

final Logger LOG = LoggerFactory.getLogger(getClass());

public UploadPage() {
   
   for(String str :
getRequest().getRequestParameters().getParameterNames()){
   LOG.debug("==> " + str);
   }

}
}


I cannot read a single param. 

Pls. keep in mind:
The form is NO wicket form as I try to simulate an external access to my
page. 

Thanks for your help




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Read-POST-based-request-from-external-site-tp4651269p4651279.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Need some help creating dynamic resources from database-inputstream please!

2012-08-16 Thread Michael M
Hi, thanks for for quick answer! I already played around with
ResourceStreams, but my problem was that I couldn't do the bridge from a
Stream to a Resource with a URL.

I should add, I'm not offering my ByteArrayResources as a download. I pass
the content-type and filename, and (with the help I got from a user here)
return it as INLINE. So, when the user clicks, the browser opens the
filetype if it can (e.g. a picture, or a PDF with a built-in viewer).

Also (and that's important) I then have a real URL which I can pass to
Javascript functions. E.g. if the attachment is an mp3 or a video, I
additionally use the URL of the ResourceLink to open a custom flash-player
(JW Player).. I need a solid URL for that, for that session.

When I played around I just couldn't manage to get that kind of URL when I
worked with Streams. But I will give it another try.

PS: I found this example a while ago, and wanted to implement my own
IResourceStream to fetch the attachments from the DB, but the example is
outdated and I couldn't figure out how to do it with a newer version of
Wicket: http://goo.gl/imGrl

2012/8/16 Sven Meier 

> Take a look at DownloadLink and FileResourceStream, and replace all File
> related API to your CouchDB access.
>
> Sven
>
> Michael M  schrieb:
>
> >Hi, in my project I use a CouchDB with files as attachments. Currently I
> >have a page that makes those attachments available via a ResourceLink.
> What
> >I do when creating that page is:
> >
> >   - I read all attachments (I get them as an InputStream),
> >   - create a byte[] out of it,
> >   - create a static Wicket ByteArrayResource
> >   - and put the link to that resource on the page.
> >
> >That works for smaller files, but a huge problem is of course: it's
> static,
> >and I get memory problems if the attachments get too big. Also, currently
> >obviously each session does this.
> >
> >What I would like to do instead is:
> >
> >   - create Resources that will load my attachments dynamically if the
> link
> >   is clicked,
> >   - and add ResourceLinks to those resources on my page instead.
> >   - If possible, maybe deliver the attachments directly from the
> >   InputStream my CouchDB delivers, so I don't have to have any static
> >   byte-arrays on my server.
> >
> >That way I could make the page load immediately and deliver attachments
> >only if required.
> >
> >I've wrapped my head around IResourceStreams, but I just can't see clear
> >anymore and am confused about how to create those dynamic resources (also
> >because some old examples don't work anymore with Wicket 1.5 or 6beta3).
> >
> >I'd be very thankful for a short example, or a hint about how to design
> >this. Thank you!
>


Re: Basic JUnit Test

2012-08-16 Thread JCoder
Well it turns out that reflective call of a method failes.
I run into WicketRuntimeException in RequestListenerInterface.invoke(Page, 
Component). 
The button to submit is an instance of AjaxButton. Does this make a difference 
in initializing the test?

Regards,
Y

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



Re: Read POST based request from external site

2012-08-16 Thread Andrea Del Bene

Hi,

try getRequestParameters() instead of getPostParameters(). This method 
returns all request parameters. I don't know why getPostParameters() 
return an empty result, maybe it is an issue...

I was looking up all available threads, but did not find an answer.

I have an app deployed to a mobile device that should communicate with my
service via REST.

As part of the flow the user can upload a new picture to the service.

My page is able to read GET based requests, but no POST based onces.

Im using wicket 1.5.7

RequestCycle.get().getRequest().getPostParameters() is empty

My page extends "WebPage"

Tried to use constructor with and without PageParameters without any
success.

I mounted my page (mountPage("/upload",UploadPage.class)) with
WebApplication.

Any ideas ?

Any hints ?

Regards

Thorsten





--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Read-POST-based-request-from-external-site-tp4651269.html
Sent from the Users forum mailing list archive at Nabble.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: Read POST based request from external site

2012-08-16 Thread Thomas Götz
This normally means that there *are* no POST parameters. Are you sure you're 
doing a POST request to your page, and not a GET?

   -Tom


On 16.08.2012, at 12:16, tmaus  wrote:

> 
> I was looking up all available threads, but did not find an answer. 
> 
> I have an app deployed to a mobile device that should communicate with my
> service via REST. 
> 
> As part of the flow the user can upload a new picture to the service. 
> 
> My page is able to read GET based requests, but no POST based onces. 
> 
> Im using wicket 1.5.7
> 
> RequestCycle.get().getRequest().getPostParameters() is empty 
> 
> My page extends "WebPage"
> 
> Tried to use constructor with and without PageParameters without any
> success.
> 
> I mounted my page (mountPage("/upload",UploadPage.class)) with
> WebApplication. 
> 
> Any ideas ?
> 
> Any hints ?
> 
> Regards
> 
> Thorsten 


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



Re: Need some help creating dynamic resources from database-inputstream please!

2012-08-16 Thread Sven Meier
Take a look at DownloadLink and FileResourceStream, and replace all File 
related API to your CouchDB access.

Sven

Michael M  schrieb:

>Hi, in my project I use a CouchDB with files as attachments. Currently I
>have a page that makes those attachments available via a ResourceLink. What
>I do when creating that page is:
>
>   - I read all attachments (I get them as an InputStream),
>   - create a byte[] out of it,
>   - create a static Wicket ByteArrayResource
>   - and put the link to that resource on the page.
>
>That works for smaller files, but a huge problem is of course: it's static,
>and I get memory problems if the attachments get too big. Also, currently
>obviously each session does this.
>
>What I would like to do instead is:
>
>   - create Resources that will load my attachments dynamically if the link
>   is clicked,
>   - and add ResourceLinks to those resources on my page instead.
>   - If possible, maybe deliver the attachments directly from the
>   InputStream my CouchDB delivers, so I don't have to have any static
>   byte-arrays on my server.
>
>That way I could make the page load immediately and deliver attachments
>only if required.
>
>I've wrapped my head around IResourceStreams, but I just can't see clear
>anymore and am confused about how to create those dynamic resources (also
>because some old examples don't work anymore with Wicket 1.5 or 6beta3).
>
>I'd be very thankful for a short example, or a hint about how to design
>this. Thank you!


Need some help creating dynamic resources from database-inputstream please!

2012-08-16 Thread Michael M
Hi, in my project I use a CouchDB with files as attachments. Currently I
have a page that makes those attachments available via a ResourceLink. What
I do when creating that page is:

   - I read all attachments (I get them as an InputStream),
   - create a byte[] out of it,
   - create a static Wicket ByteArrayResource
   - and put the link to that resource on the page.

That works for smaller files, but a huge problem is of course: it's static,
and I get memory problems if the attachments get too big. Also, currently
obviously each session does this.

What I would like to do instead is:

   - create Resources that will load my attachments dynamically if the link
   is clicked,
   - and add ResourceLinks to those resources on my page instead.
   - If possible, maybe deliver the attachments directly from the
   InputStream my CouchDB delivers, so I don't have to have any static
   byte-arrays on my server.

That way I could make the page load immediately and deliver attachments
only if required.

I've wrapped my head around IResourceStreams, but I just can't see clear
anymore and am confused about how to create those dynamic resources (also
because some old examples don't work anymore with Wicket 1.5 or 6beta3).

I'd be very thankful for a short example, or a hint about how to design
this. Thank you!


Dataview: need a differente css for negative values

2012-08-16 Thread Delange
Hi, in my DataView I have a column with amounts.
I want to give the positive ones a green color, and the negative ones a red
color;

How to accomplish that?



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Dataview-need-a-differente-css-for-negative-values-tp4651270.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Read POST based request from external site

2012-08-16 Thread tmaus

I was looking up all available threads, but did not find an answer. 

I have an app deployed to a mobile device that should communicate with my
service via REST. 

As part of the flow the user can upload a new picture to the service. 

My page is able to read GET based requests, but no POST based onces. 

Im using wicket 1.5.7

RequestCycle.get().getRequest().getPostParameters() is empty 

My page extends "WebPage"

Tried to use constructor with and without PageParameters without any
success.

I mounted my page (mountPage("/upload",UploadPage.class)) with
WebApplication. 

Any ideas ?

Any hints ?

Regards

Thorsten 





--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Read-POST-based-request-from-external-site-tp4651269.html
Sent from the Users forum mailing list archive at Nabble.com.

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