sending the user to the login page when the session expires while filling out a form.

- sending back response code SC_UNAUTHORIZED from ajax servlet when the user has been logged out.

updated textarea test.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5058 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ariel Backenroth
2007-02-06 23:45:52 +00:00
parent b98c2309a4
commit d25f46bc0f
5 changed files with 40 additions and 18 deletions

View File

@@ -237,6 +237,17 @@ public class Application
WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE));
}
/**
* Retrieves the configured login page for the application
*
* @param facesContext The faces context
* @return The configured login page or null if the configuration is missing
*/
public static String getLoginPage(FacesContext facesContext)
{
return getLoginPage(FacesContextUtils.getRequiredWebApplicationContext(facesContext));
}
/**
* Retrieves the configured login page for the application
*

View File

@@ -2,7 +2,6 @@ package org.alfresco.web.app.servlet.ajax;
import java.io.IOException;
import java.util.Enumeration;
import java.util.StringTokenizer;
import javax.faces.context.FacesContext;
import javax.servlet.ServletException;
@@ -75,25 +74,21 @@ public class AjaxServlet extends BaseServlet
AuthenticationStatus status = servletAuthenticate(request, response, false);
if (status == AuthenticationStatus.Failure)
{
throw new AlfrescoRuntimeException("Access Denied: User not authenticated");
response.sendError(HttpServletResponse.SC_UNAUTHORIZED,
"Access Denied: User not authenticated");
return;
}
uri = uri.substring(request.getContextPath().length());
StringTokenizer t = new StringTokenizer(uri, "/");
int tokenCount = t.countTokens();
if (tokenCount < 3)
uri = uri.substring(request.getContextPath().length() + "/".length());
final String[] tokens = uri.split("/");
if (tokens.length < 3)
{
throw new AlfrescoRuntimeException("Servlet URL did not contain all required args: " + uri);
}
// skip the servlet name
t.nextToken();
// retrieve the command from the URL
String commandName = t.nextToken();
String commandName = tokens[1];
// retrieve the binding expression from the URL
String expression = t.nextToken();
String expression = tokens[2];
// setup the faces context
FacesContext facesContext = FacesHelper.getFacesContext(request, response, getServletContext());

View File

@@ -162,7 +162,8 @@ public class XFormsProcessor
append(": '").
append(bundle.getString(k)).
append("'").
append(k.equals(BUNDLE_KEYS[BUNDLE_KEYS.length - 1]) ? "\n}" : ",\n");
append(k.equals(BUNDLE_KEYS[BUNDLE_KEYS.length - 1]) ? "\n};" : ",").
append("\n");
}
e.appendChild(result.createTextNode(js.toString()));