/**
 * Copyright 2010 OpenEngSB Division, Vienna University of Technology
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.openengsb.openticket.ui.web;

import org.apache.wicket.Page;
import org.apache.wicket.Request;
import org.apache.wicket.Response;
import org.apache.wicket.Session;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.authentication.AuthenticatedWebApplication;
import org.apache.wicket.authentication.AuthenticatedWebSession;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.spring.injection.annot.SpringComponentInjector;

public class WicketApplication extends AuthenticatedWebApplication {
    @Override
    protected void init() {
        super.init();
        addInjector();
        getResourceSettings().setAddLastModifiedTimeToResourceReferenceUrl(true);
    }

    protected void addInjector() {
        addComponentInstantiationListener(new SpringComponentInjector(this));
    }

    @Override
    public Class<? extends Page> getHomePage() {
        return Welcome.class;
    }

    @Override
    public AjaxRequestTarget newAjaxRequestTarget(Page page) {
        if (page instanceof BasePage) {
			((BasePage) page).initContextForCurrentThread();
        }
        return super.newAjaxRequestTarget(page);
    }

    @Override
    public Session newSession(Request request, Response response) {
        return new WicketSession(request);
    }

    @Override
    protected Class<? extends WebPage> getSignInPageClass() {
        return LoginPage.class;
    }

    @Override
    protected Class<? extends AuthenticatedWebSession> getWebSessionClass() {
        return WicketSession.class;
    }

}

@@ -1693,11 +1693,20 @@
 ) %7B%0A
-%09%09%09
+            
 ((Ba

format correction