Évitez la sérialisation des pages avec Wicket
wicket 7(.10)
Lors du traitement de données avec un niveau de sécurité élevé, telles que les pages de paiement et les pages d'enregistrement d'informations personnelles (** Même si cryptées **) Vous pouvez ne pas vouloir que les données soient enregistrées (devraient).
VoidPageManagerProvider
VoidPageManagerProvider.java
public class VoidPageManagerProvider extends DefaultPageManagerProvider {
protected IPageManagerContext pageManagerContext;
protected IPageManager pageManager;
/**
* @param application
*/
public VoidPageManagerProvider(Application application) {
super(application);
pageManagerContext = new DefaultPageManagerContext();
IDataStore dataStore = newDataStore();
IPageStore pageStore = newPageStore(dataStore);
pageManager = new VoidPageStoreManager(application.getName(), pageStore, pageManagerContext);
}
@Override
public IPageManager get(IPageManagerContext pageManagerContext) {
return pageManager;
}
@Override
public IPageStore newPageStore(IDataStore dataStore) {
return new VoidPageStore();
}
@Override
public IDataStore newDataStore() {
return new VoidDataStore();
}
}
VoidPageStore.java
public class VoidPageStore implements IPageStore {
/**
* constructor
*/
public VoidPageStore() {
}
/* (Non-Javadoc)
* @see org.apache.wicket.pageStore.IPageStore#destroy()
*/
@Override
public void destroy() {
}
/* (Non-Javadoc)
* @see org.apache.wicket.pageStore.IPageStore#getPage(java.lang.String, int)
* @param sessionId
* @param pageId
* @return
*/
@Override
public IManageablePage getPage(String sessionId, int pageId) {
// nothing
return null;
}
/* (Non-Javadoc)
* @see org.apache.wicket.pageStore.IPageStore#removePage(java.lang.String, int)
* @param sessionId
* @param pageId
*/
@Override
public void removePage(String sessionId, int pageId) {
}
/* (Non-Javadoc)
* @see org.apache.wicket.pageStore.IPageStore#storePage(java.lang.String, org.apache.wicket.page.IManageablePage)
* @param sessionId
* @param page
*/
@Override
public void storePage(String sessionId, IManageablePage page) {
}
/* (Non-Javadoc)
* @see org.apache.wicket.pageStore.IPageStore#unbind(java.lang.String)
* @param sessionId
*/
@Override
public void unbind(String sessionId) {
}
/* (Non-Javadoc)
* @see org.apache.wicket.pageStore.IPageStore#prepareForSerialization(java.lang.String, java.io.Serializable)
* @param sessionId
* @param page
* @return
*/
@Override
public Serializable prepareForSerialization(String sessionId, Serializable page) {
return null;
}
/* (Non-Javadoc)
* @see org.apache.wicket.pageStore.IPageStore#restoreAfterSerialization(java.io.Serializable)
* @param serializable
* @return
*/
@Override
public Object restoreAfterSerialization(Serializable serializable) {
return null;
}
/* (Non-Javadoc)
* @see org.apache.wicket.pageStore.IPageStore#convertToPage(java.lang.Object)
* @param page
* @return
*/
@Override
public IManageablePage convertToPage(Object page) {
return null;
}
}
VoidDataStore.java
public class VoidDataStore implements IDataStore {
/**
* constructor
*/
public VoidDataStore() {
}
/* (Non-Javadoc)
* @see org.apache.wicket.pageStore.IDataStore#getData(java.lang.String, int)
* @param sessionId
* @param id
* @return
*/
@Override
public byte[] getData(String sessionId, int id) {
// nothing
return null;
}
/* (Non-Javadoc)
* @see org.apache.wicket.pageStore.IDataStore#removeData(java.lang.String, int)
* @param sessionId
* @param id
*/
@Override
public void removeData(String sessionId, int id) {
}
/* (Non-Javadoc)
* @see org.apache.wicket.pageStore.IDataStore#removeData(java.lang.String)
* @param sessionId
*/
@Override
public void removeData(String sessionId) {
}
/* (Non-Javadoc)
* @see org.apache.wicket.pageStore.IDataStore#storeData(java.lang.String, int, byte[])
* @param sessionId
* @param id
* @param data
*/
@Override
public void storeData(String sessionId, int id, byte[] data) {
}
/* (Non-Javadoc)
* @see org.apache.wicket.pageStore.IDataStore#destroy()
*/
@Override
public void destroy() {
}
/* (Non-Javadoc)
* @see org.apache.wicket.pageStore.IDataStore#isReplicated()
* @return
*/
@Override
public boolean isReplicated() {
return true;
}
/* (Non-Javadoc)
* @see org.apache.wicket.pageStore.IDataStore#canBeAsynchronous()
* @return
*/
@Override
public boolean canBeAsynchronous() {
return true;
}
}
VoidPageStoreManager.java
public class VoidPageStoreManager extends PageStoreManager {
/**
* @param applicationName
* @param pageStore
* @param context
*/
public VoidPageStoreManager(String applicationName, IPageStore pageStore, IPageManagerContext context) {
super(applicationName, pageStore, context);
}
@Override
public boolean supportsVersioning() {
return false;
}
}
WicketApplication.java
// page manager
setPageManagerProvider(new VoidPageManagerProvider(this));
Plus d'erreurs sans outils Sérialisable