profile it and see what code takes more then a minute to complete -igor
On Mon, Nov 8, 2010 at 1:31 PM, Simon van Wingerden <[email protected]> wrote: > I'm busy to create an application with wicket just for fun and now I've got > some strange behavior. > After clinking a couple of times the program hangs and after a while I get > the error message: > > ERROR - RequestCycle - org.apache.wicket.WicketRuntimeException: After 1 > minute the Pagemap null is still locked by: Thread[http-8080-24,5,main] > > Can it be that the page is to big or something ? > > It's a 3 layer app with Wicket, Spring and Hibernate. > > Wicket version 1.4.12 and the server is tomcat 6. > > > Below the code of my HomePage as I think the error is in this page. > I use Panels that are replaced based on the given parameters. > > > package com.svw; > > import com.svw.panels.SinglePagePanel; > import com.svw.panels.PagePanel; > import com.svw.panels.NewPagePanel; > import com.svw.panels.ChangesPanel; > import com.svw.panels.EditPagePanel; > import com.svw.panels.NewCategoryPanel; > import com.svw.model.Category; > import com.svw.panels.SearchPanel; > import com.svw.security.SignInPage; > import com.svw.security.SimWikiSession; > import com.svw.services.CategoriesService; > import com.svw.services.PagesService; > import org.apache.wicket.markup.html.basic.Label; > import org.apache.wicket.markup.html.WebPage; > import org.apache.wicket.spring.injection.annot.SpringBean; > import com.svw.services.UsersService; > import java.util.ArrayList; > import java.util.List; > import org.apache.wicket.Component; > import org.apache.wicket.PageParameters; > import org.apache.wicket.markup.html.link.BookmarkablePageLink; > import org.apache.wicket.markup.html.link.Link; > import org.apache.wicket.markup.html.list.ListItem; > import org.apache.wicket.markup.html.list.ListView; > import org.apache.wicket.markup.html.panel.Panel; > > /** > * Homepage > */ > public class HomePage extends WebPage { > > private Panel panel = null; > private static final long serialVersionUID = 1L; > �...@springbean > protected CategoriesService categoryService; > �...@springbean > protected UsersService userService; > �...@springbean > protected PagesService pagesService; > > /** > * Constructor that is invoked when page is invoked without a session. > * > * @param parameters > * Page parameters > */ > public HomePage(PageParameters parameters) { > String categorieFromParameter = parameters.getString("category"); > String actionFromParameter = parameters.getString("action"); > String pageFromParameter = parameters.getString("page"); > > > List<String> listCategories = new ArrayList<String>(); > for (Category cat : categoryService.getCategories()) { > listCategories.add(cat.getName()); > } > > createSiteMap(); > createContact(); > > createCatories(listCategories); > > Link linkSearch = createSearchPage(); > > Link linkChange = createChangesPage(); > > Link link = createNewPage(); > securityOnlyAuthorsAndAdmins(link); > > Link linkNewCategory = createNewCategory(); > securityOnlyAdmins(linkNewCategory); > > > Link logoutLink = createLogout(); > add(getPanel(categorieFromParameter, actionFromParameter, > pageFromParameter)); > > > authorised(); > > } > > private void createCatories(List<String> listCategories) { > ListView listview = new ListView("listview", listCategories) { > > �...@override > protected void populateItem(ListItem item) { > PageParameters pp = new PageParameters(); > pp.add("category", item.getModelObject().toString()); > BookmarkablePageLink link = new > BookmarkablePageLink("CategoryLink", HomePage.class, pp); > link.add(new Label("CategoriesCaption", item.getModel())); > item.add(link); > } > }; > add(listview); > } > > private void createContact() { > add(new Link("contact") { > > �...@override > public void onClick() { > Panel newPanel = new HomePanel("panelContainer", "Contact > us", "<a href=\"mailto:[email protected]\">mail</a> creator of this program > for suggestions or bugs."); > panel.replaceWith(newPanel); > panel = newPanel; > } > }); > } > > private void authorised() { > //if not authorised log in > if (SimWikiSession.get() == null || > !SimWikiSession.get().isAuthenticated()) { > setRedirect(true); > setResponsePage(SignInPage.class); > } > } > > // Authentication roles > private void securityOnlyAuthorsAndAdmins(Component comp) { > if (SimWikiSession.get() != null && > SimWikiSession.get().isAuthenticated()) { > if (SimWikiSession.get().isReader()) { > comp.setVisible(false); > } > } > } > > private void securityOnlyAdmins(Component comp) { > if (SimWikiSession.get() != null && > SimWikiSession.get().isAuthenticated()) { > if (!SimWikiSession.get().isAdmin()) { > comp.setVisible(false); > } > } > } > > private Link createNewPage() { > Link link = new Link("newPage") { > > �...@override > public void onClick() { > Panel newPanel = new NewPagePanel("panelContainer"); > panel.replaceWith(newPanel); > panel = newPanel; > } > }; > add(link); > return link; > } > > private Link createChangesPage() { > Link link = new Link("changes") { > > �...@override > public void onClick() { > Panel newPanel = new ChangesPanel("panelContainer", > SimWikiSession.get().getUser().getName()); > panel.replaceWith(newPanel); > panel = newPanel; > } > }; > add(link); > return link; > } > > private Link createSearchPage() { > Link link = new Link("search") { > > �...@override > public void onClick() { > Panel newPanel = new SearchPanel("panelContainer"); > panel.replaceWith(newPanel); > panel = newPanel; > } > }; > add(link); > return link; > } > > private Link createNewCategory() { > Link link = new Link("newCategory") { > > �...@override > public void onClick() { > Panel newPanel = new NewCategoryPanel("panelContainer"); > panel.replaceWith(newPanel); > panel = newPanel; > } > }; > add(link); > return link; > } > > //log out > private Link createLogout() { > Link logoutLink = new Link("logOut") { > > �...@override > public void onClick() { > getSession().invalidate(); > setRedirect(true); > setResponsePage(SignInPage.class); > } > }; > add(logoutLink); > return logoutLink; > } > //SiteMap > > private void createSiteMap() { > add(new Link("sitemap") { > > �...@override > public void onClick() { > Panel newPanel = new HomePanel("panelContainer", "Sitemap", > "Nog niet geimplementeerd"); > panel.replaceWith(newPanel); > panel = newPanel; > } > }); > } > > private Panel getPanel(String category, String action, String id) { > Panel constructPanel = null; > > if (action == null) { > if (category == null && id == null) { > constructPanel = new HomePanel("panelContainer", "Home", > "Welcome on the simwiki"); > } else if (category == null && id != null) { > constructPanel = new SinglePagePanel("panelContainer", id); > } else if (category != null && id == null) { > constructPanel = new PagePanel("panelContainer", category); > } else if (category != null && id != null) { > } > > } else if (action.equalsIgnoreCase("delete")) { > if (category == null && id == null) { > //free not used > } else if (category == null && id != null) { > //free not used > } else if (category != null && id == null) { > //free not used > } else if (category != null && id != null) { > //page=7&category=java > pagesService.delete(Long.parseLong(id), > SimWikiSession.get().getUser().getName()); > constructPanel = new PagePanel("panelContainer", category); > } > > > } else if (action.equalsIgnoreCase("edit")) { > if (category == null && id == null) { > //free not used > } else if (category == null && id != null) { > constructPanel = new EditPagePanel("panelContainer", > Long.parseLong(id)); > } else if (category != null && id == null) { > //free not used > } else if (category != null && id != null) { > //free not used > } > } > > if (constructPanel == null) { > constructPanel = new HomePanel("panelContainer", "Home", "Welcome > on the simwiki"); > } > //needed for replace! > this.panel = constructPanel; > > return panel; > } > } > > Regards, > > Simon > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
