Hi,

On Tue, Jan 15, 2013 at 7:59 PM, Oscar Besga Arcauz <obe...@isdefe.es>wrote:

>
>
> I use these code in order to avoid web page cache, in browser and in
> wicket application;
> also I want to avoid disk caching and serialization
>
> I'm using Wicket6
>
>
> ¿ Do you see this code correct ? ¿ Is there any easier way to accomplish
> this ?
>
> /**
>  * App
>  */
> public class MyApplication extends WebApplication {
>     @Override
>     public void init() {
>         super.init();
>         setPageManagerProvider(new MyPageManagerProvider(this));
>     }
>
>     /**
>      * shall not save
>      */
>     private class MyPageManagerProvider extends DefaultPageManagerProvider
> {
>
>         private MyPageManagerProvider(Application application) {
>             super(application);
>         }
>
>
>         @Override
>         protected IDataStore newDataStore() {
>             // guardamos tod o en memoria
>             return new HttpSessionDataStore(new
> DefaultPageManagerContext(), new PageNumberEvictionStrategy(0));
>

You can use getStoreSettings#setMaxSizePerSession(Bytes.bytes(1))  with the
default DiskDataStore too.
But your approach is better because this way you don't do IO operations.


>         }
>
>     }
>
> }
>
>
>
> /******************************************************************************************/
>
> /**
>  * Web Page
>  */
> public class MyPage extends WebPage {
>
>     @Override
>     protected void setHeaders(WebResponse response) {
>         super.setHeaders(response);
>         response.setHeader("X-Frame-Options","deny"); // Avoid  IFRFAMES
>         response.setHeader("Cache-Control",
> "no-cache,no-store,private,must-revalidate,max-stale=0,post-check=0,pre-check=0");
>         response.setHeader("Expires","0");
>         response.setHeader("Pragma", "no-cache");
>         response.disableCaching();
>

You probably want to call #disableCaching() *before* your setHeader()
calls. Currently #disableCaching() overrides some of them.


>     }
>
> }
>
>
>
>
>     > > > Oscar Besga Arcauz  < < <
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Reply via email to