AuthorizationStrategy design question

2012-04-21 Thread Jürgen Lind

Hi,

I am looking for ideas on how to implement a context-aware 
AuthorizationStrategy.
This means that I need a way to decided whether a certain self-written 
component can
be instantiated in a particular context or not. For example, the filter 
component
may be show to a user with a certain permission when looking at ListPanel1, but 
not
when looking at ListPanel2.

In previous Wicket applications, a have use my own annotation-based scheme that 
worked
very well, but I cannot use it for this application since the permission 
granularity is
much more fine-grained and context sensitive.

Is there any good way of doing this? I already tried looking at the component 
path, but
that does not give me the information I need since it only covers the ids of the
components i.e. using the above filter component in a setting where 
ListPanel1 and
ListPanel2 are switched via Ajax calls, I get the same component path...

Thanks for any ideas,

J.





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



Java Maps and non-SQL database

2012-04-21 Thread Marc Marc
Hello,

I want to develop an application-interpreter. The interpreter runs an 
application model consisting of entity-relationships and fairly easy business. 
My idea is to use Wicket using Java maps as underlying model and to use a 
non-SQL database to make the Java maps persistent. This way I try to omit to 
have to compile the application model towards Java POJO’s and towards SQL 
tables. So I would appreciate your insight on the following 2 questions:
1)Are there already existing implementations of the combination wicket – Java 
map – non-SQL database?
2) On wiki side, what is the best way to having Java maps as model (instead of 
POJOs). Should I develop my own subclasses of IModel (see also thread demand 
for maps)

Thanks for your insights,
Marc-Mail.be, WebMail and 
Virtual Officehttp://www.mail.be

Re: Page Expired with Google Analytics Tracking Code

2012-04-21 Thread Bas Gooren

Hi Andre,

Without a quickstart it's nearly impossible to help.

Nevertheless, as before, I expect this has to do with either a model 
that loses track of it's data (could be a serialization issue?), or 
incorrect usage of said model.


When you say that after clicking a link in the navigator the results 
are empty, how did you find out about that?
I'd suggest doing some debugging (e.g. set some breakpoints in your code 
and wicket code) in your favorite IDE.


Some breakpoint ideas:
- Your model which contains the results: set a breakpoint in 
#getObject() to make sure it is called, and check what it returns
- PageableListView#onPopulateItem: check if it is called (= a 
re-render), and what the item's model contains


Bas

Op 21-4-2012 1:01, schreef Andre Schütz:

Hi,

I tried to reproduce the error with a quickstart project
but was not successful. The quickstart is running fine with
Google Analytics and PageableListView.

I think that the project is to complex and the error is
somewhere else.
The only solution I can imagine is a detailed explanation
of my problem with my new findings.
May be, someone had the same problem
or has an idea where I could search for the error.

I hope that someone reads the following explanation
and has an idea. I would be very thankful.

My problem:
- I added Google Analytics to my page and have a
PageableListView on my results page.
- I have 60 results for my PageableListView and show
10 entries per page. When the page is rendered, the
PageableListView is constructed and show the first 10
entries.
- The PagingNavigator show 6 pages of entries.

The error:
- When I click on one of the links of the PagingNavigator,
the entries of the PageableListView are empty.

I checked the results that were delivered to the PageableListView.
When the PageableListView is constructed, the 60 results
are filled and not empty. After clicking on one of the
links in the PagingNavigator, the results are empty!

I saw the empty results in the DebugBar and with an
additional System.out.println within the populateItem method
of the PageableListView.

I would be very thankful, if someone has an idea or knows
another solution that I can try.
I try to solve the error since more than 2 weeks and have no new clue.

Many thanks,
Andre





On Tue, 17 Apr 2012 22:31:27 +0200
Andre Schützandre-p...@gmx.de  wrote:


Hi, I will try to complete that in the next days and
attach the quickstart as an answer.

Thank you for the help,
Andre

On Mon, 16 Apr 2012 22:57:11 +0200
Bas Goorenb...@iswd.nl  wrote:


Hi,

Can you build a small quickstart so I can have a look at things when
they are not working?
So just the bare minimum where it's not working: your page that is not
working with a dummy model (e.g. with hardcoded results).

Bas

Op 16-4-2012 20:50, schreef Andre Schütz:

Hi,

I tried with super.renderHead..., but the result is the
same. The PageableListView is empty after clicking on
one of links in the PagingNavigator.

Additinally, I fodun out that the elements (listItem) are
empty when I click on one of the links in the PagingNavigator.
They are filled, when the PageableListView is build.
Any idea why how that could happen?

Andre

On Fri, 13 Apr 2012 10:29:41 +0200
Bas Goorenb...@iswd.nl   wrote:


Hi,

What happens if you change that to:

@Override
public void renderHead(HeaderResponse response) {
 super.renderHead(response);
 String script = var _gaq = _gaq || ...;
 response.renderJavaScript(script, null);
}

? (note that I added a call to super.renderHead());

Bas

Op 11-4-2012 23:08, schreef Andre Schütz:

Hi,

I implemented your version but still I get the same error, if
I have the Google Analytics Code in the head.

Could it be an error with the way I insert the Google
Analytics Code? I do it in the following way.

In my WebPage class I overwrite the following method:

@Override
public void renderHead(HeaderResponse response) {
 String script = var _gaq = _gaq || ...;
 response.renderJavaScript(script, null);
}

Andre

On Wed, 11 Apr 2012 11:38:52 +0200
Bas Goorenb...@iswd.nlwrote:


Well, for starters I wonder why you are using multiple
LoadableDetachableModels in a Vector?

What we do 99% of the time is this:
- Wrap the entire resultset in a LDM
- Feed that LDM to a ListView or a variant (we have a custom
RepeatingView for paged database listings)
- Use PropertyModels inside the repeater item(s) (or not, since the
ListView will refresh itself anyway)

I'm pretty sure you don't need setReuseItems(true) in this case; The
only reason I've seen where it's required on a ListView is when you use
it inside a form and need form validation to work. Since I don't see any
form fields inside your listview I guess this is not the case.

I also wonder why you had datacontainer.setVersioned(false)?

E.g.:

private void displayResults(IModelListDefaultSearchResult results, int 
entriesPerPage) {
WebMarkupContainer datacontainer = new 
WebMarkupContainer(listviewContainer);

Re: Clear markup cache

2012-04-21 Thread Decebal Suiu
Another question: I know what markup files are changed do you think that it's
a good idea to use MarkupCache.removeMarkup(String key) to improve the
performance?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Clear-markup-cache-tp4575033p4576743.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: How do I keep component paths constant across unit tests when using Wicket Tester

2012-04-21 Thread Martin Makundi
Test safely:

https://cwiki.apache.org/WICKET/type-safe-testing-in-wicket.html

2012/4/21 mmuk...@gmail.com mmuk...@gmail.com:
 I have several wicket tests that target a sortable DataTable, specifically
 ajax-clicking the sortable column headers and asserting the contents of the
 rendered body rows. Now the component hierarchy of the table component's
 descendants is auto generated by the wicket framework, and results in paths
 to the sorting links (ajax) similar to:

    table:topToolbars:toolbars:0:headers:1:header:orderByLink

 However, when the DataTable gets re-rendered across tests, the index of the
 toolbars component is incremented each time i.e similar to:

    table:topToolbars:toolbars:1:headers:1:header:orderByLink

 which then breaks the hard-coded paths of the succeeding tests as they will
 no longer match.

 The code fragment for the datatable construction is as follows:

                final PayeesProvider dataProvider = new PayeesProvider();
                table = new DataTableResponsePayeeDetails(payees, columns,
 dataProvider, rowsPerPage);
                table.setOutputMarkupId(true);
                table.addTopToolbar(new AjaxFallbackHeadersToolbar(table, 
 dataProvider) {

                        private static final long serialVersionUID = 
 -3509487788284410429L;

                        @Override
                        protected WebMarkupContainer newSortableHeader(final 
 String borderId,
 final String property, final ISortStateLocator locator) {
                                return new AjaxFallbackOrderByBorder(borderId, 
 property, locator,
 getAjaxCallDecorator()) {

                                        @Override
                                        protected void onRender() {
                                                System.out.printf(Path: 
 %s\n, this.getPageRelativePath());
                                                super.onRender();
                                        }

                                        private static final long 
 serialVersionUID = -6399737639959498915L;

                                        @Override
                                        protected void onAjaxClick(final 
 AjaxRequestTarget target) {
                                                target.add(getTable(), 
 navigator, navigatorInfoContainer);
                                        }

                                        @Override
                                        protected void onSortChanged() {
                                                super.onSortChanged();
                                                getTable().setCurrentPage(0);
                                        }
                                };
                        }
                });
                table.addBottomToolbar(new NoRecordsToolbar(table));
                add(table);

 To be precise, when I run my tests, the above System.out.printf statement
 prints:

 (1st test)

    Path: payees:topToolbars:toolbars:0:headers:1:header
    Path: payees:topToolbars:toolbars:0:headers:2:header

 (2nd test)

    Path: payees:topToolbars:toolbars:2:headers:1:header
    Path: payees:topToolbars:toolbars:2:headers:2:header

 (3rd test)

    Path: payees:topToolbars:toolbars:4:headers:1:header
    Path: payees:topToolbars:toolbars:4:headers:2:header

 (4th test)

    Path: payees:topToolbars:toolbars:6:headers:1:header
    Path: payees:topToolbars:toolbars:6:headers:2:header
    Path: payees:topToolbars:toolbars:6:headers:1:header
    Path: payees:topToolbars:toolbars:6:headers:2:header
    Path: payees:topToolbars:toolbars:6:headers:1:header
    Path: payees:topToolbars:toolbars:6:headers:2:header

 (5th test)

    Path: payees:topToolbars:toolbars:8:headers:1:header
    Path: payees:topToolbars:toolbars:8:headers:2:header

 Does anyone know how I can force the index generation to be more
 deterministic / repeatable. Alternatively, is there a way of wild-carding or
 otherwise generalising the path, so as to make them immune to these
 increments?

 Any help will be greatly appreciated chaps!


 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/How-do-I-keep-component-paths-constant-across-unit-tests-when-using-Wicket-Tester-tp4577030p4577030.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



Wicket generates absolute urls for redirects 301? - Whats the way out

2012-04-21 Thread FarhanS
Hi Guys,

We are deploying our application in a new environment/infrastructure, where
it would sit behind a load-balancer and the
application/apache-server/virtual-host setup has changed a little, and is
causing problems in redirect scenarios, for which I want some help.

So here is the problem.

The virtual host definition (in virtual_host.conf in apache) against each of
the website hosted is now configured to listen on a non-default port (e.g. 
8081, 8082, 8083 etc). With that wherever Wicket pages has some redirection
logic built into it, e.g. using RedirectResponseException or
setResponsePage(Page.class), or any other means which involves redirection
(301/302), it is now injecting the port in the url e.g.
http://mydomainname:8081/request/uri. I was of the understanding that Wicket
always uses relative urls, even for redirect, as also implied in this ticket
(https://issues.apache.org/jira/browse/WICKET-2728) but apparently that is
not the case. Let me add that none of these redirect scenarios where this
problem is happening, we are not constructing/providing the url to forward
to, and in fact are using the framework api(s) (as above) itself to redirect
to different pages within the same application.

Can please someone guide me there as to how to fix this issue. Similarly
given the SSL enforcement is now taking place at the load-balancer level
(and not at the apache layer), the absolute url which is constructed is also
using http:// instead of https://, given the traffic within the network is
over http. All these problems are coming into play due to the
usage/construction of absolute urls.

Please guide..using 1.4.18 version.

Thanks in advance,

Farhan.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-generates-absolute-urls-for-redirects-301-Whats-the-way-out-tp4577479p4577479.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