Morning merge.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@2937 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2006-05-22 17:20:58 +00:00
parent ea740e26bf
commit 9189208bad
11 changed files with 54 additions and 260 deletions

View File

@@ -7,14 +7,8 @@
<!-- we want to build a WAR file in this project --> <!-- we want to build a WAR file in this project -->
<target name="package" depends="package-war" /> <target name="package" depends="package-war" />
<!-- copy the template web.xml and replace the "@facesconfig@" token with list of faces config files -->
<target name="generate-web-xml" depends="init">
<copy file="${dir.src.webinf}/${file.name.war.template}" tofile="${dir.src.webinf}/web.xml" overwrite="yes" />
<replace file="${dir.src.webinf}/web.xml" token="@facesconfig@" value="${files.faces.config}" />
</target>
<!-- override the common assemble-war target --> <!-- override the common assemble-war target -->
<target name="assemble-war" depends="common.assemble-war, generate-web-xml"> <target name="assemble-war" depends="common.assemble-war">
<fail unless="server" message="You must supply a value for the 'server' property to indicate which WAR to build" /> <fail unless="server" message="You must supply a value for the 'server' property to indicate which WAR to build" />
<condition property="isTomcat"> <condition property="isTomcat">
@@ -90,9 +84,5 @@
<fileset dir="${dir.assemble}/WEB-INF/lib" includes="${webinf.lib.delete.jboss}" /> <fileset dir="${dir.assemble}/WEB-INF/lib" includes="${webinf.lib.delete.jboss}" />
</delete> </delete>
</target> </target>
<target name="clean" depends="common.clean" description="Cleans all the normal files plus web.xml">
<delete file="${dir.src.webinf}/web.xml" />
</target>
</project> </project>

View File

@@ -1,4 +1,2 @@
webinf.delete.tomcat=jboss*.xml,portlet*.xml,alfresco-object.xml webinf.delete.tomcat=jboss*.xml,portlet*.xml,alfresco-object.xml
webinf.lib.delete.jboss=log4j-1.2.8.jar,portlet-api-lib.jar,myfaces-api.jar,myfaces-impl.jar webinf.lib.delete.jboss=log4j-1.2.8.jar,portlet-api-lib.jar,myfaces-api.jar,myfaces-impl.jar
files.faces.config=/WEB-INF/faces-config-app.xml,/WEB-INF/faces-config-beans.xml,/WEB-INF/faces-config-navigation.xml,/WEB-INF/faces-config-common.xml,/WEB-INF/faces-config-repo.xml

View File

@@ -62,7 +62,7 @@ public class Application
public static final String MESSAGE_BUNDLE = "alfresco.messages.webclient"; public static final String MESSAGE_BUNDLE = "alfresco.messages.webclient";
private static boolean inPortalServer = false; private static ThreadLocal<Boolean> inPortalServer = new ThreadLocal<Boolean>();
private static StoreRef repoStoreRef; private static StoreRef repoStoreRef;
private static String rootPath; private static String rootPath;
private static String companyRootId; private static String companyRootId;
@@ -87,7 +87,7 @@ public class Application
*/ */
public static void setInPortalServer(boolean inPortal) public static void setInPortalServer(boolean inPortal)
{ {
inPortalServer = inPortal; inPortalServer.set(inPortal);
} }
/** /**
@@ -97,7 +97,7 @@ public class Application
*/ */
public static boolean inPortalServer() public static boolean inPortalServer()
{ {
return inPortalServer; return (inPortalServer.get() != null ? inPortalServer.get() : false);
} }
/** /**

View File

@@ -174,16 +174,17 @@ public class ContextListener implements ServletContextListener, HttpSessionListe
{ {
if (logger.isDebugEnabled()) logger.debug("HTTP session destroyed: " + event.getSession().getId()); if (logger.isDebugEnabled()) logger.debug("HTTP session destroyed: " + event.getSession().getId());
User user; String userKey;
if (Application.inPortalServer() == false) if (Application.inPortalServer() == false)
{ {
user = (User)event.getSession().getAttribute(AuthenticationHelper.AUTHENTICATION_USER); userKey = AuthenticationHelper.AUTHENTICATION_USER;
} }
else else
{ {
user = (User)event.getSession().getAttribute(AlfrescoFacesPortlet.MANAGED_BEAN_PREFIX + AuthenticationHelper.AUTHENTICATION_USER); userKey = AlfrescoFacesPortlet.MANAGED_BEAN_PREFIX + AuthenticationHelper.AUTHENTICATION_USER;
} }
User user = (User)event.getSession().getAttribute(userKey);
if (user != null) if (user != null)
{ {
// invalidate ticket and clear the Security context for this thread // invalidate ticket and clear the Security context for this thread
@@ -191,7 +192,7 @@ public class ContextListener implements ServletContextListener, HttpSessionListe
AuthenticationService authService = (AuthenticationService)ctx.getBean("authenticationService"); AuthenticationService authService = (AuthenticationService)ctx.getBean("authenticationService");
authService.invalidateTicket(user.getTicket()); authService.invalidateTicket(user.getTicket());
authService.clearCurrentSecurityContext(); authService.clearCurrentSecurityContext();
event.getSession().removeAttribute(AuthenticationHelper.AUTHENTICATION_USER); event.getSession().removeAttribute(userKey);
} }
} }
} }

View File

@@ -107,6 +107,8 @@ public final class AuthenticationHelper
} }
else else
{ {
// TODO: this prefix is not consistent between JSR-168 vendors!
// we need a solution for each vendor?
user = (User)session.getAttribute(AlfrescoFacesPortlet.MANAGED_BEAN_PREFIX + AUTHENTICATION_USER); user = (User)session.getAttribute(AlfrescoFacesPortlet.MANAGED_BEAN_PREFIX + AUTHENTICATION_USER);
} }

View File

@@ -168,7 +168,7 @@ public class TemplateContentServlet extends BaseServlet
} }
// create the model - put the supplied noderef in as space/document as appropriate // create the model - put the supplied noderef in as space/document as appropriate
Object model = getModel(serviceRegistry, req, nodeRef); Object model = getModel(serviceRegistry, req, templateRef, nodeRef);
// process the template against the node content directly to the response output stream // process the template against the node content directly to the response output stream
// assuming the repo is capable of streaming in chunks, this should allow large files // assuming the repo is capable of streaming in chunks, this should allow large files
@@ -218,11 +218,12 @@ public class TemplateContentServlet extends BaseServlet
* *
* @param services ServiceRegistry required for TemplateNode construction * @param services ServiceRegistry required for TemplateNode construction
* @param req Http request - for accessing Session and url args * @param req Http request - for accessing Session and url args
* @param templateRef NodeRef of the template itself
* @param nodeRef NodeRef of the space/document to process template against * @param nodeRef NodeRef of the space/document to process template against
* *
* @return an object model ready for executing template against * @return an object model ready for executing template against
*/ */
private Object getModel(ServiceRegistry services, HttpServletRequest req, NodeRef nodeRef) private Object getModel(ServiceRegistry services, HttpServletRequest req, NodeRef templateRef, NodeRef nodeRef)
{ {
// build FreeMarker default model and merge // build FreeMarker default model and merge
Map root = DefaultModelHelper.buildDefaultModel(services, Application.getCurrentUser(req.getSession())); Map root = DefaultModelHelper.buildDefaultModel(services, Application.getCurrentUser(req.getSession()));
@@ -231,6 +232,7 @@ public class TemplateContentServlet extends BaseServlet
TemplateNode node = new TemplateNode(nodeRef, services, this.imageResolver); TemplateNode node = new TemplateNode(nodeRef, services, this.imageResolver);
root.put("space", node); root.put("space", node);
root.put("document", node); root.put("document", node);
root.put("template", new TemplateNode(templateRef, services, this.imageResolver));
// add URL arguments as a map called 'args' to the root of the model // add URL arguments as a map called 'args' to the root of the model
Map<String, String> args = new HashMap<String, String>(8, 1.0f); Map<String, String> args = new HashMap<String, String>(8, 1.0f);

View File

@@ -87,6 +87,7 @@ public final class ExecuteScriptCommand implements Command
personRef, personRef,
new NodeRef(Repository.getStoreRef(), Application.getCompanyRootId()), new NodeRef(Repository.getStoreRef(), Application.getCompanyRootId()),
(NodeRef)nodeService.getProperty(personRef, ContentModel.PROP_HOMEFOLDER), (NodeRef)nodeService.getProperty(personRef, ContentModel.PROP_HOMEFOLDER),
scriptRef,
docRef, docRef,
spaceRef, spaceRef,
DefaultModelHelper.imageResolver); DefaultModelHelper.imageResolver);

View File

@@ -27,11 +27,9 @@ import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext; import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem; import javax.faces.model.SelectItem;
import javax.faces.validator.ValidatorException; import javax.faces.validator.ValidatorException;
import javax.portlet.PortletRequest;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.alfresco.config.Config; import org.alfresco.config.Config;
import org.alfresco.config.ConfigService;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.repo.security.authentication.AuthenticationException; import org.alfresco.repo.security.authentication.AuthenticationException;
import org.alfresco.service.cmr.repository.InvalidNodeRefException; import org.alfresco.service.cmr.repository.InvalidNodeRefException;
@@ -305,14 +303,14 @@ public class LoginBean
// if a redirect URL has been provided then use that // if a redirect URL has been provided then use that
// this allows servlets etc. to provide a URL to return too after a successful login // this allows servlets etc. to provide a URL to return too after a successful login
String redirectURL = (String)fc.getExternalContext().getSessionMap().get(LOGIN_REDIRECT_KEY); String redirectURL = (String)session.get(LOGIN_REDIRECT_KEY);
if (redirectURL != null) if (redirectURL != null)
{ {
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("Redirect URL found: " + redirectURL); logger.debug("Redirect URL found: " + redirectURL);
// remove redirect URL from session // remove redirect URL from session
fc.getExternalContext().getSessionMap().remove(LOGIN_REDIRECT_KEY); session.remove(LOGIN_REDIRECT_KEY);
try try
{ {
@@ -355,30 +353,39 @@ public class LoginBean
{ {
FacesContext context = FacesContext.getCurrentInstance(); FacesContext context = FacesContext.getCurrentInstance();
Map session = context.getExternalContext().getSessionMap();
User user = (User) session.get(AuthenticationHelper.AUTHENTICATION_USER);
// need to capture this value before invalidating the session // need to capture this value before invalidating the session
boolean externalAuth = isAlfrescoAuth(); boolean externalAuth = isAlfrescoAuth();
// Invalidate Session for this user. // Invalidate Session for this user.
// This causes the sessionDestroyed() event to be processed by ContextListener
// which is responsible for invalidating the ticket and clearing the security context
if (Application.inPortalServer() == false) if (Application.inPortalServer() == false)
{ {
// This causes the sessionDestroyed() event to be processed by ContextListener
// which is responsible for invalidating the ticket and clearing the security context
HttpServletRequest request = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest(); HttpServletRequest request = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
request.getSession().invalidate(); request.getSession().invalidate();
} }
else else
{ {
PortletRequest request = (PortletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest(); Map session = context.getExternalContext().getSessionMap();
request.getPortletSession().invalidate(); User user = (User)session.get(AuthenticationHelper.AUTHENTICATION_USER);
if (user != null)
{
// invalidate ticket and clear the Security context for this thread
authenticationService.invalidateTicket(user.getTicket());
authenticationService.clearCurrentSecurityContext();
}
// remove all objects from our session by hand
// we do this as invalidating the Portal session would invalidate all other portlets!
for (Object key : session.keySet())
{
session.remove(key);
}
} }
// Request that the username cookie state is removed - this is not // Request that the username cookie state is removed - this is not
// possible from JSF - so instead we setup a session variable // possible from JSF - so instead we setup a session variable
// which will be detected by the login.jsp/Portlet as appropriate. // which will be detected by the login.jsp/Portlet as appropriate.
session = context.getExternalContext().getSessionMap(); Map session = context.getExternalContext().getSessionMap();
session.put(AuthenticationHelper.SESSION_INVALIDATED, true); session.put(AuthenticationHelper.SESSION_INVALIDATED, true);
// set language to last used // set language to last used

View File

@@ -104,6 +104,14 @@ public class AdvancedSearchConfigElement extends ConfigElementAdapter
} }
} }
if (newElement.getFolderTypes() != null)
{
for (String type : newElement.getFolderTypes())
{
combinedElement.addFolderType(type);
}
}
if (newElement.getCustomProperties() != null) if (newElement.getCustomProperties() != null)
{ {
for (CustomProperty property : newElement.getCustomProperties()) for (CustomProperty property : newElement.getCustomProperties())

View File

@@ -0,0 +1,11 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
<!-- *************************************************************** -->
<!-- Empty JSF config file to prevent errors being thrown during JSF -->
<!-- initialisation. Overwrite this file with your custom version. -->
<!-- *************************************************************** -->
</faces-config>

View File

@@ -1,226 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Alfresco Web Client</display-name>
<description>Alfresco Web Client</description>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>@facesconfig@</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
<param-value>false</param-value>
<description>This is an EXPERIMENTAL feature, so leave it off for now!</description>
</context-param>
<!-- TODO: Change this to false for production -->
<context-param>
<param-name>org.apache.myfaces.PRETTY_HTML</param-name>
<param-value>true</param-value>
<description>
If true, rendered HTML code will be formatted, so that it is "human readable".
i.e. additional line separators and whitespace will be written, that do not
influence the HTML code.
Default: "true"
</description>
</context-param>
<context-param>
<param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
<param-value>false</param-value>
<description>
If true, a javascript function will be rendered that is able to restore the
former vertical scroll on every request. Convenient feature if you have pages
with long lists and you do not want the browser page to always jump to the top
if you trigger a link or button action that stays on the same page.
Default: "false"
</description>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:alfresco/web-client-application-context.xml
classpath:web-services-application-context.xml
classpath:alfresco/application-context.xml
</param-value>
<description>Spring config file locations</description>
</context-param>
<filter>
<filter-name>Authentication Filter</filter-name>
<filter-class>org.alfresco.web.app.servlet.AuthenticationFilter</filter-class>
<!-- For Novell IChain support use the following filter -->
<!-- (Enterprise version only) -->
<!--
<filter-class>org.alfresco.web.app.servlet.NovellIChainsHTTPRequestAuthenticationFilter</filter-class>
-->
<!-- For NTLM authentication support use the following filter -->
<!-- (Enterprise version only) -->
<!--
<filter-class>org.alfresco.web.app.servlet.NTLMAuthenticationFilter</filter-class>
-->
</filter>
<filter>
<filter-name>WebDAV Authentication Filter</filter-name>
<filter-class>org.alfresco.repo.webdav.auth.AuthenticationFilter</filter-class>
<!-- For NTLM authentication support use the following filter -->
<!-- (Enterprise version only) -->
<!--
<filter-class>org.alfresco.repo.webdav.auth.NTLMAuthenticationFilter</filter-class>
-->
</filter>
<filter-mapping>
<filter-name>Authentication Filter</filter-name>
<url-pattern>/faces/*</url-pattern>
</filter-mapping>
<!-- For NTLM authentication support enable the following mapping -->
<!-- (Enterprise version only) -->
<!--
<filter-mapping>
<filter-name>Authentication Filter</filter-name>
<url-pattern>/navigate/*</url-pattern>
</filter-mapping>
-->
<filter-mapping>
<filter-name>WebDAV Authentication Filter</filter-name>
<url-pattern>/webdav/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.alfresco.web.app.ContextListener</listener-class>
</listener>
<!-- Faces Servlet -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>org.alfresco.web.app.servlet.AlfrescoFacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>uploadFile</servlet-name>
<servlet-class>org.alfresco.web.app.servlet.UploadFileServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>downloadContent</servlet-name>
<servlet-class>org.alfresco.web.app.servlet.DownloadContentServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>externalAccess</servlet-name>
<servlet-class>org.alfresco.web.app.servlet.ExternalAccessServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>templateContent</servlet-name>
<servlet-class>org.alfresco.web.app.servlet.TemplateContentServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>commandServlet</servlet-name>
<servlet-class>org.alfresco.web.app.servlet.CommandServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>axis</servlet-name>
<servlet-class>org.apache.axis.transport.http.AxisServlet</servlet-class>
<load-on-startup>5</load-on-startup>
</servlet>
<servlet>
<servlet-name>WebDAV</servlet-name>
<servlet-class>org.alfresco.repo.webdav.WebDAVServlet</servlet-class>
<init-param>
<param-name>store</param-name>
<param-value>workspace://SpacesStore</param-value>
</init-param>
<init-param>
<param-name>rootPath</param-name>
<param-value>/app:company_home</param-value>
</init-param>
<load-on-startup>5</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>uploadFile</servlet-name>
<url-pattern>/uploadFileServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>downloadContent</servlet-name>
<url-pattern>/download/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>externalAccess</servlet-name>
<url-pattern>/navigate/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>templateContent</servlet-name>
<url-pattern>/template/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>commandServlet</servlet-name>
<url-pattern>/command/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>axis</servlet-name>
<url-pattern>/api/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>WebDAV</servlet-name>
<url-pattern>/webdav/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>60</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>