Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/pipeline/valve/impl/DebugValveImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/pipeline/valve/impl/DebugValveImpl.java?rev=725977&r1=725976&r2=725977&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/pipeline/valve/impl/DebugValveImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/pipeline/valve/impl/DebugValveImpl.java Fri Dec 12 04:06:29 2008
@@ -1,71 +1,71 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jetspeed.pipeline.valve.impl;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.jetspeed.pipeline.PipelineException;
-import org.apache.jetspeed.pipeline.valve.AbstractValve;
-import org.apache.jetspeed.pipeline.valve.ValveContext;
-import org.apache.jetspeed.request.RequestContext;
-
-/**
- * <p>
- * Debug Valve
- * </p>
- *
- * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
- * @version $Id: $
- *
- */
-public class DebugValveImpl extends AbstractValve
-{
- private static final Log log = LogFactory.getLog(DebugValveImpl.class);
-
- public DebugValveImpl()
- {
- }
-
- public void invoke(RequestContext request, ValveContext context) throws PipelineException
- {
- debugHeaders(request.getRequest());
- context.invokeNext(request);
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- public String toString()
- {
- return "DebugValveImpl";
- }
-
- private void debugHeaders( HttpServletRequest req )
- {
- log.info("-- Jetspeed Debug Valve: Debugging standard headers --");
- java.util.Enumeration e = req.getHeaderNames();
- while (e.hasMoreElements())
- {
- String name = (String) e.nextElement();
- String value = req.getHeader(name);
- log.info("http header = " + name + " : " + value);
-// System.out.println("http header = " + name + " : " + value);
- }
- }
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.pipeline.valve.impl;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.pipeline.PipelineException;
+import org.apache.jetspeed.pipeline.valve.AbstractValve;
+import org.apache.jetspeed.pipeline.valve.ValveContext;
+import org.apache.jetspeed.request.RequestContext;
+
+/**
+ * <p>
+ * Debug Valve
+ * </p>
+ *
+ * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
+ * @version $Id: $
+ *
+ */
+public class DebugValveImpl extends AbstractValve
+{
+ private static final Log log = LogFactory.getLog(DebugValveImpl.class);
+
+ public DebugValveImpl()
+ {
+ }
+
+ public void invoke(RequestContext request, ValveContext context) throws PipelineException
+ {
+ debugHeaders(request.getRequest());
+ context.invokeNext(request);
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ public String toString()
+ {
+ return "DebugValveImpl";
+ }
+
+ private void debugHeaders( HttpServletRequest req )
+ {
+ log.info("-- Jetspeed Debug Valve: Debugging standard headers --");
+ java.util.Enumeration e = req.getHeaderNames();
+ while (e.hasMoreElements())
+ {
+ String name = (String) e.nextElement();
+ String value = req.getHeader(name);
+ log.info("http header = " + name + " : " + value);
+// System.out.println("http header = " + name + " : " + value);
+ }
+ }
}
\ No newline at end of file
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/pipeline/valve/impl/DebugValveImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/pipeline/valve/impl/PropertyLoaderValve.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/pipeline/valve/impl/PropertyLoaderValve.java?rev=725977&r1=725976&r2=725977&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/pipeline/valve/impl/PropertyLoaderValve.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/pipeline/valve/impl/PropertyLoaderValve.java Fri Dec 12 04:06:29 2008
@@ -1,150 +1,150 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jetspeed.pipeline.valve.impl;
-
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.PropertiesConfiguration;
-import org.apache.jetspeed.pipeline.PipelineException;
-import org.apache.jetspeed.pipeline.valve.Valve;
-import org.apache.jetspeed.pipeline.valve.ValveContext;
-import org.apache.jetspeed.request.RequestContext;
-
-/**
- * The purpose of this valve is to load a property file and make the information
- * available on the request as an attribute. The name of the attribute is the
- * key that is passed into the constructor.
- *
- * There are 3 different ways to use this object: 1. Provide a key and a
- * PropertiesConfiguration object 2. Provide a key and a path to a properties
- * file 3. Provide a string which is used for both the key and as an environment
- * lookup to find the path to a properties file.
- *
- * The PropertiesConfiguration object is put on the request and can be consumed
- * by anyone downstream of this valve
- *
- * Multiple valves can be configured via Spring and put into the pipeline if
- * more than one property file is needed.
- *
- * Spring configuration samples are shown below: <bean
- * id="ProductionConfiguration"
- * class="org.apache.commons.configuration.PropertiesConfiguration">
- * <constructor-arg> <value>/apps/jetspeed/etc/jetspeed-production.properties</value>
- * </constructor-arg> </bean>
- *
- * <bean id="propertyLoaderValve_1"
- * class="com.fmr.portal.pipeline.impl.PropertyLoaderValve"
- * init-method="initialize"> <constructor-arg index="0"> <value>php-properties</value>
- * </constructor-arg> <constructor-arg index="1"
- * type="org.apache.commons.configuration.PropertiesConfiguration"> <ref
- * bean="ProductionConfiguration"/> </constructor-arg> </bean>
- *
- * <bean id="propertyLoaderValve_2"
- * class="com.fmr.portal.pipeline.impl.PropertyLoaderValve"
- * init-method="initialize"> <constructor-arg index="0"> <value>php-properties</value>
- * </constructor-arg>
- *
- * <constructor-arg index="1">
- * <value>/apps/jetspeed/etc/jetspeed-production.properties</value>
- * </constructor-arg> </bean>
- *
- * <bean id="propertyLoaderValve_3"
- * class="com.fmr.portal.pipeline.impl.PropertyLoaderValve"
- * init-method="initialize"> <constructor-arg index="0"> <value>app.props</value>
- * </constructor-arg> </bean>
- *
- * For this last one, an environment variable with the name "app.props" would
- * contain the file path to the properties file.
- *
- *
- * @author David Gurney
- *
- */
-public class PropertyLoaderValve implements Valve
-{
- protected String m_sKey = null;
-
- protected PropertiesConfiguration m_oPropertiesConfiguration = null;
-
- protected String m_sPropertyFilePath = null;
-
- public PropertyLoaderValve(String p_sKey,
- PropertiesConfiguration p_oPropertiesConfiguration)
- {
- m_sKey = p_sKey;
- m_oPropertiesConfiguration = p_oPropertiesConfiguration;
- }
-
- public PropertyLoaderValve(String p_sKey, String p_sPropertyFilePath)
- {
- m_sKey = p_sKey;
- m_sPropertyFilePath = p_sPropertyFilePath;
- }
-
- /**
- *
- * @param p_sEnvironmentKey -
- * This value will be used both as the storage key and as the
- * name to use when looking up an environment variable. The
- * environment variable should contain the file path of the
- * properties file to be loaded
- */
- public PropertyLoaderValve(String p_sEnvironmentKey)
- {
- m_sKey = p_sEnvironmentKey;
- }
-
- public void initialize() throws PipelineException
- {
- // Get the property file path if necessary
- if (m_sPropertyFilePath == null && m_oPropertiesConfiguration == null)
- {
- m_sPropertyFilePath = System.getProperty(m_sKey);
- }
-
- // Load the file if the path is provided
- if (m_sPropertyFilePath != null && m_oPropertiesConfiguration == null)
- {
- try
- {
- m_oPropertiesConfiguration = new PropertiesConfiguration(
- m_sPropertyFilePath);
- } catch (ConfigurationException e)
- {
- throw new PipelineException(e);
- }
- }
-
- // If we still have a null, create an empty properties configuration
- // anyway
- if (m_oPropertiesConfiguration == null)
- {
- m_oPropertiesConfiguration = new PropertiesConfiguration();
- }
- }
-
- public void invoke(RequestContext p_oRequest, ValveContext p_oContext)
- throws PipelineException
- {
- p_oRequest.getRequest()
- .setAttribute(m_sKey, m_oPropertiesConfiguration);
-
- if (p_oContext != null)
- {
- p_oContext.invokeNext(p_oRequest);
- }
- }
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.pipeline.valve.impl;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.jetspeed.pipeline.PipelineException;
+import org.apache.jetspeed.pipeline.valve.Valve;
+import org.apache.jetspeed.pipeline.valve.ValveContext;
+import org.apache.jetspeed.request.RequestContext;
+
+/**
+ * The purpose of this valve is to load a property file and make the information
+ * available on the request as an attribute. The name of the attribute is the
+ * key that is passed into the constructor.
+ *
+ * There are 3 different ways to use this object: 1. Provide a key and a
+ * PropertiesConfiguration object 2. Provide a key and a path to a properties
+ * file 3. Provide a string which is used for both the key and as an environment
+ * lookup to find the path to a properties file.
+ *
+ * The PropertiesConfiguration object is put on the request and can be consumed
+ * by anyone downstream of this valve
+ *
+ * Multiple valves can be configured via Spring and put into the pipeline if
+ * more than one property file is needed.
+ *
+ * Spring configuration samples are shown below: <bean
+ * id="ProductionConfiguration"
+ * class="org.apache.commons.configuration.PropertiesConfiguration">
+ * <constructor-arg> <value>/apps/jetspeed/etc/jetspeed-production.properties</value>
+ * </constructor-arg> </bean>
+ *
+ * <bean id="propertyLoaderValve_1"
+ * class="com.fmr.portal.pipeline.impl.PropertyLoaderValve"
+ * init-method="initialize"> <constructor-arg index="0"> <value>php-properties</value>
+ * </constructor-arg> <constructor-arg index="1"
+ * type="org.apache.commons.configuration.PropertiesConfiguration"> <ref
+ * bean="ProductionConfiguration"/> </constructor-arg> </bean>
+ *
+ * <bean id="propertyLoaderValve_2"
+ * class="com.fmr.portal.pipeline.impl.PropertyLoaderValve"
+ * init-method="initialize"> <constructor-arg index="0"> <value>php-properties</value>
+ * </constructor-arg>
+ *
+ * <constructor-arg index="1">
+ * <value>/apps/jetspeed/etc/jetspeed-production.properties</value>
+ * </constructor-arg> </bean>
+ *
+ * <bean id="propertyLoaderValve_3"
+ * class="com.fmr.portal.pipeline.impl.PropertyLoaderValve"
+ * init-method="initialize"> <constructor-arg index="0"> <value>app.props</value>
+ * </constructor-arg> </bean>
+ *
+ * For this last one, an environment variable with the name "app.props" would
+ * contain the file path to the properties file.
+ *
+ *
+ * @author David Gurney
+ *
+ */
+public class PropertyLoaderValve implements Valve
+{
+ protected String m_sKey = null;
+
+ protected PropertiesConfiguration m_oPropertiesConfiguration = null;
+
+ protected String m_sPropertyFilePath = null;
+
+ public PropertyLoaderValve(String p_sKey,
+ PropertiesConfiguration p_oPropertiesConfiguration)
+ {
+ m_sKey = p_sKey;
+ m_oPropertiesConfiguration = p_oPropertiesConfiguration;
+ }
+
+ public PropertyLoaderValve(String p_sKey, String p_sPropertyFilePath)
+ {
+ m_sKey = p_sKey;
+ m_sPropertyFilePath = p_sPropertyFilePath;
+ }
+
+ /**
+ *
+ * @param p_sEnvironmentKey -
+ * This value will be used both as the storage key and as the
+ * name to use when looking up an environment variable. The
+ * environment variable should contain the file path of the
+ * properties file to be loaded
+ */
+ public PropertyLoaderValve(String p_sEnvironmentKey)
+ {
+ m_sKey = p_sEnvironmentKey;
+ }
+
+ public void initialize() throws PipelineException
+ {
+ // Get the property file path if necessary
+ if (m_sPropertyFilePath == null && m_oPropertiesConfiguration == null)
+ {
+ m_sPropertyFilePath = System.getProperty(m_sKey);
+ }
+
+ // Load the file if the path is provided
+ if (m_sPropertyFilePath != null && m_oPropertiesConfiguration == null)
+ {
+ try
+ {
+ m_oPropertiesConfiguration = new PropertiesConfiguration(
+ m_sPropertyFilePath);
+ } catch (ConfigurationException e)
+ {
+ throw new PipelineException(e);
+ }
+ }
+
+ // If we still have a null, create an empty properties configuration
+ // anyway
+ if (m_oPropertiesConfiguration == null)
+ {
+ m_oPropertiesConfiguration = new PropertiesConfiguration();
+ }
+ }
+
+ public void invoke(RequestContext p_oRequest, ValveContext p_oContext)
+ throws PipelineException
+ {
+ p_oRequest.getRequest()
+ .setAttribute(m_sKey, m_oPropertiesConfiguration);
+
+ if (p_oContext != null)
+ {
+ p_oContext.invokeNext(p_oRequest);
+ }
+ }
}
\ No newline at end of file
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/pipeline/valve/impl/PropertyLoaderValve.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/profiler/impl/CreatePageValveImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/profiler/impl/CreatePageValveImpl.java?rev=725977&r1=725976&r2=725977&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/profiler/impl/CreatePageValveImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/profiler/impl/CreatePageValveImpl.java Fri Dec 12 04:06:29 2008
@@ -1,63 +1,63 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jetspeed.profiler.impl;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.jetspeed.layout.PortletActionSecurityBehavior;
-import org.apache.jetspeed.pipeline.PipelineException;
-import org.apache.jetspeed.pipeline.valve.AbstractValve;
-import org.apache.jetspeed.pipeline.valve.Valve;
-import org.apache.jetspeed.pipeline.valve.ValveContext;
-import org.apache.jetspeed.request.RequestContext;
-
-/**
- * ProfilerValveImpl
- *
- * @author <a href="mailto:taylor@apache.org">David Sean Taylor </a>
- * @version $Id: ProfilerValveImpl.java 388733 2006-03-25 09:03:58Z rwatler $
- */
-public class CreatePageValveImpl extends AbstractValve implements Valve
-{
- protected Log log = LogFactory.getLog(CreatePageValveImpl.class);
-
- private PortletActionSecurityBehavior securityBehavior;
-
- /**
- * CreatePageValveImpl - constructor
- *
- * @param securityBehavior the behavior to create new page for new user
- */
- public CreatePageValveImpl(PortletActionSecurityBehavior behavior)
- {
- this.securityBehavior = behavior;
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jetspeed.pipeline.valve.Valve#invoke(org.apache.jetspeed.request.RequestContext,
- * org.apache.jetspeed.pipeline.valve.ValveContext)
- */
- public void invoke( RequestContext request, ValveContext context ) throws PipelineException
- {
- securityBehavior.createNewPageOnEdit(request);
- context.invokeNext(request);
- }
-
-}
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.profiler.impl;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.layout.PortletActionSecurityBehavior;
+import org.apache.jetspeed.pipeline.PipelineException;
+import org.apache.jetspeed.pipeline.valve.AbstractValve;
+import org.apache.jetspeed.pipeline.valve.Valve;
+import org.apache.jetspeed.pipeline.valve.ValveContext;
+import org.apache.jetspeed.request.RequestContext;
+
+/**
+ * ProfilerValveImpl
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor </a>
+ * @version $Id: ProfilerValveImpl.java 388733 2006-03-25 09:03:58Z rwatler $
+ */
+public class CreatePageValveImpl extends AbstractValve implements Valve
+{
+ protected Log log = LogFactory.getLog(CreatePageValveImpl.class);
+
+ private PortletActionSecurityBehavior securityBehavior;
+
+ /**
+ * CreatePageValveImpl - constructor
+ *
+ * @param securityBehavior the behavior to create new page for new user
+ */
+ public CreatePageValveImpl(PortletActionSecurityBehavior behavior)
+ {
+ this.securityBehavior = behavior;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.jetspeed.pipeline.valve.Valve#invoke(org.apache.jetspeed.request.RequestContext,
+ * org.apache.jetspeed.pipeline.valve.ValveContext)
+ */
+ public void invoke( RequestContext request, ValveContext context ) throws PipelineException
+ {
+ securityBehavior.createNewPageOnEdit(request);
+ context.invokeNext(request);
+ }
+
+}
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/profiler/impl/CreatePageValveImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/JetspeedRequestContext.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/JetspeedRequestContext.java?rev=725977&r1=725976&r2=725977&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/JetspeedRequestContext.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/JetspeedRequestContext.java Fri Dec 12 04:06:29 2008
@@ -1,656 +1,656 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jetspeed.request;
-
-import java.security.Principal;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-
-import javax.security.auth.Subject;
-import javax.servlet.ServletConfig;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletRequestWrapper;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-import org.apache.jetspeed.Jetspeed;
-import org.apache.jetspeed.PortalReservedParameters;
-import org.apache.jetspeed.aggregator.ContentDispatcher;
-import org.apache.jetspeed.aggregator.ContentDispatcherCtrl;
-import org.apache.jetspeed.capabilities.CapabilityMap;
-import org.apache.jetspeed.container.PortletWindow;
-import org.apache.jetspeed.container.url.PortalURL;
-import org.apache.jetspeed.engine.servlet.ServletRequestFactory;
-import org.apache.jetspeed.engine.servlet.ServletResponseFactory;
-import org.apache.jetspeed.om.page.ContentPage;
-import org.apache.jetspeed.om.page.ContentPageImpl;
-import org.apache.jetspeed.om.portlet.Language;
-import org.apache.jetspeed.pipeline.Pipeline;
-import org.apache.jetspeed.portalsite.PortalSiteRequestContext;
-import org.apache.jetspeed.portalsite.PortalSiteSessionContext;
-import org.apache.jetspeed.profiler.ProfileLocator;
-import org.apache.jetspeed.profiler.Profiler;
-import org.apache.jetspeed.profiler.impl.ProfilerValveImpl;
-import org.apache.jetspeed.security.SubjectHelper;
-import org.apache.jetspeed.security.User;
-import org.apache.jetspeed.util.JetspeedLocale;
-import org.apache.jetspeed.om.portlet.PortletDefinition;
-import org.apache.jetspeed.om.portlet.impl.LanguageImpl;
-
-/**
- * Jetspeed Request Context is associated with each portal request. The request
- * holds the contextual information shared amongst components in the portal,
- * accessed through a common valve pipeline.
- *
- * @author <a href="mailto:david@bluesunrise.com">David Sean Taylor </a>
- * @version $Id: JetspeedRequestContext.java,v 1.19 2004/05/25 01:37:12 taylor
- * Exp $
- */
-public class JetspeedRequestContext implements RequestContext
-{
- private static final String ACTION_ERROR_ATTR = "org.apache.jetspeed.action.error:";
- private RequestContextComponent rcc;
- private HttpServletRequest request;
- private HttpServletResponse response;
- private ServletConfig config;
- private HttpSession session;
- private Map locators;
- private ContentPage page;
- private PortletDefinition portletDefinition;
- private Subject subject;
- private Locale locale;
- private ContentDispatcher dispatcher;
- private Pipeline pipeline;
-
- private CapabilityMap capabilityMap;
- private String mimeType;
- private String mediaType;
- private PortalURL url;
- private PortletWindow actionWindow;
- private String encoding;
- private String requestPath = null;
- private Map requestsForWindows;
- private Map responsesForWindows;
- private final Map<String, Object> objects;
-
- /**
- * Create a new Request Context
- *
- * @param pc
- * @param request
- * @param response
- * @param config
- */
- public JetspeedRequestContext(RequestContextComponent rcc, HttpServletRequest request, HttpServletResponse response, ServletConfig config)
- {
- this(rcc, request, response, config, new HashMap<String, Object>());
- }
-
- public JetspeedRequestContext(RequestContextComponent rcc, HttpServletRequest request, HttpServletResponse response, ServletConfig config, Map<String, Object> objects)
- {
- this.rcc = rcc;
- this.request = request;
- this.response = response;
- this.config = config;
- this.session = request.getSession();
- this.requestsForWindows = new HashMap();
- this.responsesForWindows = new HashMap();
- this.objects = objects;
-
- // set context in Request for later use
- if (null != this.request)
- {
- this.request.setAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE, this);
- PortalRequestFactory prf = null;
- try
- {
- prf = (PortalRequestFactory)Jetspeed.getComponentManager().getComponent(PortalRequestFactory.class);
- }
- catch (Throwable t)
- {
- // allow undefined
- }
- if ( prf != null )
- {
- this.request = prf.createPortalRequest(this.request);
- }
- else
- {
- // Simply wrap the current request so we maintain the same
- // level of wrapping.
- // This is needed in the ServletPortletInvoker to get back
- // to the original request.
- this.request = new HttpServletRequestWrapper(this.request);
- }
- }
- }
-
- public HttpServletRequest getRequest()
- {
- return request;
- }
-
- public HttpServletResponse getResponse()
- {
- return response;
- }
-
- public ServletConfig getConfig()
- {
- return config;
- }
-
- public Map getProfileLocators()
- {
- return locators;
- }
-
- public void setProfileLocators( Map locators )
- {
- this.locators = locators;
- }
-
- public ContentPage getPage()
- {
- return this.page;
- }
-
- public void setPage( ContentPage page )
- {
- this.page = page;
- }
-
- public PortletDefinition getPortletDefinition()
- {
- return portletDefinition;
- }
-
- public void setPortletDefinition( PortletDefinition portletDefinition )
- {
- this.portletDefinition = portletDefinition;
- }
-
- public ContentDispatcher getContentDispatcher()
- {
- return dispatcher;
- }
-
- public void setContentDispatcher( ContentDispatcher dispatcher )
- {
- this.dispatcher = dispatcher;
- }
-
- /**
- * get the Capability Map
- *
- */
- public CapabilityMap getCapabilityMap()
- {
- return this.capabilityMap;
- }
-
- /**
- * Set the Mimetype. Used by the CapabilityValve
- *
- * @param mimeType
- */
- public void setMimeType( String mimeType )
- {
- this.mimeType = mimeType;
- }
-
- /**
- * get the mimeType for the request
- *
- */
- public String getMimeType()
- {
- return this.mimeType;
- }
-
- /**
- * Set the mediaType. Used by the CapabilityValve
- *
- * @param mediaType
- */
- public void setMediaType( String mediaType )
- {
- this.mediaType = mediaType;
- }
-
- /**
- * get the Media Type
- *
- */
- public String getMediaType()
- {
- return this.mediaType;
- }
-
- /**
- * Get the target Portlet Action Window
- *
- * @return PortletWindow The target portlet window
- */
- public PortletWindow getActionWindow()
- {
- return actionWindow;
- }
-
- /**
- * Sets the target Portlet Action Window
- *
- * @param window
- */
- public void setActionWindow( PortletWindow portletWindow )
- {
- this.actionWindow = portletWindow;
- }
-
-
- /**
- * Set the capabilityMap. Used by the CapabilityValve
- *
- * @param capabilityMap
- */
- public void setCapabilityMap( CapabilityMap map )
- {
- this.capabilityMap = map;
- }
-
- /**
- * get the character encoding
- *
- *
- */
- public String getCharacterEncoding()
- {
- return this.encoding;
- }
-
- /**
- * set character encoding
- *
- * @param enc
- */
- public void setCharacterEncoding( String enc )
- {
- String preferedEnc = (String) session.getAttribute(PortalReservedParameters.PREFERED_CHARACTERENCODING_ATTRIBUTE);
-
- if (preferedEnc == null || !enc.equals(preferedEnc))
- {
- request.setAttribute(PortalReservedParameters.PREFERED_CHARACTERENCODING_ATTRIBUTE, enc);
- }
-
- this.encoding = enc;
- }
-
- /**
- * <p>
- * getRequestForWindow
- * </p>
- *
- * @see org.apache.jetspeed.request.RequestContext#getRequestForWindow(org.apache.jetspeed.container.PortletWindow)
- * @param window
- * @return
- */
- public HttpServletRequest getRequestForWindow( PortletWindow window )
- {
- if (!requestsForWindows.containsKey(window.getId()))
- {
- ServletRequestFactory reqFactory = rcc.getServletRequestFactory();
- HttpServletRequest requestWrapper = reqFactory.getServletRequest(request, window);
- requestsForWindows.put(window.getId(), requestWrapper);
- return requestWrapper;
- }
- else
- {
- return (HttpServletRequest) requestsForWindows.get(window.getId());
- }
-
- }
-
- /**
- * <p>
- * getResponseForWindow
- * </p>
- *
- * @see org.apache.jetspeed.request.RequestContext#getResponseForWindow(org.apache.jetspeed.container.PortletWindow)
- * @param window
- * @return
- */
- public HttpServletResponse getResponseForWindow( PortletWindow window )
- {
- HttpServletResponse wrappedResponse = null;
-
- if (!responsesForWindows.containsKey(window.getId()))
- {
- if (getContentDispatcher() != null)
- {
- wrappedResponse = ((ContentDispatcherCtrl) getContentDispatcher()).getResponseForWindow(window, this);
- }
- else
- {
- ServletResponseFactory rspFactory = rcc.getServletResponseFactory();
- wrappedResponse = rspFactory.getServletResponse(this.response);
- }
- responsesForWindows.put(window.getId(), wrappedResponse);
- return wrappedResponse;
- }
- else
- {
- return (HttpServletResponse) responsesForWindows.get(window.getId());
- }
- }
-
- /**
- * @see org.apache.jetspeed.request.RequestContext#getSubject()
- */
- public Subject getSubject()
- {
- return this.subject;
- }
-
- public Principal getUserPrincipal()
- {
- return SubjectHelper.getBestPrincipal(getSubject(), User.class);
- }
-
- /**
- * @see org.apache.jetspeed.request.RequestContext#setSubject(javax.security.auth.Subject)
- */
- public void setSubject( Subject subject )
- {
- this.subject = subject;
- }
-
- /**
- * @see org.apache.jetspeed.request.RequestContext#getLocale()
- */
- public Locale getLocale()
- {
- return this.locale;
- }
-
- /**
- * @see org.apache.jetspeed.request.RequestContext#setLocale(java.util.Locale)
- */
- public void setLocale( Locale locale )
- {
- Locale preferedLocale = (Locale) session.getAttribute(PortalReservedParameters.PREFERED_LOCALE_ATTRIBUTE);
-
- if (preferedLocale == null || !locale.equals(preferedLocale))
- {
- // PREFERED_LANGUAGE_ATTRIBUTE doesn't seem to be used anywhere anymore, and as a WeakHashMap isn't
- // Serializable, "fixing" that problem (JS2-174) by simply not putting it in the session anymore
- // request.getSession().setAttribute(PortalReservedParameters.PREFERED_LANGUAGE_ATTRIBUTE, new WeakHashMap());
- session.setAttribute(PortalReservedParameters.PREFERED_LOCALE_ATTRIBUTE, locale);
- request.setAttribute(PortalReservedParameters.PREFERED_LOCALE_ATTRIBUTE, locale);
- }
-
- this.locale = locale;
- }
-
- /**
- * @see org.apache.jetspeed.request.RequestContext#getRequestParameter(java.lang.String)
- */
- public String getRequestParameter( String key )
- {
- return request.getParameter(key);
- }
-
- public void setRequestParameter(String key, String value)
- {
- request.getParameterMap().put(key, value);
- }
-
- /**
- * @see org.apache.jetspeed.request.RequestContext#getParameterMap()
- */
- public Map getParameterMap()
- {
- return request.getParameterMap();
- }
-
- /**
- * @see org.apache.jetspeed.request.RequestContext#getRequestAttribute(java.lang.String)
- */
- public Object getRequestAttribute( String key )
- {
- return request.getAttribute(key);
- }
-
- /**
- * @see org.apache.jetspeed.request.RequestContext#getSessionAttribute(java.lang.String)
- */
- public Object getSessionAttribute( String key )
- {
- return session.getAttribute(key);
- }
-
- /**
- * @see org.apache.jetspeed.request.RequestContext#setSessionAttribute(java.lang.String,
- * java.lang.Object)
- */
- public void setSessionAttribute( String key, Object value )
- {
- session.setAttribute(key, value);
- }
-
- /**
- * @see org.apache.jetspeed.request.RequestContext#setAttribute(java.lang.String,
- * java.lang.Object)
- */
- public void setAttribute( String key, Object value )
- {
- request.setAttribute(key, value);
- }
-
- /**
- * @see org.apache.jetspeed.request.RequestContext#getAttribute(java.lang.String)
- */
- public Object getAttribute( String key )
- {
- return request.getAttribute(key);
- }
-
- /**
- * @see org.apache.jetspeed.request.RequestContext#getPath()
- */
- public String getPath()
- {
- if (this.requestPath == null)
- {
- this.requestPath = getPortalURL().getPath();
- }
- return this.requestPath;
- }
-
- public void setPortalURL(PortalURL url)
- {
- if ( this.url != null )
- throw new IllegalStateException("PortalURL already set");
- if ( url == null )
- throw new IllegalArgumentException("PortalURL may not be nullified");
- this.url = url;
- }
-
- public PortalURL getPortalURL()
- {
- return url;
- }
-
- public Map<String, String> getUserInfoMap(String appName)
- {
- return rcc.getUserInfoManager().getUserInfoMap(appName, this);
- }
-
- /**
- *
- * <p>
- * getPreferedLanguage
- * </p>
- *
- * @see org.apache.jetspeed.request.RequestContext#getPreferedLanguage(org.apache.pluto.om.portlet.PortletDefinition)
- * @param portlet
- * @return
- */
- public Language getPreferedLanguage( PortletDefinition portlet )
- {
- // TODO cannot get a proper Language when changing a locale by Locale
- // Selector
- // HttpSession session = request.getSession();
- // Map languageMap = (Map)
- // session.getAttribute(PREFERED_LANGUAGE_SESSION_KEY);
- // Language language = (Language) languageMap.get(portlet);
- // if(language != null)
- // {
- // return language;
- // }
-
- Language language = portlet.getLanguage(locale);
-
- if (language == null)
- {
- Enumeration locales = request.getLocales();
- while (language == null && locales.hasMoreElements())
- {
- Locale aLocale = (Locale) locales.nextElement();
- language = portlet.getLanguage(aLocale);
- }
- }
- if (language == null)
- {
- // defaultLocale will always be present, even if not persistent
- language = portlet.getLanguage(JetspeedLocale.getDefaultLocale());
- }
- return language;
- }
-
- /**
- * <p>
- * setPath
- * </p>
- *
- * @see org.apache.jetspeed.request.RequestContext#setPath(java.lang.String)
- * @param path
- */
- public void setPath( String path )
- {
- this.requestPath = path;
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.jetspeed.request.RequestContext#getActionFailure()
- */
- public Throwable popActionFailure(PortletWindow window)
- {
-
- String key = ACTION_ERROR_ATTR + window.getId();
- Throwable t = (Throwable) session.getAttribute(key);
- session.removeAttribute(key);
- return t;
-
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jetspeed.request.RequestContext#setActionFailed(java.lang.Throwable)
- */
- public void setActionFailure(PortletWindow window, Throwable actionFailure)
- {
- setSessionAttribute(ACTION_ERROR_ATTR + window.getId(),
- actionFailure);
- }
-
- /**
- * Get the current executing pipeline
- *
- * @return Pipeline
- */
- public Pipeline getPipeline()
- {
- return pipeline;
- }
-
-
- /**
- * Set the current pipeline
- * @param pipeline
- */
- public void setPipeline(Pipeline pipeline)
- {
- this.pipeline = pipeline;
- }
-
-
- /**
- * @param request The request to set.
- */
- public void setRequest(HttpServletRequest request)
- {
- this.request = request;
- }
-
- /**
- * @param response The request to set.
- */
- public void setResponse(HttpServletResponse response)
- {
- this.response = response;
- }
-
- public ContentPage locatePage(Profiler profiler, String nonProfiledPath)
- {
- try
- {
- String pathSave = this.getPath();
- this.setPath(nonProfiledPath);
- ContentPage realPage = this.getPage();
- this.setPage(null);
- Map locators = null;
- ProfileLocator locator = profiler.getProfile(this, ProfileLocator.PAGE_LOCATOR);
- if ( locator != null )
- {
- locators = new HashMap();
- locators.put(ProfileLocator.PAGE_LOCATOR, locator);
- }
- PortalSiteSessionContext sessionContext = (PortalSiteSessionContext)getSessionAttribute(ProfilerValveImpl.PORTAL_SITE_SESSION_CONTEXT_ATTR_KEY);
- PortalSiteRequestContext requestContext = sessionContext.newRequestContext(locators, true, true);
- ContentPage cpage = new ContentPageImpl(requestContext.getManagedPage());
- //System.out.println("page is " + cpage.getPath());
- this.setPage(realPage);
- this.setPath(pathSave);
- return cpage;
- }
- catch (Throwable t)
- {
- t.printStackTrace();
- }
- return null;
- }
-
- public Map<String, Object> getObjects()
- {
- return objects;
- }
-}
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.request;
+
+import java.security.Principal;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.security.auth.Subject;
+import javax.servlet.ServletConfig;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.apache.jetspeed.Jetspeed;
+import org.apache.jetspeed.PortalReservedParameters;
+import org.apache.jetspeed.aggregator.ContentDispatcher;
+import org.apache.jetspeed.aggregator.ContentDispatcherCtrl;
+import org.apache.jetspeed.capabilities.CapabilityMap;
+import org.apache.jetspeed.container.PortletWindow;
+import org.apache.jetspeed.container.url.PortalURL;
+import org.apache.jetspeed.engine.servlet.ServletRequestFactory;
+import org.apache.jetspeed.engine.servlet.ServletResponseFactory;
+import org.apache.jetspeed.om.page.ContentPage;
+import org.apache.jetspeed.om.page.ContentPageImpl;
+import org.apache.jetspeed.om.portlet.Language;
+import org.apache.jetspeed.pipeline.Pipeline;
+import org.apache.jetspeed.portalsite.PortalSiteRequestContext;
+import org.apache.jetspeed.portalsite.PortalSiteSessionContext;
+import org.apache.jetspeed.profiler.ProfileLocator;
+import org.apache.jetspeed.profiler.Profiler;
+import org.apache.jetspeed.profiler.impl.ProfilerValveImpl;
+import org.apache.jetspeed.security.SubjectHelper;
+import org.apache.jetspeed.security.User;
+import org.apache.jetspeed.util.JetspeedLocale;
+import org.apache.jetspeed.om.portlet.PortletDefinition;
+import org.apache.jetspeed.om.portlet.impl.LanguageImpl;
+
+/**
+ * Jetspeed Request Context is associated with each portal request. The request
+ * holds the contextual information shared amongst components in the portal,
+ * accessed through a common valve pipeline.
+ *
+ * @author <a href="mailto:david@bluesunrise.com">David Sean Taylor </a>
+ * @version $Id: JetspeedRequestContext.java,v 1.19 2004/05/25 01:37:12 taylor
+ * Exp $
+ */
+public class JetspeedRequestContext implements RequestContext
+{
+ private static final String ACTION_ERROR_ATTR = "org.apache.jetspeed.action.error:";
+ private RequestContextComponent rcc;
+ private HttpServletRequest request;
+ private HttpServletResponse response;
+ private ServletConfig config;
+ private HttpSession session;
+ private Map locators;
+ private ContentPage page;
+ private PortletDefinition portletDefinition;
+ private Subject subject;
+ private Locale locale;
+ private ContentDispatcher dispatcher;
+ private Pipeline pipeline;
+
+ private CapabilityMap capabilityMap;
+ private String mimeType;
+ private String mediaType;
+ private PortalURL url;
+ private PortletWindow actionWindow;
+ private String encoding;
+ private String requestPath = null;
+ private Map requestsForWindows;
+ private Map responsesForWindows;
+ private final Map<String, Object> objects;
+
+ /**
+ * Create a new Request Context
+ *
+ * @param pc
+ * @param request
+ * @param response
+ * @param config
+ */
+ public JetspeedRequestContext(RequestContextComponent rcc, HttpServletRequest request, HttpServletResponse response, ServletConfig config)
+ {
+ this(rcc, request, response, config, new HashMap<String, Object>());
+ }
+
+ public JetspeedRequestContext(RequestContextComponent rcc, HttpServletRequest request, HttpServletResponse response, ServletConfig config, Map<String, Object> objects)
+ {
+ this.rcc = rcc;
+ this.request = request;
+ this.response = response;
+ this.config = config;
+ this.session = request.getSession();
+ this.requestsForWindows = new HashMap();
+ this.responsesForWindows = new HashMap();
+ this.objects = objects;
+
+ // set context in Request for later use
+ if (null != this.request)
+ {
+ this.request.setAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE, this);
+ PortalRequestFactory prf = null;
+ try
+ {
+ prf = (PortalRequestFactory)Jetspeed.getComponentManager().getComponent(PortalRequestFactory.class);
+ }
+ catch (Throwable t)
+ {
+ // allow undefined
+ }
+ if ( prf != null )
+ {
+ this.request = prf.createPortalRequest(this.request);
+ }
+ else
+ {
+ // Simply wrap the current request so we maintain the same
+ // level of wrapping.
+ // This is needed in the ServletPortletInvoker to get back
+ // to the original request.
+ this.request = new HttpServletRequestWrapper(this.request);
+ }
+ }
+ }
+
+ public HttpServletRequest getRequest()
+ {
+ return request;
+ }
+
+ public HttpServletResponse getResponse()
+ {
+ return response;
+ }
+
+ public ServletConfig getConfig()
+ {
+ return config;
+ }
+
+ public Map getProfileLocators()
+ {
+ return locators;
+ }
+
+ public void setProfileLocators( Map locators )
+ {
+ this.locators = locators;
+ }
+
+ public ContentPage getPage()
+ {
+ return this.page;
+ }
+
+ public void setPage( ContentPage page )
+ {
+ this.page = page;
+ }
+
+ public PortletDefinition getPortletDefinition()
+ {
+ return portletDefinition;
+ }
+
+ public void setPortletDefinition( PortletDefinition portletDefinition )
+ {
+ this.portletDefinition = portletDefinition;
+ }
+
+ public ContentDispatcher getContentDispatcher()
+ {
+ return dispatcher;
+ }
+
+ public void setContentDispatcher( ContentDispatcher dispatcher )
+ {
+ this.dispatcher = dispatcher;
+ }
+
+ /**
+ * get the Capability Map
+ *
+ */
+ public CapabilityMap getCapabilityMap()
+ {
+ return this.capabilityMap;
+ }
+
+ /**
+ * Set the Mimetype. Used by the CapabilityValve
+ *
+ * @param mimeType
+ */
+ public void setMimeType( String mimeType )
+ {
+ this.mimeType = mimeType;
+ }
+
+ /**
+ * get the mimeType for the request
+ *
+ */
+ public String getMimeType()
+ {
+ return this.mimeType;
+ }
+
+ /**
+ * Set the mediaType. Used by the CapabilityValve
+ *
+ * @param mediaType
+ */
+ public void setMediaType( String mediaType )
+ {
+ this.mediaType = mediaType;
+ }
+
+ /**
+ * get the Media Type
+ *
+ */
+ public String getMediaType()
+ {
+ return this.mediaType;
+ }
+
+ /**
+ * Get the target Portlet Action Window
+ *
+ * @return PortletWindow The target portlet window
+ */
+ public PortletWindow getActionWindow()
+ {
+ return actionWindow;
+ }
+
+ /**
+ * Sets the target Portlet Action Window
+ *
+ * @param window
+ */
+ public void setActionWindow( PortletWindow portletWindow )
+ {
+ this.actionWindow = portletWindow;
+ }
+
+
+ /**
+ * Set the capabilityMap. Used by the CapabilityValve
+ *
+ * @param capabilityMap
+ */
+ public void setCapabilityMap( CapabilityMap map )
+ {
+ this.capabilityMap = map;
+ }
+
+ /**
+ * get the character encoding
+ *
+ *
+ */
+ public String getCharacterEncoding()
+ {
+ return this.encoding;
+ }
+
+ /**
+ * set character encoding
+ *
+ * @param enc
+ */
+ public void setCharacterEncoding( String enc )
+ {
+ String preferedEnc = (String) session.getAttribute(PortalReservedParameters.PREFERED_CHARACTERENCODING_ATTRIBUTE);
+
+ if (preferedEnc == null || !enc.equals(preferedEnc))
+ {
+ request.setAttribute(PortalReservedParameters.PREFERED_CHARACTERENCODING_ATTRIBUTE, enc);
+ }
+
+ this.encoding = enc;
+ }
+
+ /**
+ * <p>
+ * getRequestForWindow
+ * </p>
+ *
+ * @see org.apache.jetspeed.request.RequestContext#getRequestForWindow(org.apache.jetspeed.container.PortletWindow)
+ * @param window
+ * @return
+ */
+ public HttpServletRequest getRequestForWindow( PortletWindow window )
+ {
+ if (!requestsForWindows.containsKey(window.getId()))
+ {
+ ServletRequestFactory reqFactory = rcc.getServletRequestFactory();
+ HttpServletRequest requestWrapper = reqFactory.getServletRequest(request, window);
+ requestsForWindows.put(window.getId(), requestWrapper);
+ return requestWrapper;
+ }
+ else
+ {
+ return (HttpServletRequest) requestsForWindows.get(window.getId());
+ }
+
+ }
+
+ /**
+ * <p>
+ * getResponseForWindow
+ * </p>
+ *
+ * @see org.apache.jetspeed.request.RequestContext#getResponseForWindow(org.apache.jetspeed.container.PortletWindow)
+ * @param window
+ * @return
+ */
+ public HttpServletResponse getResponseForWindow( PortletWindow window )
+ {
+ HttpServletResponse wrappedResponse = null;
+
+ if (!responsesForWindows.containsKey(window.getId()))
+ {
+ if (getContentDispatcher() != null)
+ {
+ wrappedResponse = ((ContentDispatcherCtrl) getContentDispatcher()).getResponseForWindow(window, this);
+ }
+ else
+ {
+ ServletResponseFactory rspFactory = rcc.getServletResponseFactory();
+ wrappedResponse = rspFactory.getServletResponse(this.response);
+ }
+ responsesForWindows.put(window.getId(), wrappedResponse);
+ return wrappedResponse;
+ }
+ else
+ {
+ return (HttpServletResponse) responsesForWindows.get(window.getId());
+ }
+ }
+
+ /**
+ * @see org.apache.jetspeed.request.RequestContext#getSubject()
+ */
+ public Subject getSubject()
+ {
+ return this.subject;
+ }
+
+ public Principal getUserPrincipal()
+ {
+ return SubjectHelper.getBestPrincipal(getSubject(), User.class);
+ }
+
+ /**
+ * @see org.apache.jetspeed.request.RequestContext#setSubject(javax.security.auth.Subject)
+ */
+ public void setSubject( Subject subject )
+ {
+ this.subject = subject;
+ }
+
+ /**
+ * @see org.apache.jetspeed.request.RequestContext#getLocale()
+ */
+ public Locale getLocale()
+ {
+ return this.locale;
+ }
+
+ /**
+ * @see org.apache.jetspeed.request.RequestContext#setLocale(java.util.Locale)
+ */
+ public void setLocale( Locale locale )
+ {
+ Locale preferedLocale = (Locale) session.getAttribute(PortalReservedParameters.PREFERED_LOCALE_ATTRIBUTE);
+
+ if (preferedLocale == null || !locale.equals(preferedLocale))
+ {
+ // PREFERED_LANGUAGE_ATTRIBUTE doesn't seem to be used anywhere anymore, and as a WeakHashMap isn't
+ // Serializable, "fixing" that problem (JS2-174) by simply not putting it in the session anymore
+ // request.getSession().setAttribute(PortalReservedParameters.PREFERED_LANGUAGE_ATTRIBUTE, new WeakHashMap());
+ session.setAttribute(PortalReservedParameters.PREFERED_LOCALE_ATTRIBUTE, locale);
+ request.setAttribute(PortalReservedParameters.PREFERED_LOCALE_ATTRIBUTE, locale);
+ }
+
+ this.locale = locale;
+ }
+
+ /**
+ * @see org.apache.jetspeed.request.RequestContext#getRequestParameter(java.lang.String)
+ */
+ public String getRequestParameter( String key )
+ {
+ return request.getParameter(key);
+ }
+
+ public void setRequestParameter(String key, String value)
+ {
+ request.getParameterMap().put(key, value);
+ }
+
+ /**
+ * @see org.apache.jetspeed.request.RequestContext#getParameterMap()
+ */
+ public Map getParameterMap()
+ {
+ return request.getParameterMap();
+ }
+
+ /**
+ * @see org.apache.jetspeed.request.RequestContext#getRequestAttribute(java.lang.String)
+ */
+ public Object getRequestAttribute( String key )
+ {
+ return request.getAttribute(key);
+ }
+
+ /**
+ * @see org.apache.jetspeed.request.RequestContext#getSessionAttribute(java.lang.String)
+ */
+ public Object getSessionAttribute( String key )
+ {
+ return session.getAttribute(key);
+ }
+
+ /**
+ * @see org.apache.jetspeed.request.RequestContext#setSessionAttribute(java.lang.String,
+ * java.lang.Object)
+ */
+ public void setSessionAttribute( String key, Object value )
+ {
+ session.setAttribute(key, value);
+ }
+
+ /**
+ * @see org.apache.jetspeed.request.RequestContext#setAttribute(java.lang.String,
+ * java.lang.Object)
+ */
+ public void setAttribute( String key, Object value )
+ {
+ request.setAttribute(key, value);
+ }
+
+ /**
+ * @see org.apache.jetspeed.request.RequestContext#getAttribute(java.lang.String)
+ */
+ public Object getAttribute( String key )
+ {
+ return request.getAttribute(key);
+ }
+
+ /**
+ * @see org.apache.jetspeed.request.RequestContext#getPath()
+ */
+ public String getPath()
+ {
+ if (this.requestPath == null)
+ {
+ this.requestPath = getPortalURL().getPath();
+ }
+ return this.requestPath;
+ }
+
+ public void setPortalURL(PortalURL url)
+ {
+ if ( this.url != null )
+ throw new IllegalStateException("PortalURL already set");
+ if ( url == null )
+ throw new IllegalArgumentException("PortalURL may not be nullified");
+ this.url = url;
+ }
+
+ public PortalURL getPortalURL()
+ {
+ return url;
+ }
+
+ public Map<String, String> getUserInfoMap(String appName)
+ {
+ return rcc.getUserInfoManager().getUserInfoMap(appName, this);
+ }
+
+ /**
+ *
+ * <p>
+ * getPreferedLanguage
+ * </p>
+ *
+ * @see org.apache.jetspeed.request.RequestContext#getPreferedLanguage(org.apache.pluto.om.portlet.PortletDefinition)
+ * @param portlet
+ * @return
+ */
+ public Language getPreferedLanguage( PortletDefinition portlet )
+ {
+ // TODO cannot get a proper Language when changing a locale by Locale
+ // Selector
+ // HttpSession session = request.getSession();
+ // Map languageMap = (Map)
+ // session.getAttribute(PREFERED_LANGUAGE_SESSION_KEY);
+ // Language language = (Language) languageMap.get(portlet);
+ // if(language != null)
+ // {
+ // return language;
+ // }
+
+ Language language = portlet.getLanguage(locale);
+
+ if (language == null)
+ {
+ Enumeration locales = request.getLocales();
+ while (language == null && locales.hasMoreElements())
+ {
+ Locale aLocale = (Locale) locales.nextElement();
+ language = portlet.getLanguage(aLocale);
+ }
+ }
+ if (language == null)
+ {
+ // defaultLocale will always be present, even if not persistent
+ language = portlet.getLanguage(JetspeedLocale.getDefaultLocale());
+ }
+ return language;
+ }
+
+ /**
+ * <p>
+ * setPath
+ * </p>
+ *
+ * @see org.apache.jetspeed.request.RequestContext#setPath(java.lang.String)
+ * @param path
+ */
+ public void setPath( String path )
+ {
+ this.requestPath = path;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.request.RequestContext#getActionFailure()
+ */
+ public Throwable popActionFailure(PortletWindow window)
+ {
+
+ String key = ACTION_ERROR_ATTR + window.getId();
+ Throwable t = (Throwable) session.getAttribute(key);
+ session.removeAttribute(key);
+ return t;
+
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.jetspeed.request.RequestContext#setActionFailed(java.lang.Throwable)
+ */
+ public void setActionFailure(PortletWindow window, Throwable actionFailure)
+ {
+ setSessionAttribute(ACTION_ERROR_ATTR + window.getId(),
+ actionFailure);
+ }
+
+ /**
+ * Get the current executing pipeline
+ *
+ * @return Pipeline
+ */
+ public Pipeline getPipeline()
+ {
+ return pipeline;
+ }
+
+
+ /**
+ * Set the current pipeline
+ * @param pipeline
+ */
+ public void setPipeline(Pipeline pipeline)
+ {
+ this.pipeline = pipeline;
+ }
+
+
+ /**
+ * @param request The request to set.
+ */
+ public void setRequest(HttpServletRequest request)
+ {
+ this.request = request;
+ }
+
+ /**
+ * @param response The request to set.
+ */
+ public void setResponse(HttpServletResponse response)
+ {
+ this.response = response;
+ }
+
+ public ContentPage locatePage(Profiler profiler, String nonProfiledPath)
+ {
+ try
+ {
+ String pathSave = this.getPath();
+ this.setPath(nonProfiledPath);
+ ContentPage realPage = this.getPage();
+ this.setPage(null);
+ Map locators = null;
+ ProfileLocator locator = profiler.getProfile(this, ProfileLocator.PAGE_LOCATOR);
+ if ( locator != null )
+ {
+ locators = new HashMap();
+ locators.put(ProfileLocator.PAGE_LOCATOR, locator);
+ }
+ PortalSiteSessionContext sessionContext = (PortalSiteSessionContext)getSessionAttribute(ProfilerValveImpl.PORTAL_SITE_SESSION_CONTEXT_ATTR_KEY);
+ PortalSiteRequestContext requestContext = sessionContext.newRequestContext(locators, true, true);
+ ContentPage cpage = new ContentPageImpl(requestContext.getManagedPage());
+ //System.out.println("page is " + cpage.getPath());
+ this.setPage(realPage);
+ this.setPath(pathSave);
+ return cpage;
+ }
+ catch (Throwable t)
+ {
+ t.printStackTrace();
+ }
+ return null;
+ }
+
+ public Map<String, Object> getObjects()
+ {
+ return objects;
+ }
+}
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/JetspeedRequestContext.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/security/impl/Jetspeed1CredentialPasswordEncoder.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/security/impl/SecurityAccessControllerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/security/impl/ntlm/NtlmHttpServletRequestFilter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/security/impl/ntlm/NtlmHttpServletRequestWrapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/security/impl/ntlm/NtlmSecurityValve.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/security/impl/shibboleth/ShibbolethConfiguration.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/security/impl/shibboleth/ShibbolethPortalFilter.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/security/impl/shibboleth/ShibbolethPortalFilter.java?rev=725977&r1=725976&r2=725977&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/security/impl/shibboleth/ShibbolethPortalFilter.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/security/impl/shibboleth/ShibbolethPortalFilter.java Fri Dec 12 04:06:29 2008
@@ -1,193 +1,193 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jetspeed.security.impl.shibboleth;
-
-import java.io.IOException;
-import java.security.Principal;
-
-import javax.security.auth.Subject;
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-
-import org.apache.jetspeed.Jetspeed;
-import org.apache.jetspeed.PortalReservedParameters;
-import org.apache.jetspeed.administration.PortalAuthenticationConfiguration;
-import org.apache.jetspeed.audit.AuditActivity;
-import org.apache.jetspeed.login.LoginConstants;
-import org.apache.jetspeed.login.filter.PortalRequestWrapper;
-import org.apache.jetspeed.security.AuthenticationProvider;
-import org.apache.jetspeed.security.SecurityException;
-import org.apache.jetspeed.security.SubjectHelper;
-import org.apache.jetspeed.security.User;
-import org.apache.jetspeed.security.UserManager;
-import org.apache.jetspeed.security.UserSubjectPrincipal;
-
-public class ShibbolethPortalFilter implements Filter
-{
- protected String userNameHeader;
- protected Object sem = new Object();
-
- public void init(FilterConfig filterConfig) throws ServletException
- {
- }
-
- public void doFilter(ServletRequest sRequest, ServletResponse sResponse, FilterChain filterChain) throws IOException, ServletException
- {
- AuthenticationProvider authProvider = (AuthenticationProvider) Jetspeed.getComponentManager().getComponent(
- "org.apache.jetspeed.security.AuthenticationProvider");
- if (sRequest instanceof HttpServletRequest)
- {
- HttpServletRequest request = (HttpServletRequest) sRequest;
- if (userNameHeader == null)
- {
- synchronized (sem)
- {
- ShibbolethConfiguration config = (ShibbolethConfiguration) Jetspeed.getComponentManager().getComponent(
- "org.apache.jetspeed.security.shibboleth.ShibbolethConfiguration");
- userNameHeader = config.getHeaderMapping().get(ShibbolethConfiguration.USERNAME);
- }
- }
- String username = request.getHeader(userNameHeader);
- if (username != null)
- {
- Subject subject = (Subject) request.getSession().getAttribute(PortalReservedParameters.SESSION_KEY_SUBJECT);
- if (subject != null)
- {
- Principal principal = SubjectHelper.getPrincipal(subject, UserSubjectPrincipal.class);
- if (principal != null)
- {
- if (principal.getName().equals(username))
- {
- sRequest = wrapperRequest(request, subject, principal);
- if (filterChain != null)
- {
- filterChain.doFilter(sRequest, sResponse);
- return;
- }
- }
- }
- }
- UserManager userManager = (UserManager) Jetspeed.getComponentManager().getComponent("org.apache.jetspeed.security.UserManager");
- AuditActivity audit = (AuditActivity) Jetspeed.getComponentManager().getComponent("org.apache.jetspeed.audit.AuditActivity");
- ShibbolethConfiguration config = (ShibbolethConfiguration) Jetspeed.getComponentManager().getComponent(
- "org.apache.jetspeed.security.shibboleth.ShibbolethConfiguration");
- boolean success = false;
- if (config.isAuthenticate())
- {
- try
- {
- authProvider.authenticate(username, username);
- success = true;
- }
- catch (SecurityException e)
- {
- throw new ServletException();
- }
- }
- else
- {
- try
- {
- // load the user principals (roles, groups, credentials)
- User user = userManager.getUser(username);
- if (user != null)
- {
- subject = userManager.getSubject(user);
- }
- success = true;
- }
- catch (SecurityException sex)
- {
- success = false;
- }
- }
- if (success)
- {
- audit.logUserActivity(username, request.getRemoteAddr(), AuditActivity.AUTHENTICATION_SUCCESS, "ShibbolethFilter");
- PortalAuthenticationConfiguration authenticationConfiguration = (PortalAuthenticationConfiguration) Jetspeed.getComponentManager()
- .getComponent("org.apache.jetspeed.administration.PortalAuthenticationConfiguration");
- if (authenticationConfiguration.isCreateNewSessionOnLogin())
- {
- request.getSession().invalidate();
- }
- subject = null;
- try
- {
- // load the user principals (roles, groups, credentials)
- User user = userManager.getUser(username);
- if (user != null)
- {
- subject = userManager.getSubject(user);
- }
- }
- catch (SecurityException sex)
- {
- }
- Principal principal = SubjectHelper.getPrincipal(subject, User.class);
- sRequest = wrapperRequest(request, subject, principal);
- request.getSession().removeAttribute(LoginConstants.ERRORCODE);
- HttpSession session = request.getSession(true);
- session.setAttribute(PortalReservedParameters.SESSION_KEY_SUBJECT, subject);
- }
- else
- {
- audit.logUserActivity(username, request.getRemoteAddr(), AuditActivity.AUTHENTICATION_FAILURE, "ShibbolethFilter");
- request.getSession().setAttribute(LoginConstants.ERRORCODE, LoginConstants.ERROR_INVALID_PASSWORD);
- }
- }
- else
- {
- Subject subject = (Subject) request.getSession().getAttribute(PortalReservedParameters.SESSION_KEY_SUBJECT);
- if (subject != null)
- {
- Principal principal = SubjectHelper.getPrincipal(subject, User.class);
- ShibbolethConfiguration config = (ShibbolethConfiguration) Jetspeed.getComponentManager().getComponent(
- "org.apache.jetspeed.security.shibboleth.ShibbolethConfiguration");
- if (principal != null && principal.getName().equals(config.getGuestUser()))
- {
- }
- else
- {
- sRequest = wrapperRequest(request, subject, principal);
- }
- }
- }
- sRequest.setAttribute(PortalReservedParameters.PORTAL_FILTER_ATTRIBUTE, "true");
- }
-
- if (filterChain != null)
- {
- filterChain.doFilter(sRequest, sResponse);
- }
- }
-
- private ServletRequest wrapperRequest(HttpServletRequest request, Subject subject, Principal principal)
- {
- PortalRequestWrapper wrapper = new PortalRequestWrapper(request, subject, principal);
- return wrapper;
- }
-
- public void destroy()
- {
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.security.impl.shibboleth;
+
+import java.io.IOException;
+import java.security.Principal;
+
+import javax.security.auth.Subject;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.apache.jetspeed.Jetspeed;
+import org.apache.jetspeed.PortalReservedParameters;
+import org.apache.jetspeed.administration.PortalAuthenticationConfiguration;
+import org.apache.jetspeed.audit.AuditActivity;
+import org.apache.jetspeed.login.LoginConstants;
+import org.apache.jetspeed.login.filter.PortalRequestWrapper;
+import org.apache.jetspeed.security.AuthenticationProvider;
+import org.apache.jetspeed.security.SecurityException;
+import org.apache.jetspeed.security.SubjectHelper;
+import org.apache.jetspeed.security.User;
+import org.apache.jetspeed.security.UserManager;
+import org.apache.jetspeed.security.UserSubjectPrincipal;
+
+public class ShibbolethPortalFilter implements Filter
+{
+ protected String userNameHeader;
+ protected Object sem = new Object();
+
+ public void init(FilterConfig filterConfig) throws ServletException
+ {
+ }
+
+ public void doFilter(ServletRequest sRequest, ServletResponse sResponse, FilterChain filterChain) throws IOException, ServletException
+ {
+ AuthenticationProvider authProvider = (AuthenticationProvider) Jetspeed.getComponentManager().getComponent(
+ "org.apache.jetspeed.security.AuthenticationProvider");
+ if (sRequest instanceof HttpServletRequest)
+ {
+ HttpServletRequest request = (HttpServletRequest) sRequest;
+ if (userNameHeader == null)
+ {
+ synchronized (sem)
+ {
+ ShibbolethConfiguration config = (ShibbolethConfiguration) Jetspeed.getComponentManager().getComponent(
+ "org.apache.jetspeed.security.shibboleth.ShibbolethConfiguration");
+ userNameHeader = config.getHeaderMapping().get(ShibbolethConfiguration.USERNAME);
+ }
+ }
+ String username = request.getHeader(userNameHeader);
+ if (username != null)
+ {
+ Subject subject = (Subject) request.getSession().getAttribute(PortalReservedParameters.SESSION_KEY_SUBJECT);
+ if (subject != null)
+ {
+ Principal principal = SubjectHelper.getPrincipal(subject, UserSubjectPrincipal.class);
+ if (principal != null)
+ {
+ if (principal.getName().equals(username))
+ {
+ sRequest = wrapperRequest(request, subject, principal);
+ if (filterChain != null)
+ {
+ filterChain.doFilter(sRequest, sResponse);
+ return;
+ }
+ }
+ }
+ }
+ UserManager userManager = (UserManager) Jetspeed.getComponentManager().getComponent("org.apache.jetspeed.security.UserManager");
+ AuditActivity audit = (AuditActivity) Jetspeed.getComponentManager().getComponent("org.apache.jetspeed.audit.AuditActivity");
+ ShibbolethConfiguration config = (ShibbolethConfiguration) Jetspeed.getComponentManager().getComponent(
+ "org.apache.jetspeed.security.shibboleth.ShibbolethConfiguration");
+ boolean success = false;
+ if (config.isAuthenticate())
+ {
+ try
+ {
+ authProvider.authenticate(username, username);
+ success = true;
+ }
+ catch (SecurityException e)
+ {
+ throw new ServletException();
+ }
+ }
+ else
+ {
+ try
+ {
+ // load the user principals (roles, groups, credentials)
+ User user = userManager.getUser(username);
+ if (user != null)
+ {
+ subject = userManager.getSubject(user);
+ }
+ success = true;
+ }
+ catch (SecurityException sex)
+ {
+ success = false;
+ }
+ }
+ if (success)
+ {
+ audit.logUserActivity(username, request.getRemoteAddr(), AuditActivity.AUTHENTICATION_SUCCESS, "ShibbolethFilter");
+ PortalAuthenticationConfiguration authenticationConfiguration = (PortalAuthenticationConfiguration) Jetspeed.getComponentManager()
+ .getComponent("org.apache.jetspeed.administration.PortalAuthenticationConfiguration");
+ if (authenticationConfiguration.isCreateNewSessionOnLogin())
+ {
+ request.getSession().invalidate();
+ }
+ subject = null;
+ try
+ {
+ // load the user principals (roles, groups, credentials)
+ User user = userManager.getUser(username);
+ if (user != null)
+ {
+ subject = userManager.getSubject(user);
+ }
+ }
+ catch (SecurityException sex)
+ {
+ }
+ Principal principal = SubjectHelper.getPrincipal(subject, User.class);
+ sRequest = wrapperRequest(request, subject, principal);
+ request.getSession().removeAttribute(LoginConstants.ERRORCODE);
+ HttpSession session = request.getSession(true);
+ session.setAttribute(PortalReservedParameters.SESSION_KEY_SUBJECT, subject);
+ }
+ else
+ {
+ audit.logUserActivity(username, request.getRemoteAddr(), AuditActivity.AUTHENTICATION_FAILURE, "ShibbolethFilter");
+ request.getSession().setAttribute(LoginConstants.ERRORCODE, LoginConstants.ERROR_INVALID_PASSWORD);
+ }
+ }
+ else
+ {
+ Subject subject = (Subject) request.getSession().getAttribute(PortalReservedParameters.SESSION_KEY_SUBJECT);
+ if (subject != null)
+ {
+ Principal principal = SubjectHelper.getPrincipal(subject, User.class);
+ ShibbolethConfiguration config = (ShibbolethConfiguration) Jetspeed.getComponentManager().getComponent(
+ "org.apache.jetspeed.security.shibboleth.ShibbolethConfiguration");
+ if (principal != null && principal.getName().equals(config.getGuestUser()))
+ {
+ }
+ else
+ {
+ sRequest = wrapperRequest(request, subject, principal);
+ }
+ }
+ }
+ sRequest.setAttribute(PortalReservedParameters.PORTAL_FILTER_ATTRIBUTE, "true");
+ }
+
+ if (filterChain != null)
+ {
+ filterChain.doFilter(sRequest, sResponse);
+ }
+ }
+
+ private ServletRequest wrapperRequest(HttpServletRequest request, Subject subject, Principal principal)
+ {
+ PortalRequestWrapper wrapper = new PortalRequestWrapper(request, subject, principal);
+ return wrapper;
+ }
+
+ public void destroy()
+ {
+ }
+}
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/security/impl/shibboleth/ShibbolethPortalFilter.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/services/title/DynamicTitleService.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/services/title/DynamicTitleService.java?rev=725977&r1=725976&r2=725977&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/services/title/DynamicTitleService.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/services/title/DynamicTitleService.java Fri Dec 12 04:06:29 2008
@@ -14,15 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.jetspeed.services.title;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.jetspeed.container.PortletWindow;
-
-
-public interface DynamicTitleService
-{
+package org.apache.jetspeed.services.title;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.jetspeed.container.PortletWindow;
+
+
+public interface DynamicTitleService
+{
String getDynamicTitle(PortletWindow window, HttpServletRequest request);
void setDynamicTitle(PortletWindow window, HttpServletRequest request, String dynamicTitle);
-}
+}
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/services/title/DynamicTitleService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/tools/pamanager/PortletApplicationManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/tools/pamanager/VersionedPortletApplicationManager.java
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org
|