Wicket integration with Spring ldap

2013-11-04 Thread Selom
Hello,
I am crushing with my hairs  with the following problem.


 I don't  know why Wicket won't instantiate my ldap bean.

 
Here is the *web.xm*l


?xml version=1.0 encoding=ISO-8859-1?
web-app xmlns=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;
version=2.5

display-nameamemet/display-name




context-param
param-nameconfiguration/param-name
param-valuedevelopment/param-value
/context-param


context-param
param-namecontextConfigLocation/param-name
param-valueclasspath:applicationContext.xml/param-value
/context-param



filter
filter-namewicket.amemet/filter-name

filter-classorg.apache.wicket.protocol.http.WicketFilter/filter-class
init-param
param-nameapplicationClassName/param-name

param-valueorg.univ.amemet.ApplicationAmemet/param-value 
/init-param
/filter

filter
filter-nameSpringContext/filter-name

filter-classorg.apache.wicket.protocol.http.WicketFilter/filter-class
init-param
param-nameapplicationFactoryClassName/param-name

param-valueorg.apache.wicket.spring.SpringWebApplicationFactory/param-value
/init-param
/filter


filter-mapping
filter-namewicket.amemet/filter-name
url-pattern/*/url-pattern
/filter-mapping

filter-mapping
filter-nameSpringContext/filter-name
url-pattern/*/url-pattern
dispatcherREQUEST/dispatcher
dispatcherINCLUDE/dispatcher
/filter-mapping


listener
listener-class
 org.springframework.web.context.ContextLoaderListener
/listener-class
/listener




 
filter
filter-nameOpenEntityManagerInViewFilter/filter-name
   
filter-classorg.springframework.orm.jpa.support.OpenEntityManagerInViewFilter/filter-class
/filter
filter-mapping
filter-nameOpenEntityManagerInViewFilter/filter-name
url-pattern/*/url-pattern
/filter-mapping 
 
/web-app






in maven  /src/main/resources   a piece of   my * applicationContext.xml* .


 
 ?xml version=1.0 encoding=UTF-8?
beans xmlns=http://www.springframework.org/schema/beans;
xmlns:p=http://www.springframework.org/schema/p;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xmlns:context=http://www.springframework.org/schema/context;
xmlns:tx=http://www.springframework.org/schema/tx;
xsi:schemaLocation=
   http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
   http://www.springframework.org/schema/context
  
http://www.springframework.org/schema/context/spring-context-3.0.xsd
   http://www.springframework.org/schema/tx
  
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd;
   
   
   
   
context:annotation-config/
tx:annotation-driven/

context:component-scan base-package=org.amemet /

 context:component-scan base-package=org.univ.amemet /
context:component-scan
base-package=org.springframework.ldap/context:component-scan

import resource=classpath:ldap.xml/


bean id=applicationAmemet class=org.univ.amemet.ApplicationAmemet

 

/beans



and the ldap.xml


 ?xml version=1.0 encoding=UTF-8?
beans xmlns=http://www.springframework.org/schema/beans;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation=http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans.xsd;

bean id=contextSource

class=org.springframework.ldap.pool.factory.PoolingContextSource
property name=contextSource ref=contextSourceTarget /
property name=dirContextValidator ref=dirContextValidator 
/
property name=testOnBorrow value=true /
property name=testWhileIdle value=true /
/bean

bean id=dirContextValidator

class=org.springframework.ldap.pool.validation.DefaultDirContextValidator
/
bean id=contextSourceTarget

Re: Wicket integration with Spring ldap

2013-11-04 Thread Martin Grigorov
Hi,


On Mon, Nov 4, 2013 at 12:08 PM, Selom pierre.kou...@uhb.fr wrote:

 Hello,
 I am crushing with my hairs  with the following problem.


  I don't  know why Wicket won't instantiate my ldap bean.


 Here is the *web.xm*l


 ?xml version=1.0 encoding=ISO-8859-1?
 web-app xmlns=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;
 version=2.5

 display-nameamemet/display-name




 context-param
 param-nameconfiguration/param-name
 param-valuedevelopment/param-value
 /context-param


 context-param
 param-namecontextConfigLocation/param-name
 param-valueclasspath:applicationContext.xml/param-value
 /context-param



 filter
 filter-namewicket.amemet/filter-name

 filter-classorg.apache.wicket.protocol.http.WicketFilter/filter-class
 init-param
 param-nameapplicationClassName/param-name

 param-valueorg.univ.amemet.ApplicationAmemet/param-value
 /init-param
 /filter

 filter
 filter-nameSpringContext/filter-name

 filter-classorg.apache.wicket.protocol.http.WicketFilter/filter-class
 init-param

 param-nameapplicationFactoryClassName/param-name


 param-valueorg.apache.wicket.spring.SpringWebApplicationFactory/param-value
 /init-param
 /filter


You need just one declaration of WicketFilter in web.xml.
You need SpringWebApplicationFactory when you want the WebApplication
implementation to be a Spring bean. Otherwise the setup with
'applicationClassName' is enough.
Remove the second filter and the problem will disappear, I think.

You can take a look at
https://github.com/jWeekend/LegUp/tree/master/wicket-spring-jpa. It shows
how to setup Wicket+Spring with annotation based (@Configuration) based
config but the rest is the same.




 filter-mapping
 filter-namewicket.amemet/filter-name
 url-pattern/*/url-pattern
 /filter-mapping

 filter-mapping
 filter-nameSpringContext/filter-name
 url-pattern/*/url-pattern
 dispatcherREQUEST/dispatcher
 dispatcherINCLUDE/dispatcher
 /filter-mapping


 listener
 listener-class
  org.springframework.web.context.ContextLoaderListener
 /listener-class
 /listener





 filter
 filter-nameOpenEntityManagerInViewFilter/filter-name


 filter-classorg.springframework.orm.jpa.support.OpenEntityManagerInViewFilter/filter-class
 /filter
 filter-mapping
 filter-nameOpenEntityManagerInViewFilter/filter-name
 url-pattern/*/url-pattern
 /filter-mapping

 /web-app






 in maven  /src/main/resources   a piece of   my * applicationContext.xml* .



  ?xml version=1.0 encoding=UTF-8?
 beans xmlns=http://www.springframework.org/schema/beans;
 xmlns:p=http://www.springframework.org/schema/p;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xmlns:context=http://www.springframework.org/schema/context;
 xmlns:tx=http://www.springframework.org/schema/tx;
 xsi:schemaLocation=
http://www.springframework.org/schema/beans

 http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context

 http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx

 http://www.springframework.org/schema/tx/spring-tx-3.0.xsd;




 context:annotation-config/
 tx:annotation-driven/

 context:component-scan base-package=org.amemet /

  context:component-scan base-package=org.univ.amemet /
 context:component-scan
 base-package=org.springframework.ldap/context:component-scan

 import resource=classpath:ldap.xml/


 bean id=applicationAmemet class=org.univ.amemet.ApplicationAmemet



 /beans



 and the ldap.xml


  ?xml version=1.0 encoding=UTF-8?
 beans xmlns=http://www.springframework.org/schema/beans;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:schemaLocation=http://www.springframework.org/schema/beans

 http://www.springframework.org/schema/beans/spring-beans.xsd;

 bean id=contextSource

 class=org.springframework.ldap.pool.factory.PoolingContextSource
 property name=contextSource ref=contextSourceTarget /
 property name=dirContextValidator
 ref=dirContextValidator /
 property name=testOnBorrow value=true /
 property name=testWhileIdle value=true /
 /bean

 bean id=dirContextValidator

 

Re: AjaxButton submit issue in GAE

2013-11-04 Thread luiss184
Sorry, i am not able to provide the url since it is an internal application
and corporate email is needed to be part of it.

 Here is the code:


public class PostPanel extends Panel {

  private static final Logger log =
LoggerFactory.getLogger(PostPanel.class);
  private static final Long MAX_FILE_LENGTH = new Long(1048576);
  private static final long serialVersionUID = 4297044401384008810L;
  private static final IValidatorInteger MINIMUM_VALIDATOR = new
RangeValidatorInteger(
  new Integer(0), new Integer());
  private static final IValidatorShort MINIMUM_VALIDATOR_SHORT = new
RangeValidatorShort(
  new Short((short) 0), new Short((short) 99));
  private static final StringValidator TITLE_VALIDATOR = StringValidator
  .lengthBetween(3, 100);
  private static final StringValidator DESCRIPTION_VALIDATOR =
StringValidator
  .lengthBetween(3, 500);

  @Inject
  private PostService postService;

  @Inject
  private CategoryService categoryService;

  private ListFileUpload photos;
  private Post post;
  private boolean editing = false;
  private final Component feedback;
  private String fileFeedbackMessage;


  /**
   * Constructor.
   * 
   * @param id
   * @param post
   */
  public PostPanel(String id, final Post post) {
super(id);

// if not editing create a new empty post
if (post == null) {
  MyAuthSession session = (MyAuthSession) WebSession.get();
  this.post =
this.postService.createPostInstance(session.getCurrentUser());
} else {
  this.post = post;
  editing = true;
}

add(this.createFormTitle());

feedback = new FeedbackPanel(feedback);
feedback.setOutputMarkupPlaceholderTag(true);

final StatelessFormPost form = new
StatelessFormPost(createPostForm,
new CompoundPropertyModelPost(this.post));
form.add(feedback);
form.setMultiPart(true);
form.add(this.createTitleTextField());
form.add(this.createPriceTextField());
form.add(this.createCurrencySelect());
form.add(this.createPhotoPanel());
form.add(this.createFileUploader());
form.add(this.createDescriptionTextArea());
form.add(this.createPostButton());
form.add(new ExternalLink(cancelLink, /my-posts?operation=ALL));
form.add(createCategoryDropDownChoice());
form.add(createConditionSelectOption());

this.add(form);
  }

  public String getFileFeedbackMessage() {
return fileFeedbackMessage;
  }

  public void setFileFeedbackMessage(String fileFeedbackMessage) {
this.fileFeedbackMessage = fileFeedbackMessage;
  }

  public void copyPost(Post post) {
this.post.setPrice(post.getPrice());
this.post.setCurrency(post.getCurrency());
this.post.setPriceNatural(post.getPrice().intValue());
this.post.setPriceDecimal(post.getPrice().shortValue());
this.post.setTitle(post.getTitle());
this.post.setQuantity(post.getQuantity());
this.post.setDescription(post.getDescriptionSaved());
this.post.setDescriptionSaved(post.getDescriptionSaved());
this.post.setCategory(post.getCategory());
this.post.setCondition(post.getCondition());
BinaryInformation photo = post.getPhoto();
this.post.addPhoto(new BinaryInformation(photo.getContent(), photo
.getName(), photo.getContentType(), photo.getContent().length));
this.post.addThumbnail(new BinaryInformation(photo.getContent(),
kea_thumbnail_ + photo.getName(), photo.getContentType(), photo
.getContent().length));
  }

  private SelectString createConditionSelectOption() {
// Condition Drop Down Choice
SelectString condition = new SelectString(condition);
condition.add(new SelectOptionString(new, new
ModelString(new)));
condition.add(new SelectOptionString(used, new
ModelString(used)));
return condition;
  }

  private DropDownChoiceVoid createCategoryDropDownChoice() {

final ListCategory categoryList = categoryService.getCategories();
ListLong catIds = new ArrayListLong();

// Categories Drop Down Choice
for (Category cat : categoryList) {
  catIds.add(cat.getId());
}
@SuppressWarnings(unchecked)
DropDownChoiceVoid catDropDownChoice = new DropDownChoice(
categoriesDropDown, new PropertyModel(this.post, categoryId),
catIds, new ChoiceRendererLong() {
  @Override
  public String getDisplayValue(Long catId) {
for (Category cat : categoryList) {
  if (cat.getId().equals(catId)) {
return cat.getName();
  }
}
return Select one!;
  }

  @Override
  public String getIdValue(Long catId, int index) {
return catId.toString();
  }
}) {

};
catDropDownChoice.setRequired(true).setEscapeModelStrings(false);

return catDropDownChoice;

  }

  private SelectString createCurrencySelect() {
// TODO get the currency from a property file
SelectString currency = new SelectString(currency);

Re: Cannot get to desired error page on handling RuntimeException in AbstractRequestCycleListener#onException()

2013-11-04 Thread dgn
I'm using Wicket 6.

As you can see I'm already using new PageProvider(new CustomErrorPage())
when I get the runtime exception I'm targeting.

What I'm wondering and perhaps don't understand fully is the Wicket request
lifecycle. What is causing the callback to onException() multiple times? The
first time I'm unwrapping the desired exception but subsequently it's a
PageExpiredException. I'm pretty sure my CustomErrorPage is stateless so
don't understand why the additional exceptions. Any suggestions?



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Cannot-get-to-desired-error-page-on-handling-RuntimeException-in-AbstractRequestCycleListener-onExce-tp4662078p4662109.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 integration with Spring ldap

2013-11-04 Thread Selom
Hi,
I removed the SpringContext filter but still got the same error .

Then I changed  the configuration based on  the  how to setup Wicket+Spring
with annotation based (@Configuration)
https://github.com/jWeekend/LegUp/tree/master/wicket-spring-jpa   of
yours.

@Configuration
@EnableTransactionManagement(proxyTargetClass = true)
public class Config {


 
 @Bean
 public ILdapComposanteDao ldapComposanteDao() {
 ILdapComposanteDaoImpl iLdapComposanteDaoImpl = new
ILdapComposanteDaoImpl();
 iLdapComposanteDaoImpl.setLdapTemplate(ldapTemplate());
 
 return iLdapComposanteDaoImpl;
 }

 @Bean
 public LdapTemplate ldapTemplate(){
 return new LdapTemplate(contextSource());
 }
 
 
 @Bean
 public  DefaultDirContextValidator dirContextValidator (){
 return new DefaultDirContextValidator();
 }
 

 @Bean
 public  PoolingContextSource contextSource(){
 PoolingContextSource pc= new PoolingContextSource();
 pc.setContextSource(contextSourceTarget());
 pc.setDirContextValidator(dirContextValidator());
 pc.setTestOnBorrow(true);
 pc.setTestWhileIdle(true);
 
 return pc;
 }
 
 @Bean
 public  LdapContextSource contextSourceTarget(){
 LdapContextSource ldapContextSource = new LdapContextSource();
 ldapContextSource.setUrl(blablabla);
 ldapContextSource.setBase(dc=xx,dc=xx,dc=fr);
 ldapContextSource.setUserDn(cn=...,ou=,dc=...,dc=...,dc=fr);
 ldapContextSource.setPassword(pwss);
 return ldapContextSource;
 }
 
 
 

}


And I work as expected .

Thanks you very much  .




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-integration-with-Spring-ldap-tp4662097p4662110.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: Component detecting Ajax update

2013-11-04 Thread Bas Gooren
And from within the component itself you can override onEvent and handle 
the event whose payload is an AjaxRequestTarget.
The component can then check if it's in the getComponents() collection 
of said target.


e.g.

@Override
public void onEvent( IEvent ?  event )
{
Object payload = event.getPayload();

if( payload instanceof AjaxRequestTarget )
{
AjaxRequestTarget target = (AjaxRequestTarget) payload;
if(target.getComponents().contains(this)) {
 // your logic goes here
}
}
}

Met vriendelijke groet,
Kind regards,

Bas Gooren

schreef Martin Grigorov op 4-11-2013 8:27:

Hi,

You can use
org.apache.wicket.ajax.AjaxRequestTarget.IListener#onBeforeRespond(MapString,
Component map, AjaxRequestTarget) to be notified before ART starts
preparing its XML response.
The 'map' contains all already added components.



On Fri, Nov 1, 2013 at 3:45 PM, Nick Pratt nbpr...@gmail.com wrote:


Is there a way for a Component to detect if its been added to an
AjaxRequestTarget?

N





Re: Blogging platform written in Wicket?

2013-11-04 Thread Martijn Dashorst
On Mon, Nov 4, 2013 at 5:02 PM, Decebal Suiu decebal.s...@asf.ro wrote:
 Is anyone on this forum who sees value for a blogging system/framework in
 wicket?

In the very least it would probably make testing our releases better
if we could somehow integrate this with travisci and our staging
repository. No idea how to make that work though...

More automated release testing is better IMO.

Martijn

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