mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
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:
@@ -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
|
||||
*
|
||||
|
@@ -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());
|
||||
|
@@ -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()));
|
||||
|
||||
|
Reference in New Issue
Block a user