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()));
|
||||
|
||||
|
@@ -1,10 +1,18 @@
|
||||
<?xml version="1.0"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:alf="http://www.alfresco.org"
|
||||
elementFormDefault="qualified">
|
||||
<xs:element name="textarea-test">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="textarea" type="xs:anyType" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="plain_text" type="xs:string" minOccurs="0" maxOccurs="1">
|
||||
<xs:annotation>
|
||||
<xs:appinfo>
|
||||
<alf:appearance>minimal</alf:appearance>
|
||||
</xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element name="rich_text" type="xs:anyType" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="repeating-textarea" type="xs:anyType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
@@ -3719,11 +3719,18 @@ AjaxHelper.createRequest = function(target, serverMethod, methodArgs, load, erro
|
||||
{
|
||||
AjaxHelper._loadHandler(result);
|
||||
});
|
||||
result.error = error || function(type, e)
|
||||
result.error = error || function(type, e, impl)
|
||||
{
|
||||
dojo.debug("error [" + type + "] " + e.message);
|
||||
_show_error(document.createTextNode(e.message));
|
||||
AjaxHelper._loadHandler(this);
|
||||
if (impl.status == 401)
|
||||
{
|
||||
document.getElementById("logout").onclick();
|
||||
}
|
||||
else
|
||||
{
|
||||
_show_error(document.createTextNode(e.message));
|
||||
AjaxHelper._loadHandler(this);
|
||||
}
|
||||
};
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user