You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by eh...@apache.org on 2007/04/11 04:16:32 UTC
svn commit: r527373 - in
/incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-auth-roles/src/main/java/org/apache/wicket/authentication:
AuthenticatedWebApplication.java AuthenticatedWebSession.java
Author: ehillenius
Date: Tue Apr 10 19:16:31 2007
New Revision: 527373
URL: http://svn.apache.org/viewvc?view=rev&rev=527373
Log:
fixed session API break errors
Modified:
incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-auth-roles/src/main/java/org/apache/wicket/authentication/AuthenticatedWebApplication.java
incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-auth-roles/src/main/java/org/apache/wicket/authentication/AuthenticatedWebSession.java
Modified: incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-auth-roles/src/main/java/org/apache/wicket/authentication/AuthenticatedWebApplication.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-auth-roles/src/main/java/org/apache/wicket/authentication/AuthenticatedWebApplication.java?view=diff&rev=527373&r1=527372&r2=527373
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-auth-roles/src/main/java/org/apache/wicket/authentication/AuthenticatedWebApplication.java (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-auth-roles/src/main/java/org/apache/wicket/authentication/AuthenticatedWebApplication.java Tue Apr 10 19:16:31 2007
@@ -38,34 +38,37 @@
* @author Jonathan Locke
*/
public abstract class AuthenticatedWebApplication extends WebApplication
- implements IRoleCheckingStrategy,
- IUnauthorizedComponentInstantiationListener {
+ implements
+ IRoleCheckingStrategy,
+ IUnauthorizedComponentInstantiationListener
+{
/** Subclass of authenticated web session to instantiate */
private final Class<? extends AuthenticatedWebSession> webSessionClass;
/**
* Constructor
*/
- public AuthenticatedWebApplication() {
+ public AuthenticatedWebApplication()
+ {
// Get web session class to instantiate
this.webSessionClass = getWebSessionClass();
}
@Override
- protected void init() {
+ protected void init()
+ {
super.init();
// Set authorization strategy and unauthorized instantiation listener
- getSecuritySettings().setAuthorizationStrategy(
- new RoleAuthorizationStrategy(this));
- getSecuritySettings().setUnauthorizedComponentInstantiationListener(
- this);
+ getSecuritySettings().setAuthorizationStrategy(new RoleAuthorizationStrategy(this));
+ getSecuritySettings().setUnauthorizedComponentInstantiationListener(this);
}
/**
* @see IRoleCheckingStrategy#hasAnyRole(Roles)
*/
- public final boolean hasAnyRole(final Roles roles) {
+ public final boolean hasAnyRole(final Roles roles)
+ {
final Roles sessionRoles = AuthenticatedWebSession.get().getRoles();
return sessionRoles != null && sessionRoles.hasAnyRole(roles);
}
@@ -73,36 +76,46 @@
/**
* @see IUnauthorizedComponentInstantiationListener#onUnauthorizedInstantiation(Component)
*/
- public final void onUnauthorizedInstantiation(final Component component) {
+ public final void onUnauthorizedInstantiation(final Component component)
+ {
// If there is a sign in page class declared, and the unauthorized
// component is a page, but it's not the sign in page
- if (component instanceof Page) {
- if (!AuthenticatedWebSession.get().isSignedIn()) {
+ if (component instanceof Page)
+ {
+ if (!AuthenticatedWebSession.get().isSignedIn())
+ {
// Redirect to intercept page to let the user sign in
- throw new RestartResponseAtInterceptPageException(
- getSignInPageClass());
- } else {
- onUnauthorizedPage((Page) component);
+ throw new RestartResponseAtInterceptPageException(getSignInPageClass());
}
- } else {
+ else
+ {
+ onUnauthorizedPage((Page)component);
+ }
+ }
+ else
+ {
// The component was not a page, so throw an exception
throw new UnauthorizedInstantiationException(component.getClass());
}
}
/**
- * @see org.apache.wicket.protocol.http.WebApplication#newSession(org.apache.wicket.Request, org.apache.wicket.Response)
+ * @see org.apache.wicket.protocol.http.WebApplication#newSession(org.apache.wicket.Request,
+ * org.apache.wicket.Response)
*/
@Override
- public Session newSession(final Request request, final Response response) {
- try {
- return webSessionClass.getDeclaredConstructor(
- AuthenticatedWebApplication.class, Request.class)
- .newInstance(AuthenticatedWebApplication.this, request);
- } catch (Exception e) {
- throw new WicketRuntimeException(
- "Unable to instantiate web session class "
- + webSessionClass, e);
+ public Session newSession(final Request request, final Response response)
+ {
+ try
+ {
+ return webSessionClass.getDeclaredConstructor(AuthenticatedWebApplication.class,
+ Request.class, Response.class).newInstance(AuthenticatedWebApplication.this,
+ request, response);
+ }
+ catch (Exception e)
+ {
+ throw new WicketRuntimeException("Unable to instantiate web session class "
+ + webSessionClass, e);
}
}
@@ -125,7 +138,8 @@
* @param page
* The page
*/
- protected void onUnauthorizedPage(final Page page) {
+ protected void onUnauthorizedPage(final Page page)
+ {
// The component was not a page, so throw an exception
throw new UnauthorizedInstantiationException(page.getClass());
}
Modified: incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-auth-roles/src/main/java/org/apache/wicket/authentication/AuthenticatedWebSession.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-auth-roles/src/main/java/org/apache/wicket/authentication/AuthenticatedWebSession.java?view=diff&rev=527373&r1=527372&r2=527373
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-auth-roles/src/main/java/org/apache/wicket/authentication/AuthenticatedWebSession.java (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-auth-roles/src/main/java/org/apache/wicket/authentication/AuthenticatedWebSession.java Tue Apr 10 19:16:31 2007
@@ -17,6 +17,7 @@
package org.apache.wicket.authentication;
import org.apache.wicket.Request;
+import org.apache.wicket.Response;
import org.apache.wicket.Session;
import org.apache.wicket.authorization.strategies.role.Roles;
import org.apache.wicket.protocol.http.WebSession;
@@ -49,10 +50,12 @@
* The web application
* @param request
* The current request object
+ * @param response
*/
- public AuthenticatedWebSession(final AuthenticatedWebApplication application, Request request)
+ public AuthenticatedWebSession(final AuthenticatedWebApplication application, Request request,
+ Response response)
{
- super(application, request);
+ super(application, request, response);
}
/**