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));
|
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
|
* 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.io.IOException;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.StringTokenizer;
|
|
||||||
|
|
||||||
import javax.faces.context.FacesContext;
|
import javax.faces.context.FacesContext;
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
@@ -75,25 +74,21 @@ public class AjaxServlet extends BaseServlet
|
|||||||
AuthenticationStatus status = servletAuthenticate(request, response, false);
|
AuthenticationStatus status = servletAuthenticate(request, response, false);
|
||||||
if (status == AuthenticationStatus.Failure)
|
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());
|
uri = uri.substring(request.getContextPath().length() + "/".length());
|
||||||
StringTokenizer t = new StringTokenizer(uri, "/");
|
final String[] tokens = uri.split("/");
|
||||||
int tokenCount = t.countTokens();
|
if (tokens.length < 3)
|
||||||
if (tokenCount < 3)
|
|
||||||
{
|
{
|
||||||
throw new AlfrescoRuntimeException("Servlet URL did not contain all required args: " + uri);
|
throw new AlfrescoRuntimeException("Servlet URL did not contain all required args: " + uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
// skip the servlet name
|
|
||||||
t.nextToken();
|
|
||||||
|
|
||||||
// retrieve the command from the URL
|
// retrieve the command from the URL
|
||||||
String commandName = t.nextToken();
|
String commandName = tokens[1];
|
||||||
|
|
||||||
// retrieve the binding expression from the URL
|
// retrieve the binding expression from the URL
|
||||||
String expression = t.nextToken();
|
String expression = tokens[2];
|
||||||
|
|
||||||
// setup the faces context
|
// setup the faces context
|
||||||
FacesContext facesContext = FacesHelper.getFacesContext(request, response, getServletContext());
|
FacesContext facesContext = FacesHelper.getFacesContext(request, response, getServletContext());
|
||||||
|
@@ -162,7 +162,8 @@ public class XFormsProcessor
|
|||||||
append(": '").
|
append(": '").
|
||||||
append(bundle.getString(k)).
|
append(bundle.getString(k)).
|
||||||
append("'").
|
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()));
|
e.appendChild(result.createTextNode(js.toString()));
|
||||||
|
|
||||||
|
@@ -1,10 +1,18 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||||
|
xmlns:alf="http://www.alfresco.org"
|
||||||
elementFormDefault="qualified">
|
elementFormDefault="qualified">
|
||||||
<xs:element name="textarea-test">
|
<xs:element name="textarea-test">
|
||||||
<xs:complexType>
|
<xs:complexType>
|
||||||
<xs:sequence>
|
<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:element name="repeating-textarea" type="xs:anyType" minOccurs="0" maxOccurs="unbounded"/>
|
||||||
</xs:sequence>
|
</xs:sequence>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
|
@@ -3719,11 +3719,18 @@ AjaxHelper.createRequest = function(target, serverMethod, methodArgs, load, erro
|
|||||||
{
|
{
|
||||||
AjaxHelper._loadHandler(result);
|
AjaxHelper._loadHandler(result);
|
||||||
});
|
});
|
||||||
result.error = error || function(type, e)
|
result.error = error || function(type, e, impl)
|
||||||
{
|
{
|
||||||
dojo.debug("error [" + type + "] " + e.message);
|
dojo.debug("error [" + type + "] " + e.message);
|
||||||
|
if (impl.status == 401)
|
||||||
|
{
|
||||||
|
document.getElementById("logout").onclick();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
_show_error(document.createTextNode(e.message));
|
_show_error(document.createTextNode(e.message));
|
||||||
AjaxHelper._loadHandler(this);
|
AjaxHelper._loadHandler(this);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user