Spring Security (née acegi) integration str ategy?
In general, when planning to implement Spring Security for authentication, what is generally considered the best way to do so? 1) Implement the app completely with Wicket Security (wasp/swarm/hive) and then add in Spring Security? 2) Start with Spring Security and Wicket Security from the start? Thoughts? -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Any wicketstuff.org site admins around?
It doesn't look as though there is any way to send a message to the site admins listed on the Wicket Stuff site. The web server is not setting the correct mime-type for .war files. If any of the admins see this, could you add something like the following (assuming Apache httpd)... AddType application/octet-stream .war -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Decoding hierarchy errors (resolved)
NM, looks like I had a bad tag in the html. -David On Jul 25, 2008, at 2:42 PM, David Nedrow wrote: I have the following setup... Page TabbedPanel Tab Panel ModalWindow Panel Form FeedbackPanel In the form, I've defined... final FeedbackPanel feedback = new FeedbackPanel("createuserfeedback"); form.add(feedback); This feedback panel is to be used to provide corrective guidance to users for field entry via a custom Validator. The HTML for the Panel containing the form is pretty simple... ... However, when I run the app, I received the following error... WicketMessage: Unable to find component with id 'createuserfeedback' in [MarkupContainer [Component id = content, page = com.vzbi.ncs.argfrp.webapp.FilterRequest.web.pages.TabbedPanelPage, path = 2:tabs:panel:modalwindow:content.UserCreateModalWindow$1, isVisible = true, isVersioned = false]]. This means that you declared wicket:id=createuserfeedback in your markup, but that you either did not add the component to your page at all, or that the hierarchy does not match. [markup = file:/Users/dnedrow/Developer/NetBeansProjects/ArgfrpEE/ dist/gfdeploy/FilterRequest_war/WEB-INF/classes/com/vzbi/ncs/argfrp/ webapp/FilterRequest/web/panels/UserCreatePanel.html ... , index = 2, current = '' (line 3, column 9)] The target in the HTML matches the component id in the java file, so I'm guessing there is a hierarchy problem? Any ideas? -David - 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]
Decoding hierarchy errors
I have the following setup... Page TabbedPanel Tab Panel ModalWindow Panel Form FeedbackPanel In the form, I've defined... final FeedbackPanel feedback = new FeedbackPanel("createuserfeedback"); form.add(feedback); This feedback panel is to be used to provide corrective guidance to users for field entry via a custom Validator. The HTML for the Panel containing the form is pretty simple... ... However, when I run the app, I received the following error... WicketMessage: Unable to find component with id 'createuserfeedback' in [MarkupContainer [Component id = content, page = com.vzbi.ncs.argfrp.webapp.FilterRequest.web.pages.TabbedPanelPage, path = 2:tabs:panel:modalwindow:content.UserCreateModalWindow$1, isVisible = true, isVersioned = false]]. This means that you declared wicket:id=createuserfeedback in your markup, but that you either did not add the component to your page at all, or that the hierarchy does not match. [markup = file:/Users/dnedrow/Developer/NetBeansProjects/ArgfrpEE/dist/ gfdeploy/FilterRequest_war/WEB-INF/classes/com/vzbi/ncs/argfrp/webapp/ FilterRequest/web/panels/UserCreatePanel.html ... , index = 2, current = '' (line 3, column 9)] The target in the HTML matches the component id in the java file, so I'm guessing there is a hierarchy problem? Any ideas? -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ContextRefreshedEvent (Re: Spring injection not working)
On Jul 23, 2008, at 5:21 PM, James Carman wrote: The TestDataLoader is configured in the META-INF/beans.xml file: http://svn.carmanconsulting.com/public/wicket-advanced/trunk/src/main/resources/META-INF/beans.xml It's injected that way OK, I see that. I actually asked the wrong question. Is an application context required to trap the ContextRefreshedEvent? IE., beyond defining the and extending ApplicationListener as in your TestDataLoader, is anything else required to have my class called when the context is initialized? It seems as though I'm missing a piece, and I'm guessing it may be a filter. You have several defined that I don't currently include. -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Spring injection not working
On Jul 23, 2008, at 3:27 PM, landry soules wrote: Actually, if the class using userDAO doesn't extend Component, you have to add InjectorHolder.getInjector().inject(this) in the constructor of the calling class. Is that in addition to addComponentInstantiationListener(), or in place of? Is order important if both are needed? -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Spring injection not working
On Jul 23, 2008, at 3:23 PM, James Carman wrote: Try downloading my example code from: http://svn.carmanconsulting.com/public/wicket-advanced/trunk/ See if there's anything you're doing differently. Hmm, I spoke too soon in my earlier reply. My AppSetup class is doing what your TestDataLoader class does. I don't see, however, in the TestDataLoader where you're injecting any SpringBeans via annotation. -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Spring injection not working
On Jul 23, 2008, at 3:27 PM, landry soules wrote: Actually, if the class using userDAO doesn't extend Component, you have to add InjectorHolder.getInjector().inject(this) in the constructor of the calling class. Hmm, this may be the path. The class in question is just a utility class that initializes some database values. public class AppSetup { ApplicationContext applicationContext = ((WicketApplication) Application.get()).getContext(); IProtocolDAO protocolDAO = ProtocolDAO.getFromApplicationContext(applicationContext); public AppSetup(){ setupProtocols(); } private setupProtocols(){ // Do stuff with protocolDAO here } } Instantiating the above from my wicket application init does create the proper data, etc. If I change it as below, how should it be called to guarantee injection of ProtocolDAO? public class AppSetup { @SpringBean(name = ProtocolDAO) IProtocolDAO protocolDAO; public AppSetup(){ setupProtocols(); } private setupProtocols(){ // Do stuff with protocolDAO here } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Spring injection not working
On Jul 23, 2008, at 3:23 PM, James Carman wrote: Try downloading my example code from: http://svn.carmanconsulting.com/public/wicket-advanced/trunk/ James, I've been using your examples and they've been really helpful, with the exception of this. ;) As it turns out, Landry provided the answer re: InjectorHolder. The class that wasn't working didn't extend Component, so the injection didn't work. Adding InjectorHolder.getInjector().inject(this) to the init of my calling class fixed it up. The class in question was basically a utility class that inserts initial data into my database. Might be worth putting something similar into your example. Give my boneheadedness meaning, please. ;) -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Spring injection not working
On Jul 23, 2008, at 12:10 PM, James Carman wrote: Have you tried using @SpringBean? On Wed, Jul 23, 2008 at 12:04 PM, David Nedrow <[EMAIL PROTECTED]> wrote: I believe (though I'm clearly wrong in that belief) that I have everything properly configured to allow spring injection along the lines of: import com.foo.dao.UserDAO; @Spring private UserDAO userDAO; D'oh! Yes, I'm using @SpringBean. I wish it was that simple. ;) I was typing the examples I included in my original message, rather than copy and paste and flubbed it. Wherever @Spring is in my example, read @SpringBean. -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Spring injection not working
I believe (though I'm clearly wrong in that belief) that I have everything properly configured to allow spring injection along the lines of: import com.foo.dao.UserDAO; @Spring private UserDAO userDAO; Meaning that for a bean defined in the applicationContext as . . . ref="entityManagerFactory" /> . . . I don't have to do anything else to utilize the bean. There is an added complexity in that I am using interfaces for the DAOs, ie. UserDAO implements IUserDAO. I've tried using different combinations of interface and dao, like the following import com.foo.dao.IUserDAO; import com.foo.dao.UserDAO; @Spring(name=userDAO) private IUserDAO userDAO; No matter what I've tried, userDAO remains unitialized. I have to resort to the following to get hold of the DAO... ApplicationContextapplicationContext = ((WicketApplication) Application.get()).getContext(); IUserDAOdao= UserDAO.getFromApplicationContext(applicationContext); Anyone have a guess at what I'm not doing correctly? I should note that in the main application class, the init makes the following call . . . addComponentInstantiationListener(new SpringComponentInjector(this)); And the entity manager is defined as follows . . . class ="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> ref="persistenceUnitManager"/> -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Field level Authorization strategy suggestions?
I'm building a database driven application. I've constructed LoadableDetachableModel for my entities, those LDMs then being presented in a Panel via a SortableDataProvider driven DefaultDataTable. I'd like to automatically expose additional functionality or field visibility depending on the authorization level of the user (session). For example, editable fields for "admin" users. At which point is it most appropriate to handle that? Should I somehow construct field(column) level models and encapsulate those in a higher- level model? Has anyone done something similar or is there an example somewhere that I'm overlooking? -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Reading files
On Jul 9, 2008, at 6:52 AM, greeklinux wrote: Hello, I do not know if it helps: Can you read the CSV file as Resource, get the IResourceStream, then getInputStream() on IResourceStream and put this inputStream in a java.io.InputStreamReader? Yeah, that's basically where I am. I thought maybe there was a way to simplify the process. Here's what I've have... IResourceStream resStream = new PackageResourceStream(WicketApplication.class, "protocols.csv"); InputStream inStream = resStream.getInputStream(); InputStreamReader isr = new InputStreamReader(inStream); List protocolList = new CSVReader(isr).readAll(); inStream.close(); I could collapse this a bit, but I need to keep hold of IResourceStream so that I can close it after the CSVReader.readAll() call. -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Reading files
I have a third party package that requires a java.io.Reader (or descendent) as an input. I need to provide a Reader for a file locate in either WEB-INF (or possibly package sourced). This file is a CSV list of items that is used to initialize a database table. I just need to iterate over it and send it off to my DAO. I've looked at a couple of options, but it seems like I'm traversing an inordinately large number of classes just to get hold of some type of Reader. Any suggestions on a wicket friendly, yet straightforward way to handle this type of activity? -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
1.3.4 == 1.3-SNAPSHOT?
Is 1.3.4 a "lock" of one of the 1.3-SNAPSHOTs? IE., if I've been using a snapshot, should I simply swap libraries out for 1.3.4? -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Wicket elements and character encoding
Does each wicket object attempt to set the character encoding for that objects output? I've been trying to track down what is causing GlassFish to generate a number of the following warnings... PWC4011: Unable to set request character encoding to UTF-8 from context /FilterRequest, because request parameters have already been read, or ServletRequest.getReader() has already been called I noticed that a particular group of warnings number the same as the number of Wicket objects (panels, pages, etc.) rendered for a particular view. It seems as though Wicket is attempting to set the encoding multiple times during an application run. Is that the case? -David Nedrow - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
PWC4011
Running GlassFish v2ur2 within NetBeans, I get a large number of the following messages from my application... PWC4011: Unable to set request character encoding to UTF-8 from context /FilterRequest, because request parameters have already been read, or ServletRequest.getReader() has already been called A new message is generated for each new page generated (via Wicket with Spring injection). Any pointers on what I need to do to make the application server happy? I have to admit, this appears to be cosmetic, but as I've noted on the list before, I hate not clearing warnings. -David Nedrow - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Contributing CSS with Panel components?
On Jun 17, 2008, at 7:07 PM, Matej Knopp wrote: Wicket detects the CSS being rendered and should load the CSS on fly using ajax. Of course you will not see the css link in the page source because it has been added later (and you only see the initial source). Aha. Thanks, that was it. I had expected to see a link similar to those generated earlier in the page tree. -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Contributing CSS with Panel components?
Hmm, Google is not being helpful. Is there a way to contribute CSS when a Panel is added to a page? I like the idea of keeping the CSS with the related class and html file, but have not figured out if it is possible to add CSS at render time for components contained in the page. IE., I have UserDetailsPanel.java, UserDetailsPanel.html, and UserDetailsPanel.css. If I include the panel in an AjaxTabbedPanel(), with UserDetailsPanel.java containing a HeaderContributor.forCss() pointing to UserDetailsPanel.css, the rendered page does not contain the css link. Frankly, this is what I would expect, given that the page header has already been rendered. Is this a circumstance in which I will need to contribute the CSS earlier in the process, or is there a mechanism that can be used to do this when the panel is rendered? -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
PasswordTextField model?
Given the following from the wicket security quickstart (1.3- SNAPSHOT)... add(new PasswordTextField("password").setOutputMarkupId(false)); glassfish generates the following message Couldn't resolve model type of Model:classname=[org.apache.wicket.model.CompoundPropertyModel $ AttachedCompoundPropertyModel ]:nestedModel = [Model:classname =[org.apache.wicket.model.CompoundPropertyModel]:nestedModel=[username = "regular"]] for [MarkupContainer [Component id = password, page = com.vzbi.ncs.argfrp.webapp.FilterRequest.app.LoginPage, path = 0:signInPanel:signInForm:password.PasswordTextField, isVisible = true, isVersioned = false]], please set the type yourself. Not setting the model does not seem to create a problem, but it would seem that the system would prefer that models be set where applicable. Is that the case? I have to admit, I'm a little anal about clearing all warnings in my apps. What would an appropriate model be for the above PasswordTextField()? Models seem to be the most poorly "exampled" Wicket feature, in that examples of Models rarely tell one why they are needed and what role they perform. It's generally, here's an example to make your code work. Clearly, in most cases the model contains the data for the markup. But what would that data be for a PasswordTextField()? One isn't normally going to pre-fill a password field, correct? Thanks, David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ClassCastException with ListView() SOLVED! Sort of.
It looks as though this is some subtlety (or brokenness) to GlassFish and Toplink. If I deploy my Wicket app as a module of a Java Enterprise package, it all works as expected. It's a simple workaround for now until I find out if it's a bug, or if I'm just not getting my Glassfish config correct. Basically, using NetBeans, I create a new "Enterprise Application", add my Wicket app as a Java EE module, then deploy. Et voila! In any case, I can move on for the moment. ;) -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ClassCastException with ListView()
On May 30, 2008, at 3:26 PM, James Carman wrote: Perhaps this thread will help you? http://forum.springframework.org/archive/index.php/t-29565.html I found a similar thread that basically dealt with the same thing, recommending org .springframework .instrument.classloading.glassfish.GlassFishLoadTimeWeaver for the weaver, but that causes the app to not be able to locate the class at all. I'll ask on the Spring forum. Thanks for all the help. Back when I get the Spring bit working with annotations. -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ClassCastException with ListView()
As an aside, this is clearly a configuration item for Spring. From my application context class = "org .springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager"> classpath:META-INF/persistence.xml class ="org.springframework.instrument.classloading.SimpleLoadTimeWeaver"/> This was derived from several JPA+Spring+Wicket examples. The weaver is non-optional with the way I've gotten this all working as far as it is. -David On May 30, 2008, at 3:20 PM, David Nedrow wrote: On May 30, 2008, at 2:26 PM, James Carman wrote: Take a look at what classloaders loaded each of the classes. If the class names are the same, then that means that they were loaded by two different classloaders. How are you setting up your application? Are all jars in your WEB-INF/lib directory? I added the following to just before line that causes the cast failure... java.lang.ClassLoader ctxCl = Thread.currentThread().getContextClassLoader(); java.lang.ClassLoader tcCl = Protocol.class.getClassLoader(); java.lang.ClassLoader soCl = item.getModelObject().getClass().getClassLoader(); System.out.println("ctxCl=" + ((ctxCl == null) ? "null" : ctxCl.toString())); System.out.println("tcCl=" + ((tcCl == null) ? "null" : tcCl.toString())); System.out.println("soCl=" + ((soCl == null) ? "null" : soCl.toString())); Below is the run output, which would appear to show WebAppClassloader for the target, and a Spring loader for the source. Isn't the whole point of Spring to do exactly that? Load classes dynamically? In any case, any suggestions, or should I hit the Spring forum now that it appear to be Spring specific? -David [TopLink Info]: 2008.05.30 03:07:21.737--ServerSession(878231)-- file:/Users/dnedrow/Developer/NetBeansProjects/FilterRequest/build/ web/WEB-INF/classes/-NetConfPU login successful finding all Protocol instances ctxCl=WebappClassLoader delegate: true repositories: /WEB-INF/classes/ --> Parent Classloader: EJBClassLoader : urlSet = [] doneCalled = false Parent -> [EMAIL PROTECTED] tcCl=WebappClassLoader delegate: true repositories: /WEB-INF/classes/ --> Parent Classloader: EJBClassLoader : urlSet = [] doneCalled = false Parent -> [EMAIL PROTECTED] soCl = org .springframework [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ClassCastException with ListView()
On May 30, 2008, at 2:26 PM, James Carman wrote: Take a look at what classloaders loaded each of the classes. If the class names are the same, then that means that they were loaded by two different classloaders. How are you setting up your application? Are all jars in your WEB-INF/lib directory? I added the following to just before line that causes the cast failure... java.lang.ClassLoader ctxCl = Thread.currentThread().getContextClassLoader(); java.lang.ClassLoader tcCl = Protocol.class.getClassLoader(); java.lang.ClassLoader soCl = item.getModelObject().getClass().getClassLoader(); System.out.println("ctxCl=" + ((ctxCl == null) ? "null" : ctxCl.toString())); System.out.println("tcCl=" + ((tcCl == null) ? "null" : tcCl.toString())); System.out.println("soCl=" + ((soCl == null) ? "null" : soCl.toString())); Below is the run output, which would appear to show WebAppClassloader for the target, and a Spring loader for the source. Isn't the whole point of Spring to do exactly that? Load classes dynamically? In any case, any suggestions, or should I hit the Spring forum now that it appear to be Spring specific? -David [TopLink Info]: 2008.05.30 03:07:21.737--ServerSession(878231)--file:/ Users/dnedrow/Developer/NetBeansProjects/FilterRequest/build/web/WEB- INF/classes/-NetConfPU login successful finding all Protocol instances ctxCl=WebappClassLoader delegate: true repositories: /WEB-INF/classes/ --> Parent Classloader: EJBClassLoader : urlSet = [] doneCalled = false Parent -> [EMAIL PROTECTED] tcCl=WebappClassLoader delegate: true repositories: /WEB-INF/classes/ --> Parent Classloader: EJBClassLoader : urlSet = [] doneCalled = false Parent -> [EMAIL PROTECTED] soCl = org .springframework [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ClassCastException with ListView()
On May 30, 2008, at 12:17 PM, Gwyn Evans wrote: Just to double-check Thomas's point (1), are there any of the jars being loaded from the AppServer's class-path rather than the Web-App's classpath? (What AppServer anyway?) No, the only thing "endorsed" is the mysql connector. This is running on GlasshFish v2. -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ClassCastException with ListView()
On May 30, 2008, at 12:20 PM, James Carman wrote: Protocol.class.equals(item.getModelObject().getClass()) Interesting, this returns false. -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ClassCastException with ListView()
On May 30, 2008, at 11:47 AM, Thomas Mäder wrote: 2) You're being done in by the BoundCompoundPropertyModel you have in the item. Fire up the debugger and check the values directly (relying on toString() is bad; some object might be lying to you. Step into the item.getModelObject(). After stepping into getModelObject(), I can clearly see that there is a list of protocol items containing expected data. -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ClassCastException with ListView()
On May 30, 2008, at 11:46 AM, Ryan Gravener wrote: How about changing PropertyListView to just ListView. I hadoriginally been using ListView, but switched to PropertyListView while trying to troubleshoot this problem. I had forgotten to roll that change back. Switching to ListView makes no difference in the behavior. -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ClassCastException with ListView()
On May 30, 2008, at 11:41 AM, James Carman wrote: On Fri, May 30, 2008 at 11:38 AM, David Nedrow <[EMAIL PROTECTED]> wrote: On May 30, 2008, at 11:20 AM, James Carman wrote: What is the type of item.getModelObject(). Have you run it through a debugger (or just simply put in a println)? Yes, I had done that first, thinking maybe I didn't understand how ListView worked via the Model. The object returned by item.getModelObject().toString() is... Try doing, item.getModelObject().getClass().toString() (unless that's what you meant to type). Sorry, that's what I had done but the getClass() didn't make it in to my message. ;) Can we see an example method from your DAO? What persistence library are you using (hibernate, jpa, jdo, etc.)? This is jpa via toplink. Here's the method I'm calling in the Protocol class (note that the logger does fire in findAll()) /** * Find all Protocol entities. * * @param rowStartIdxAndCount *Optional int varargs. rowStartIdxAndCount[0] specifies the the *row index in the query result-set to begin collecting the *results. rowStartIdxAndCount[1] specifies the the maximum *count of results to return. * @return List all Protocol entities */ @Transactional(readOnly = true) @SuppressWarnings("unchecked") @Override public List findAll(final int... rowStartIdxAndCount) { logger.info("finding all Protocol instances"); try { final String queryString = "select model from Protocol model"; return getJpaTemplate().executeFind(new JpaCallback() { @Override public Object doInJpa(EntityManager em) throws PersistenceException { Query query = em.createQuery(queryString); if ((rowStartIdxAndCount != null) && (rowStartIdxAndCount.length > 0)) { int rowStartIdx = Math.max(0, rowStartIdxAndCount[0]); if (rowStartIdx > 0) { query.setFirstResult(rowStartIdx); } if (rowStartIdxAndCount.length > 1) { int rowCount = Math.max(0, rowStartIdxAndCount[1]); if (rowCount > 0) { query.setMaxResults(rowCount); } } } return query.getResultList(); } }); } catch (RuntimeException re) { logger.error("find all failed", re); throw re; } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ClassCastException with ListView()
On May 30, 2008, at 11:20 AM, James Carman wrote: What is the type of item.getModelObject(). Have you run it through a debugger (or just simply put in a println)? Yes, I had done that first, thinking maybe I didn't understand how ListView worked via the Model. The object returned by item.getModelObject().toString() is... com.vzbi.ncs.argfrp.jpa.netconf.Protocol That's what baffles me about the cast exception. On Fri, May 30, 2008 at 11:16 AM, David Nedrow <[EMAIL PROTECTED]> wrote: I'm getting a cast exception when I attempt to pull a list element from the model. I may be mishandling how I'm using the model, but this is basically based on several tutorials I've looked at. (Note, as people have pointed out here, I use the "old fashioned" naming style for my interfaces and DAOs.) Anyone see a problem with the below code? public class ShowProtocolsPanel extends Panel { @SpringBean(name="ProtocolDAO") private IProtocolDAO dao; public ShowProtocolsPanel(String id) { super(id); IModel protocolsModel = new LoadableDetachableModel() { protected Object load() { return dao.findAll(); } }; add(new PropertyListView("eachItem", protocolsModel) { @Override protected void populateItem(ListItem item) { Protocol protocol = (Protocol) item.getModelObject(); item.add(new Label("keyword", protocol.getKeyword())); item.add(new Label("description", protocol.getDescription())); } }); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ClassCastException with ListView()
I'm getting a cast exception when I attempt to pull a list element from the model. I may be mishandling how I'm using the model, but this is basically based on several tutorials I've looked at. (Note, as people have pointed out here, I use the "old fashioned" naming style for my interfaces and DAOs.) Anyone see a problem with the below code? public class ShowProtocolsPanel extends Panel { @SpringBean(name="ProtocolDAO") private IProtocolDAO dao; public ShowProtocolsPanel(String id) { super(id); IModel protocolsModel = new LoadableDetachableModel() { protected Object load() { return dao.findAll(); } }; add(new PropertyListView("eachItem", protocolsModel) { @Override protected void populateItem(ListItem item) { Protocol protocol = (Protocol) item.getModelObject(); item.add(new Label("keyword", protocol.getKeyword())); item.add(new Label("description", protocol.getDescription())); } }); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sanity check. Can't inject DAO
On May 30, 2008, at 12:54 AM, Timo Rantalaiho wrote: On Thu, 29 May 2008, David Nedrow wrote: public class ProtocolDAO extends JpaDaoSupport implements IProtocolDAO ... public class ShowProtocolsPanel extends Panel { @SpringBean(name="ProtocolDAO") private ProtocolDAO dao; Clearly this should be IProtocolDao, so that the component depends on interface and not on implementation. So, you're saying it should be... @SpringBean(name="ProtocolDAO") private IProtocolDAO dao; When simply using the dao without injection, I would normally do something like... private IProtocolDAO dao = new ProtocolDAO(); Regardless, even pointing the dependency at the interface still yields a class cast exception. If it were a failure of the way I'm calling the DAO, I would assume that my class would fail inside the IModel declaration, right? IModel protocolModel = new LoadableDetachableModel() { protected Object load() { return dao.findAll(); } }; add(new ListView("eachItem", protocolModel) { @Override protected void populateItem(ListItem item) { Protocol protocol = (Protocol) item.getModelObject(); item.add(new Label("keyword", protocol.getKeyword())); item.add(new Label("description", protocol.getDescription())); } }); WicketMessage: Error attaching this container for rendering: [MarkupContainer [Component id = showProtoPanel, page = com.foo.pages.HomePage, path = 2:tabs:tabs:panel:tabs:panel:showProtoPanel.ShowProtocolsPanel, isVisible = true, isVersioned = true]] Root cause: java.lang.ClassCastException: com.vzbi.ncs.argfrp.jpa.netconf.Protocol at com.foo.pages.panels.ShowProtocolsPanel $2.populateItem(ShowProtocolsPanel.java:49) at org.apache.wicket.markup.html.list.ListView.onPopulate(ListView.java: 573) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sanity check. Can't inject DAO
On May 29, 2008, at 8:51 PM, James Carman wrote: I don't think the proxy stuff is your problem. Is your DAO class interface-based (it should be). Meaning, do you have a DAO interface that your implementation class implements (this part is key)? Yes, the classes are interface-based. Eg., public class ProtocolDAO extends JpaDaoSupport implements IProtocolDAO I think it's down to fiuring out what I've done wrong in my Panel. I get a classcastexception at the "(Protocol) item.getModelObject();" line. Listed below is both my Panel and the appropriate signature from ProtocolDAO.findAll(). public class ShowProtocolsPanel extends Panel { @SpringBean(name="ProtocolDAO") private ProtocolDAO dao; public ShowProtocolsPanel(String id) { super(id); IModel protocolModel = new LoadableDetachableModel() { protected Object load() { return dao.findAll(); } }; add(new ListView("eachItem", protocolModel) { @Override protected void populateItem(ListItem item) { final Protocol protocol = (Protocol) item.getModelObject(); item.add(new Label("keyword", protocol.getKeyword())); item.add(new Label("description", protocol.getDescription())); } }); } } public class ProtocolDAO extends JpaDaoSupport implements IProtocolDAO { ... @Transactional(readOnly = true) @SuppressWarnings("unchecked") @Override public List findAll(final int... rowStartIdxAndCount) { ... } ... } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sanity check. Can't inject DAO
On May 29, 2008, at 7:50 PM, David Nedrow wrote: On May 29, 2008, at 5:18 PM, Michael O'Cleirigh wrote: Hi David, Have you tried with naming the dao to be injected explicitly? i.e. @SpringBean (name="ProtocolDAO") private ProtocolDAO dao; Interesting. That seems to get me closer... org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'ProtocolDAO' must be of type [com.vzbi.ncs.argfrp.jpa.netconf.ProtocolDAO], but was actually of type [$Proxy30] Checking google... Looks like I may need to add 'proxy-target-class="true"' to my element. That gets me all the way to the actual data object, though there is a failure there I'll have to look at. Thanks for getting me pointed in the right direction. -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sanity check. Can't inject DAO
On May 29, 2008, at 5:18 PM, Michael O'Cleirigh wrote: Hi David, Have you tried with naming the dao to be injected explicitly? i.e. @SpringBean (name="ProtocolDAO") private ProtocolDAO dao; Interesting. That seems to get me closer... org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'ProtocolDAO' must be of type [com.vzbi.ncs.argfrp.jpa.netconf.ProtocolDAO], but was actually of type [$Proxy30] Checking google... -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Sanity check. Can't inject DAO
Could someone take a look at the following to see if they see any issues? I'm going to ask on the Spring forums as well, but they have a new requirement that you now must have created fifteen new threads in order to post anything with URLs or the @ sign. Urgh. So, using the panel below, the following is thrown... WicketMessage: Method onLinkClicked of interface org.apache.wicket.markup.html.link.ILinkListener targeted at component [MarkupContainer [Component id = link, page = com.foo.FilterRequest.pages.HomePage, path = 2:tabs:tabs:panel:tabs:tabs-container:tabs:1:link.TabbedPanel$5, isVisible = true, isVersioned = true]] threw an exception Root cause: java.lang.IllegalStateException: bean of type [com.foo.ProtocolDAO] not found I believe I have everything in place, config-wise. /* begin ShowProtocolsPanel.java */ public class ShowProtocolsPanel extends Panel { @SpringBean private ProtocolDAO dao; public ShowProtocolsPanel(String id) { super(id); IModel protocolModel = new LoadableDetachableModel() { protected Object load() { return dao.findAll(); } }; add(new ListView("eachItem", protocolModel) { @Override protected void populateItem(ListItem item) { final Protocol protocol = (Protocol) item.getModelObject(); item.add(new Label("keyword", protocol.getKeyword())); item.add(new Label("description", protocol.getDescription())); } }); } } /* end ShowProtocolsPanel.java */ http://java.sun.com/xml/ns/javaee"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd "> This application provides a web frontend to the ACL tool. Filter Request Tool Load the application context file for bean definitions, etc. contextConfigLocation /WEB-INF/applicationContext.xml Servlet 2.3 Filter that binds a JPA EntityManager to the thread for the entire processing of the request. Intended for the "Open EntityManager in View" pattern, i.e. to allow for lazy loading in web views despite the original transactions already being completed. lazyLoadingFilter class >org.springframework.orm.jpa.support.OpenEntityManagerInViewFilterfilter-class> Delegates Filter requests to a Spring-managed bean. Acegi HTTP Request Security Filter org.acegisecurity.util.FilterToBeanProxyfilter-class> Delegates Filter requests to a list of Spring-managed beans. targetClass org.acegisecurity.util.FilterChainProxyparam-value> Filter for initiating handling of Wicket requests. wicket-spring org.apache.wicket.protocol.http.WicketFilterfilter-class> Implementation of IWebApplicationFactory that pulls the WebApplication object out of spring application context applicationFactoryClassName value>org.apache.wicket.spring.SpringWebApplicationFactory Acegi HTTP Request Security Filter /frtool/* wicket-spring /frtool/* lazyLoadingFilter /frtool/* Bootstrap listener to start up Spring's root WebApplicationContext. Simply delegates to ContextLoader. org.springframework.web.context.ContextLoaderListener 30 http://www.springframework.org/schema/beans"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:tx="http://www.springframework.org/schema/tx"; xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd";> class="org.springframework.orm.jpa.JpaTransactionManager"> ref="entityManagerFactory"/> class = "org .springframework .dao.annotation.PersistenceExceptionTranslationPostProcessor"/> class = "org .springframework .orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/> class = "org .springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager"> classpath:META-INF/persistence.xml class ="org.springframework.instrument.classloading.SimpleLoadTimeWeaver"/> class="com.foo.FilterRequest.application.FilterRequestApplication"> ref="authenticationManager"/> class="org.acegisecu
Re: Buehler? Packaged resources
On May 25, 2008, at 12:42 PM, Igor Vaynberg wrote: On Sun, May 25, 2008 at 9:05 AM, David Nedrow <[EMAIL PROTECTED]> wrote: What problems do packaged resources address? they address encapsulation. suppose you want to use a 3rd party component in your webapp... in most other frameworks you would have to put the jar on the classpath, than copy js/css/html resources the component needs to some in wicket the only step is to put the jar on the classpath. since everything the component needs is packaged in the jar it can immediately start working. OK, that make sense. Thanks for the info. -David. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Buehler? Packaged resources
OK, I asked about this earlier, but maybe the question didn't make sense. Asking another, and perhaps better, way: What problems do packaged resources address? I'm unsure as to why I would encapsulate resources in the package, rather than using them as I normally would via the WEB-INF tree. It seems as though encapsulating them would present a problem with separation of concerns, in which one team might be focusing just on presentation (eg. CSS, etc.) while another handles just the Java code. Using packaged resources would seem to require that the presentation people have access not only to the sources, but also to the dev platform to rebuild the package just to test CSS changes. -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Benefit of JavaScriptReference, etc..?
Is there any benefit to using something like JavaScriptReference? It seems as though doing so would create a tight binding between the UI and the application, kind of negating what I think is one of the main benefits of Wicket. That being, UI people can work on straight HTML, while the app developers work on the Java side. -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Background image that resizes with window?
On May 23, 2008, at 1:46 PM, John Krasnay wrote: On Fri, May 23, 2008 at 11:57:48AM -0400, David Nedrow wrote: Might be your CSS. Is your image styled as position:absolute? (Again, nothing to with Wicket...) The odd thing is that I can get this going with zero problem using a static HTML mockup, but it refuses to work via Wicket generated pages. You can see a working sample by grabbing: http://nedron.net/bgtest.zip When I try to use this in a Wicket page, I'm getting a JavaScript error noting: "Value undefined (result of expression $(window).width) is not object." and the image doesn't resize with the window. I'm clearly missing some subtlety here. -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Detachable confusion
Assume the following... v @Entity @Table(name = "user", catalog = "blah") public class User implements java.io.Serializable { private Long id; private String name; // getters/setters for both } public interface IUserDAO { // public void save/delete/findAll/etc } public class UserDAO implements IUserDAO { private EntityManager getEntityManager() { return EntityManagerHelper.getEntityManager(); } public void save(User entity) { EntityManagerHelper.log("saving User instance", Level.INFO, null); try { getEntityManager().persist(entity); EntityManagerHelper.log("save successful", Level.INFO, null); } catch (RuntimeException re) { EntityManagerHelper.log("save failed", Level.SEVERE, re); throw re; } } //etc } If I want to display the Users in a table contained in a re-usable Panel(), should I be able to do something like... public final class UserListPanel extends Panel { public UserListPanel(String id) { super(id); // Create a detachable model IModel users = new LoadableDetachableModel() { @SpringBean UserDAO dao; @Override protected Object load() { return dao.findAll(); } return users; }; IColumn[] columns = { new PropertyColumn(new Model("ID"), "id"), new PropertyColumn(new Model("Name"), "name") }; SomeTableType dataTable = new SomeTableType(users); add(dataTable); } } Part of my confusion comes from trying to work in a SortableDataProvider to use with a DefaultDataTable with columns sortable by header () links. -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Background image that resizes with window?
On May 23, 2008, at 11:20 AM, Igor Vaynberg wrote: dont really see what this has to do with wicket...sounds like you are after some javascript. I have the JavaScript, but I was having trouble with other Wicket elements being shunted aside by the image. I'll poke around again. -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Background image that resizes with window?
I'd like to use an SVG file for a background image on every page. I'd like the image to fill 100% of the browser window and have it automatically resize if/when the user changes the size of the client window. This clearly can't be done via CSS2 (maybe via CSS3?), so I'm looking for anyone who has a programmatic solution doing it the "Wicket Way". BTW, I don't have a problem using CSS3 if necessary, since this is for internal users and I know exactly which browsers are available (IE7, FireFox 3RC1, Safari 3). Here's a pretty good example of what I'm after http://whatstheweather.net/ The page is using jquery, but if I try to use an link in the page, it pushes all of my other content below the image. Here's more information on what's being done on that page... http://css-tricks.com/how-to-resizeable-background-image/ Ideas, comments? -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OK, more JPA questions
First, thanks for the help. Item 1 implemented via @SpringBean(name = "blah"). ;) On May 16, 2008, at 3:31 PM, Igor Vaynberg wrote: there are basically two things that you need no matter what web framework you are integrating with: 1) a way to lookup your dao singleton wicket-ioc allows you to quickly build an annotation based injection 2) a way to scope the entity manager to request you need this so that lazy loading works. you are already doing this with a threadlocal already, the only thing you need to do is to wire in that closeEntityManager() call. you can either do this with a servlet filter that sits around the wicket filter, or you can hook into wicket's requestcycle and do it from there. there are really no advantages either way. I'll ask for help with this bit on the Spring list to help avoid clutter here. The filter route sounds like want I want, as I would prefer to keep as much of the "bookkeeping" as possible out of the application logic. -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
OK, more JPA questions
There doesn't seem to be one recommended way to inject/use JPA-based utility archives in Wicket. It looks as though most of it is based around Spring, which is fine, yet adds another app layer. I've generated a tiny Derby db using the JPA facilities provided by MyEclipse. The sources can be found at: http://nedron.net/JpaTest.jar A binary "library" was created, including the default generated persistence.xml file and can be downloaded at: http://nedron.net/JpaTest-bin.jar I think more people than just me would find it useful if someone could use this extremely simple database in a simple, single page Wicket app. Note that I have zero problem using this type of library in a standalone Java app, and given that I'm relatively new to Wicket, I don't want to go to a bunch of effort only to find that I've gone about it the wrong way. Basic questions... Do I need to get hold of the com.foo.jpa.JpaNet.EntityManagerHelper in the main WicketApplication class and then serve that out to pages and panels as needed? The question here is, do I need EntityManagerHelper transaction wrappers around my DAO operations? Or is that handled auto- magically by some other mechanism (JTA)? I guess what I'm really getting at is, what is the recommended way to use the library directly without extracting it? All of the examples I've found so far include the dao/etc. along with the app code, so there is no clear indication as to how a "third- party" java library is used in Wicket(/Spring). And many examples and much of the documentation is remarkably framdibulous, along the lines of "What is session managed? Session managed is not container managed. What is container managed? Container managed is not session managed." I've gotten myself pretty confused on this, as you can tell. ;) -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
JPA suggestions?
I have a data "driver" package built around JPA and an Entity Manager Factory (javax.persistence.EntityManagerFactory). This is currently used by a couple of standalone applications and works well. What is the best way to leverage this package in the context of a Wicket-based web application? IE., how best to instantiate the factory (if necessary) and/or use the DAOs. Should this happen at the wicket application level, or somehow page/panel-based? Thanks for any pointers, -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: TestingAuthenticationToken and AbstractAuthenticationToken
On May 7, 2008, at 2:55 AM, Maurice Marrink wrote: The 1.3.1-SNAPSHOT is not the latest snapshot, i should probably delete it from the repo. The latest version is 1.3-SNAPSHOT. D'oh! Thanks. -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: TestingAuthenticationToken and AbstractAuthenticationToken
On May 6, 2008, at 1:17 PM, Maurice Marrink wrote: SwarmPolicyFileHiveFactory is new in 1.3.1 due to a separation of dependencies. It is equivalent to the old PolicyFileHiveFactory and should be used instead if you are using 1.3.1 code. Odd. I'm using 1.3.1-SNAPSHOT that I grabbed today (jar files) and there is no SwarmPolicyFileHiveFactory class in it. Not a big deal if I can just swap in the old PolicyFileHiveFactory. Thanks, David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: TestingAuthenticationToken and AbstractAuthenticationToken
Olger, On May 6, 2008, at 12:59 AM, Olger Warnier wrote: Hi David & James, I had the same issue, tried to get an idea on how to use acegi with wicket. Based on the samples , I made my own test that uses acegi for authentication and swarm for the authorization. Cool, thanks for the clear example. One item of note for me is the use of SwarmPolicyFileHiveFactory. So far as I can see, this doesn't exist in swarm 1.3 (released), and I didn't see it browsing the 1.3.x source tree. Is this a deprecated class, or something I'm overlooking? -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
TestingAuthenticationToken and AbstractAuthenticationToken
Using bits of the examples provided in wicket-security, I have the following method define in AcegiLoginContext... private AbstractAuthenticationToken token; public AcegiLoginContext(AbstractAuthenticationToken token) { this.token = token; } Again, following the examples, I call the previous method from my login page as follows LoginContext ctx = AcegiLoginContext(new TestingAuthenticationToken(username, password, getAuthorities(username, password))); However, the compiler (and NetBeans) complains that AcegiLoginContext(TestingAuthenticationToken, ...) isn't a valid method. NetBeans suggests creating the method. But given that these are drawn from the (presumably) working examples, what is the issue? TestingAuthenticationToken extends AbstractAuthenticationToken, so shouldn't it be acceptable as input to AcegiLoginContext(AbstractAuthenticationToken token)? My brain is so twisted around trying to find the relevant parts of the example that I must be missing something. I feel like Dr. Thorndyke from High Anxiety, falling into a swirling morass of interleaved code. ;) -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
I give, anyone have a simplified (standalone) Acegi example
I'm adding Acegi support to a Wicket project, but have been completely unable to get all the pieces correct. One of the main problems is that there appears to be no standalone example available. The acegi- security examples are awful, since all thirty of the samples are mixed with each other and re-use components, needlessly complicating each example. IE., there's no way to see what is actually required for a specific example. The online guides (eg.http://wicketstuff.org/confluence/display/STUFFWIKI/Swarm+and+Acegi+HowTo ) refer to existing mixed examples without providing a full sample. Has anyone seen an Acegi+Wicket example that is: 1) Targeted at implementing Acegi in Wicket 2) Contains all the sample sources in a self-contained tree -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Status of acegi/wasp/swarm?
We use acegi for one purpose, and that is to authenticate and authorize (AA) against our corporate SiteMinder server. We have existing Spring-based applications that successfully auth against SiteMinder via acegi. We're starting a new project and are planning to use Wicket. It looks as though one currently has to use some Spring bridging to inject acegi into a Wicket application. Are there plans to replicate the functionality of acegi as it relates to AA? Basically, is there, or wlll there be, a means for me to authenticate/ authorize/etc against something like SiteMinder without having to slide in bits of Spring to do it? -David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]