You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@empire-db.apache.org by do...@apache.org on 2010/10/24 21:02:29 UTC
svn commit: r1026865 [1/2] - in
/incubator/empire-db/trunk/empire-db-struts2: ./
src/main/java/org/apache/empire/struts2/action/
src/main/java/org/apache/empire/struts2/html/
src/main/java/org/apache/empire/struts2/interceptors/
src/main/java/org/apach...
Author: doebele
Date: Sun Oct 24 19:02:28 2010
New Revision: 1026865
URL: http://svn.apache.org/viewvc?rev=1026865&view=rev
Log:
EMPIREDB-89
Added:
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/AppContext.java (with props)
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/EmpirePortletDispatcher.java (with props)
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/EmpirePortletResult.java (with props)
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/EmpireThreadManager.java (with props)
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/RequestContext.java (with props)
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/ResponseContext.java (with props)
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/SessionContext.java (with props)
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/UrlHelperEx.java (with props)
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/portlet/
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/portlet/PortletContextWrapper.java (with props)
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/portlet/PortletRequestWrapper.java (with props)
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/portlet/PortletResponseWrapper.java (with props)
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/portlet/PortletSessionWrapper.java (with props)
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/servlet/
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/servlet/ServletContextWrapper.java (with props)
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/servlet/ServletRequestWrapper.java (with props)
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/servlet/ServletResponseWrapper.java (with props)
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/servlet/ServletSessionWrapper.java (with props)
incubator/empire-db/trunk/empire-db-struts2/src/main/resources/struts-empire.xml (with props)
Modified:
incubator/empire-db/trunk/empire-db-struts2/dependencies.txt
incubator/empire-db/trunk/empire-db-struts2/pom.xml
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/action/WebAction.java
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/html/HtmlWriter.java
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/interceptors/ActionBasicsInterceptor.java
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/interceptors/InterceptorSupport.java
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/components/AnchorComponent.java
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/components/CalendarComponent.java
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/components/DataValueComponent.java
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/components/FormComponent.java
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/controls/InputControl.java
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/controls/TextAreaInputControl.java
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/controls/TextInputControl.java
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/tags/DataValueTag.java
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/tags/LinkTag.java
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/DefaultWebRequest.java
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/EmpireFilterDispatcher.java
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/EmpireStrutsDispatcher.java
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/WebApplication.java
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/WebRequest.java
incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/WebSession.java
incubator/empire-db/trunk/empire-db-struts2/src/main/resources/META-INF/empire-tags.tld
Modified: incubator/empire-db/trunk/empire-db-struts2/dependencies.txt
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-struts2/dependencies.txt?rev=1026865&r1=1026864&r2=1026865&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-struts2/dependencies.txt (original)
+++ incubator/empire-db/trunk/empire-db-struts2/dependencies.txt Sun Oct 24 19:02:28 2010
@@ -1,5 +1,5 @@
Apache Empire-db
-Copyright 2008-2009 The Apache Software Foundation
+Copyright 2008-2010 The Apache Software Foundation
empire-struts2-ext dependency info
----------------------------------
@@ -13,12 +13,15 @@ From Apache Commons / Logging:
- commons-beanutils-1.7.0.jar
- commons-collections-3.2.1.jar
- commons-logging-1.0.4.jar
+- commons-fileupload-1.2.1.jar
- log4j-1.2.14.jar
From Sun JEE:
-- servlet-api.jar
-- jsp-api.jar
+- servlet-api-2.4.jar
+- portlet-api-1.0.jar
+- jsp-api-2.0.jar
From Apache Struts2:
-- struts2-core-2.0.x.jar
-- xwork-2.0.5.jar
+- struts2-core-2.2.1.jar
+- struts2-portlet-plugin-2.2.1.jar
+- xwork-core-2.2.1.jar
Modified: incubator/empire-db/trunk/empire-db-struts2/pom.xml
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-struts2/pom.xml?rev=1026865&r1=1026864&r2=1026865&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-struts2/pom.xml (original)
+++ incubator/empire-db/trunk/empire-db-struts2/pom.xml Sun Oct 24 19:02:28 2010
@@ -35,6 +35,10 @@
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.struts</groupId>
+ <artifactId>struts2-portlet-plugin</artifactId>
+ </dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
@@ -43,5 +47,9 @@
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
</dependency>
+ <dependency>
+ <groupId>javax.portlet</groupId>
+ <artifactId>portlet-api</artifactId>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
Modified: incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/action/WebAction.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/action/WebAction.java?rev=1026865&r1=1026864&r2=1026865&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/action/WebAction.java (original)
+++ incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/action/WebAction.java Sun Oct 24 19:02:28 2010
@@ -38,10 +38,10 @@ import org.apache.empire.struts2.actions
import org.apache.empire.struts2.actionsupport.ActionError;
import org.apache.empire.struts2.actionsupport.ActionPropertySupport;
import org.apache.empire.struts2.actionsupport.TextProviderActionSupport;
-import org.apache.empire.struts2.web.EmpireStrutsDispatcher;
+import org.apache.empire.struts2.web.EmpireThreadManager;
+import org.apache.empire.struts2.web.UrlHelperEx;
import org.apache.empire.struts2.web.WebErrors;
import org.apache.empire.struts2.web.WebRequest;
-import org.apache.struts2.views.util.UrlHelper;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.TextProvider;
@@ -63,6 +63,8 @@ public abstract class WebAction extends
// Default Name for Item param
public static String DEFAULT_ITEM_PROPERTY_NAME = "item";
+ public static String PORTLET_ACTION_RESULT = "struts.portlet.actionResult";
+
private final transient TextProvider textProvider = TextProviderActionSupport.getInstance(getClass(), this); // new TextProviderFactory().createInstance(getClass(), this);
private ActionPropertySupport itemProperty = new ActionPropertySupport(this, DEFAULT_ITEM_PROPERTY_NAME, true);
@@ -502,9 +504,15 @@ public abstract class WebAction extends
// ------- URL generator -------
+ /**
+ * returns the url for an action.
+ * Waring: The following function may only use in a Servlet environment.
+ * @deprecated
+ */
+ @Deprecated
public String getActionURL(String action, Map parameters)
{
- Object request = EmpireStrutsDispatcher.getCurrentRequest();
+ Object request = EmpireThreadManager.getCurrentRequest();
if ((request instanceof WebRequest)==false)
{
log.error("cannot determine action URL. Request object does not implement WebRequest");
@@ -517,7 +525,18 @@ public abstract class WebAction extends
if (uri.indexOf('.')<0)
uri += ".action";
// now build the url
- return UrlHelper.buildUrl(uri, webRequest.getHttpRequest(), webRequest.getHttpResponse(), parameters, null, true, true);
+ return UrlHelperEx.buildUrl(uri, webRequest.getRequestContext(), webRequest.getResponseContext(), parameters, null, true, true);
+ }
+
+ // ----------- Portlet --------------
+
+ public String renderPortlet()
+ {
+ Map<String, Object> sessionMap = ActionContext.getContext().getSession();
+ Object result = sessionMap.get(PORTLET_ACTION_RESULT);
+ if (log.isDebugEnabled())
+ log.debug("Processing portlet render result with result=" + result);
+ return result.toString();
}
}
Modified: incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/html/HtmlWriter.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/html/HtmlWriter.java?rev=1026865&r1=1026864&r2=1026865&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/html/HtmlWriter.java (original)
+++ incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/html/HtmlWriter.java Sun Oct 24 19:02:28 2010
@@ -24,7 +24,7 @@ import java.io.Writer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.empire.commons.StringUtils;
-import org.apache.struts2.views.util.TextUtil;
+import org.apache.commons.lang.xwork.StringEscapeUtils;
public class HtmlWriter
@@ -75,7 +75,7 @@ public class HtmlWriter
// Get String value
String strValue = StringUtils.valueOf(value);
if (escapeHtml)
- strValue = TextUtil.escapeHTML(strValue);
+ strValue = StringEscapeUtils.escapeHtml(strValue);
// Add Attribute
w.print(" ");
w.print(attrib);
@@ -92,7 +92,7 @@ public class HtmlWriter
if (strValue==null || strValue.length()==0)
return; // Ingore Emtpy Strings
if (escapeHtml)
- strValue = TextUtil.escapeHTML(strValue);
+ strValue = StringEscapeUtils.escapeHtml(strValue);
w.print(" ");
w.print(attrib);
w.print("=\"");
Modified: incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/interceptors/ActionBasicsInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/interceptors/ActionBasicsInterceptor.java?rev=1026865&r1=1026864&r2=1026865&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/interceptors/ActionBasicsInterceptor.java (original)
+++ incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/interceptors/ActionBasicsInterceptor.java Sun Oct 24 19:02:28 2010
@@ -18,6 +18,8 @@
*/
package org.apache.empire.struts2.interceptors;
+import javax.servlet.http.HttpServletRequest;
+
import org.apache.empire.struts2.action.Disposable;
import org.apache.empire.struts2.action.ExceptionAware;
import org.apache.struts2.ServletActionContext;
@@ -29,6 +31,8 @@ import com.opensymphony.xwork2.ActionPro
@SuppressWarnings("serial")
public class ActionBasicsInterceptor extends InterceptorSupport
{
+ public final String RENDER_ACTION_RESULT = "RENDER_ACTION_RESULT";
+
private String errorAction = null;
public void setErrorAction(String errorAction)
@@ -41,20 +45,23 @@ public class ActionBasicsInterceptor ext
{
// Set the action object to the HttpRequest
Object action = invocation.getAction();
+ String result = null;
// Call base
try {
// Log Info
if (log.isInfoEnabled())
log.info("Processing action " + action.getClass().getName() + " for uri= " + ServletActionContext.getRequest().getRequestURI());
- // Store action on Request
- ServletActionContext.getRequest().setAttribute("action", action);
+ // Set Action and initialize
+ HttpServletRequest req = ServletActionContext.getRequest();
+ req.setAttribute("action", action);
// Check Disposible interface and call init
if (action instanceof Disposable)
{
((Disposable)action).init();
}
// Invoke Action
- return invocation.invoke();
+ result = invocation.invoke();
+ return result;
} catch (Exception e) {
// catch everything here and forward exception
@@ -62,7 +69,7 @@ public class ActionBasicsInterceptor ext
log.error("An exception occurred while processing the action " + proxy.getActionName() + "!" + proxy.getMethod(), e);
if (action instanceof ExceptionAware)
{ // Let action handle it
- String result = ((ExceptionAware)action).handleException(e, proxy.getMethod());
+ result = ((ExceptionAware)action).handleException(e, proxy.getMethod());
if (result!=null && result.length()>0)
return result;
}
@@ -72,6 +79,28 @@ public class ActionBasicsInterceptor ext
// Forward the action
throw(e);
}
+ /*
+ finally {
+ // Detect DirectRenderPortlet
+ if (PortletActionContext.isEvent())
+ {
+ Map sessionMap = invocation.getInvocationContext().getSession();
+ if (sessionMap.containsKey(PortletActionConstants.RENDER_DIRECT_LOCATION))
+ { // Save current action for rendering
+ ActionResponse res = PortletActionContext.getActionResponse();
+ // View is rendered outside an action...uh oh...
+ String namespace = invocation.getProxy().getNamespace();
+ if (namespace != null && namespace.length() > 0 && !namespace.endsWith("/")) {
+ namespace += "/";
+
+ }
+ String actionName = ActionContext.getContext().getActionInvocation().getProxy().getActionName();
+ res.setRenderParameter(PortletActionConstants.ACTION_PARAM, namespace + actionName +"!portletRender");
+ sessionMap.put(RENDER_ACTION_RESULT, result);
+ sessionMap.remove(PortletActionConstants.RENDER_DIRECT_LOCATION);
+ }
+ }
+ }
+ */
}
-
}
Modified: incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/interceptors/InterceptorSupport.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/interceptors/InterceptorSupport.java?rev=1026865&r1=1026864&r2=1026865&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/interceptors/InterceptorSupport.java (original)
+++ incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/interceptors/InterceptorSupport.java Sun Oct 24 19:02:28 2010
@@ -20,12 +20,17 @@ package org.apache.empire.struts2.interc
import java.io.IOException;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts2.ServletActionContext;
+import org.apache.struts2.portlet.servlet.PortletServletRequest;
+import org.apache.struts2.portlet.servlet.PortletServletResponse;
import org.apache.struts2.views.util.UrlHelper;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
@@ -42,6 +47,14 @@ public abstract class InterceptorSupport
throws IOException
{
HttpServletRequest req = ServletActionContext.getRequest();
+ if (req instanceof PortletServletRequest)
+ return redirectPortletRequest(((PortletServletRequest)req).getPortletRequest(), target, appendSourceUri);
+ else return redirectServletRequest(req, target, appendSourceUri);
+ }
+
+ private String redirectServletRequest(HttpServletRequest req, String target, boolean appendSourceUri)
+ throws IOException
+ {
// Create rediect URL
StringBuffer url = new StringBuffer();
if (target.indexOf('/')<0)
@@ -73,4 +86,37 @@ public abstract class InterceptorSupport
return NONE;
}
+ private String redirectPortletRequest(PortletRequest req, String target, boolean appendSourceUri)
+ throws IOException
+ {
+ // Create rediect URL
+ StringBuffer url = new StringBuffer();
+ if (target.indexOf('/')<0)
+ {
+ url.append(req.getContextPath());
+ url.append('/');
+ }
+ // The Target
+ url.append(target);
+ // Add .action
+ if (target.indexOf('?')<0 && target.indexOf('.')<0)
+ {
+ url.append(".action");
+ }
+ // Redirect
+ HttpServletResponse servletResponse = ServletActionContext.getResponse();
+ PortletResponse portletResponse = ((PortletServletResponse)servletResponse).getPortletResponse();
+ if (portletResponse instanceof ActionResponse)
+ {
+ ActionResponse actionResponse = (ActionResponse)portletResponse;
+ String redirectURL = actionResponse.encodeURL(url.toString());
+ actionResponse.sendRedirect( redirectURL );
+ }
+ else
+ {
+ log.error("Unable to redirect the portlet RenderRequest to " + url.toString());
+ }
+ return NONE;
+ }
+
}
Modified: incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/components/AnchorComponent.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/components/AnchorComponent.java?rev=1026865&r1=1026864&r2=1026865&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/components/AnchorComponent.java (original)
+++ incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/components/AnchorComponent.java Sun Oct 24 19:02:28 2010
@@ -18,6 +18,7 @@
*/
package org.apache.empire.struts2.jsp.components;
+import java.io.StringWriter;
import java.io.Writer;
import javax.servlet.http.HttpServletRequest;
@@ -38,7 +39,6 @@ public class AnchorComponent extends Anc
// Logger
protected static Log log = LogFactory.getLog(AnchorComponent.class);
- private String action;
private String text;
/*
* EMPIREDB-45
@@ -54,8 +54,17 @@ public class AnchorComponent extends Anc
super(stack, req, res);
}
- public String getUrl(String actionName)
+ public String getUrl()
{
+ /*
+ * build url
+ * see super.evaluateExtraParams()
+ */
+ StringWriter sw = new StringWriter();
+ urlRenderer.beforeRenderUrl(urlProvider);
+ urlRenderer.renderUrl(sw, urlProvider);
+ return sw.toString();
+ /*
String namespace = null;
String method = null;
String scheme = null;
@@ -65,6 +74,7 @@ public class AnchorComponent extends Anc
boolean escapeAmp = true;
return this.determineActionURL(actionName, namespace, method, request, response, parameters, scheme,
includeContext, encodeResult, forceAddSchemeHostAndPort, escapeAmp);
+ */
}
@Override
@@ -74,12 +84,12 @@ public class AnchorComponent extends Anc
return true;
}
- @SuppressWarnings("unchecked")
@Override
public boolean start(Writer writer)
{
- // return super.start(writer);
- // evaluateParams(); // We need to call this!
+ // super.start(writer);
+ // evaluateParams();
+ this.processingTagBody = true;
return true;
}
@@ -99,7 +109,7 @@ public class AnchorComponent extends Anc
// The Anchors
if (disabled==false)
{
- String url = getUrl(action);
+ String url = getUrl();
HtmlTag a = htmlWriter.startTag("a");
a.addAttribute("id", this.getId());
@@ -137,9 +147,10 @@ public class AnchorComponent extends Anc
}
}
- public void setAction(String action)
+ public void setUrlType(String urlType)
{
- this.action = action;
+ if (urlType!=null)
+ urlProvider.setPortletUrlType(urlType);
}
public void setText(String text)
Modified: incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/components/CalendarComponent.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/components/CalendarComponent.java?rev=1026865&r1=1026864&r2=1026865&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/components/CalendarComponent.java (original)
+++ incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/components/CalendarComponent.java Sun Oct 24 19:02:28 2010
@@ -18,6 +18,7 @@
*/
package org.apache.empire.struts2.jsp.components;
+import java.io.StringWriter;
import java.io.Writer;
import java.util.Map;
@@ -32,8 +33,12 @@ import org.apache.empire.struts2.html.Ht
import org.apache.empire.struts2.html.HtmlWriter.HtmlTag;
import org.apache.empire.struts2.jsp.components.info.CalendarInfo;
import org.apache.empire.struts2.jsp.components.info.CalendarInfo.CalendarDayInfo;
+import org.apache.struts2.components.ComponentUrlProvider;
import org.apache.struts2.components.UIBean;
+import org.apache.struts2.components.UrlProvider;
+import org.apache.struts2.components.UrlRenderer;
+import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.util.ValueStack;
@@ -42,6 +47,8 @@ public class CalendarComponent extends U
// Logger
protected static Log log = LogFactory.getLog(ControlComponent.class);
+ protected UrlRenderer urlRenderer;
+
private CalendarInfo calendarInfo = null;
private String selectDateAction = null;
private String selectWeekdayAction = null;
@@ -256,9 +263,28 @@ public class CalendarComponent extends U
link.endTag();
}
- public String getUrl(String actionName, Map params)
+ public String getUrl(String actionName, Map<String, Object> params)
{
- String namespace = null;
+ // JAVASCRIPT ?
+ if (actionName.startsWith("javascript:"))
+ return actionName;
+
+ // Init URL Provider
+ UrlProvider urlProvider = new ComponentUrlProvider(this, params);
+ urlProvider.setHttpServletRequest(request);
+ urlProvider.setHttpServletResponse(response);
+ urlProvider.setUrlRenderer(urlRenderer);
+ // urlProvider.setPortletUrlType(urlType);
+ urlProvider.setAction(actionName);
+ // render URL
+ StringWriter sw = new StringWriter();
+ urlRenderer.beforeRenderUrl(urlProvider);
+ urlRenderer.renderUrl(sw, urlProvider);
+ String url = sw.toString();
+ return url;
+
+ /*
+ String namespace = null;
String method = null;
String scheme = null;
boolean includeContext = true;
@@ -267,10 +293,17 @@ public class CalendarComponent extends U
boolean escapeAmp = true;
return this.determineActionURL(actionName, namespace, method, request, response, params, scheme,
includeContext, encodeResult, forceAddSchemeHostAndPort, escapeAmp);
+ */
}
// ------- Property setters -------
+ @Inject
+ public void setUrlRenderer(UrlRenderer urlRenderer)
+ { // urlProvider.setUrlRenderer(urlRenderer);
+ this.urlRenderer = urlRenderer;
+ }
+
public void setCalendarInfo(CalendarInfo calendarInfo)
{
this.calendarInfo = calendarInfo;
Modified: incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/components/DataValueComponent.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/components/DataValueComponent.java?rev=1026865&r1=1026864&r2=1026865&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/components/DataValueComponent.java (original)
+++ incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/components/DataValueComponent.java Sun Oct 24 19:02:28 2010
@@ -18,6 +18,8 @@
*/
package org.apache.empire.struts2.jsp.components;
+import java.io.StringWriter;
+
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -26,7 +28,11 @@ import org.apache.commons.logging.LogFac
import org.apache.empire.struts2.html.HtmlWriter;
import org.apache.empire.struts2.html.HtmlWriter.HtmlTag;
import org.apache.empire.struts2.jsp.controls.InputControl;
+import org.apache.struts2.components.ComponentUrlProvider;
+import org.apache.struts2.components.UrlProvider;
+import org.apache.struts2.components.UrlRenderer;
+import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.util.ValueStack;
@@ -36,11 +42,14 @@ public class DataValueComponent extends
@SuppressWarnings("hiding")
protected static Log log = LogFactory.getLog(DataValueComponent.class);
+ protected UrlRenderer urlRenderer;
+
// the wrapper Tag
private String htmlTag;
// Link
private String action;
+ private String urlType;
private Object alt; // for the <a title="xxx" tag (alternative text)
private String anchorClass;
@@ -49,12 +58,27 @@ public class DataValueComponent extends
super(control, stack, req, res);
}
- public String getURL(String actionName)
+ public String getURL()
{
// JAVASCRIPT ?
- if (actionName.startsWith("javascript:"))
- return actionName;
+ if (action.startsWith("javascript:"))
+ return action;
+
+ // Init URL Provider
+ UrlProvider urlProvider = new ComponentUrlProvider(this, parameters);
+ urlProvider.setHttpServletRequest(request);
+ urlProvider.setHttpServletResponse(response);
+ urlProvider.setUrlRenderer(urlRenderer);
+ urlProvider.setPortletUrlType(urlType);
+ urlProvider.setAction(action);
+ // render URL
+ StringWriter sw = new StringWriter();
+ urlRenderer.beforeRenderUrl(urlProvider);
+ urlRenderer.renderUrl(sw, urlProvider);
+ String url = sw.toString();
+ return url;
+ /*
String namespace = null;
String method = null;
String scheme = null;
@@ -62,9 +86,16 @@ public class DataValueComponent extends
boolean encodeResult = true;
boolean forceAddSchemeHostAndPort = false;
boolean escapeAmp = true;
- return this.determineActionURL(actionName, namespace, method, request, response, parameters, scheme,
+ return this.determineActionURL(action, namespace, method, request, response, parameters, scheme,
includeContext, encodeResult, forceAddSchemeHostAndPort, escapeAmp);
+ */
}
+
+ @Inject
+ public void setUrlRenderer(UrlRenderer urlRenderer)
+ { // urlProvider.setUrlRenderer(urlRenderer);
+ this.urlRenderer = urlRenderer;
+ }
@SuppressWarnings("unchecked")
public void setParam(String key, String value)
@@ -90,7 +121,7 @@ public class DataValueComponent extends
HtmlTag anchor = null;
if (action!=null)
{
- String url = getURL(action);
+ String url = getURL();
// print href
anchor = hw.startTag("a");
anchor.addAttribute("href", url);
@@ -123,6 +154,11 @@ public class DataValueComponent extends
{
this.action = action;
}
+
+ public void setUrlType(String urlType)
+ {
+ this.urlType = urlType;
+ }
public void setAnchorClass(String anchorClass)
{
Modified: incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/components/FormComponent.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/components/FormComponent.java?rev=1026865&r1=1026864&r2=1026865&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/components/FormComponent.java (original)
+++ incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/components/FormComponent.java Sun Oct 24 19:02:28 2010
@@ -23,6 +23,7 @@ import java.io.Writer;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.apache.commons.lang.xwork.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.empire.struts2.html.HtmlWriter;
@@ -62,9 +63,10 @@ public class FormComponent extends Form
// render form Tag?
if (readOnly==false)
{
+ urlRenderer.renderFormUrl(this);
formTag = htmlWriter.startTag("form");
- formTag.addAttribute("id", this.getId());
- formTag.addAttribute("name", this.name);
+ formTag.addAttribute("id", getId());
+ formTag.addAttribute("name", getName());
formTag.addAttribute("onsubmit", this.onsubmit);
formTag.addAttribute("action", getURL(action));
formTag.addAttribute("target", this.target);
@@ -100,17 +102,29 @@ public class FormComponent extends Form
}
}
+ @Override
+ public String getId()
+ {
+ if (StringUtils.isEmpty(id)==false)
+ return id;
+ // Check for id Attribute
+ Object p = getParameters().get("id");
+ return (p!=null) ? p.toString() : null;
+ }
+
+ public String getName()
+ {
+ if (StringUtils.isEmpty(name)==false)
+ return name;
+ // Check for id Attribute
+ Object p = getParameters().get("name");
+ return (p!=null) ? p.toString() : null;
+ }
+
private String getURL(String action)
{
- String namespace = null;
- String method = null;
- String scheme = null;
- boolean includeContext = true;
- boolean encodeResult = true;
- boolean forceAddSchemeHostAndPort = false;
- boolean escapeAmp = true;
- return this.determineActionURL(action, namespace, method, request, response, null, scheme,
- includeContext, encodeResult, forceAddSchemeHostAndPort, escapeAmp);
+ Object url = getParameters().get("action");
+ return String.valueOf(url);
}
public void setReadOnly(boolean readOnly)
Modified: incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/controls/InputControl.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/controls/InputControl.java?rev=1026865&r1=1026864&r2=1026865&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/controls/InputControl.java (original)
+++ incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/controls/InputControl.java Sun Oct 24 19:02:28 2010
@@ -31,7 +31,7 @@ import org.apache.empire.struts2.action.
import org.apache.empire.struts2.html.HtmlTagDictionary;
import org.apache.empire.struts2.html.HtmlWriter;
import org.apache.empire.struts2.html.HtmlWriter.HtmlTag;
-import org.apache.struts2.views.util.TextUtil;
+import org.apache.commons.lang.xwork.StringEscapeUtils;
public abstract class InputControl
@@ -319,7 +319,7 @@ public abstract class InputControl
if (hasFormatOption(vi, "noencode"))
return s;
// Encode Html
- return TextUtil.escapeHTML(s, false);
+ return StringEscapeUtils.escapeHtml(s);
}
/**
Modified: incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/controls/TextAreaInputControl.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/controls/TextAreaInputControl.java?rev=1026865&r1=1026864&r2=1026865&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/controls/TextAreaInputControl.java (original)
+++ incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/controls/TextAreaInputControl.java Sun Oct 24 19:02:28 2010
@@ -25,8 +25,7 @@ import org.apache.empire.data.Column;
import org.apache.empire.struts2.html.HtmlTagDictionary;
import org.apache.empire.struts2.html.HtmlWriter;
import org.apache.empire.struts2.html.HtmlWriter.HtmlTag;
-
-import com.opensymphony.xwork2.util.TextUtils;
+import org.apache.commons.lang.xwork.StringEscapeUtils;
public class TextAreaInputControl extends InputControl
@@ -128,7 +127,7 @@ public class TextAreaInputControl extend
input.addAttribute("onblur", ci.getOnblur());
// Body
String value = StringUtils.toString(ci.getValue());
- value = TextUtils.htmlEncode(value);
+ value = StringEscapeUtils.escapeHtml(value);
input.beginBody(value);
// End
input.endTag();
Modified: incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/controls/TextInputControl.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/controls/TextInputControl.java?rev=1026865&r1=1026864&r2=1026865&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/controls/TextInputControl.java (original)
+++ incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/controls/TextInputControl.java Sun Oct 24 19:02:28 2010
@@ -33,7 +33,7 @@ import org.apache.empire.data.DataType;
import org.apache.empire.struts2.html.HtmlWriter;
import org.apache.empire.struts2.html.HtmlWriter.HtmlTag;
import org.apache.empire.struts2.web.WebErrors;
-import org.apache.struts2.views.util.TextUtil;
+import org.apache.commons.lang.xwork.StringEscapeUtils;
public class TextInputControl extends InputControl
@@ -122,7 +122,7 @@ public class TextInputControl extends In
if (hasFormatOption(vi, "noencode"))
return s;
// Encoded text
- return TextUtil.escapeHTML(s);
+ return StringEscapeUtils.escapeHtml(s);
}
if (dataType == DataType.INTEGER || dataType == DataType.AUTOINC)
{ // Integer
@@ -148,7 +148,7 @@ public class TextInputControl extends In
* }
*/
// Convert to String
- return TextUtil.escapeHTML(String.valueOf(value));
+ return StringEscapeUtils.escapeHtml(String.valueOf(value));
}
protected String formatValue(ValueInfo vi, boolean appendUnit)
Modified: incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/tags/DataValueTag.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/tags/DataValueTag.java?rev=1026865&r1=1026864&r2=1026865&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/tags/DataValueTag.java (original)
+++ incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/tags/DataValueTag.java Sun Oct 24 19:02:28 2010
@@ -44,7 +44,8 @@ public class DataValueTag extends Empire
protected String tag;
// Link attributes
protected String action;
- protected Object alt;
+ protected String urlType;
+ protected Object alt;
protected Object item;
protected String param;
protected String anchorClass;
@@ -66,6 +67,7 @@ public class DataValueTag extends Empire
tag = null;
// Link attributes
action = null;
+ urlType = null;
alt = null;
item = null;
param = null;
@@ -115,6 +117,7 @@ public class DataValueTag extends Empire
if (action!=null)
{
comp.setAction(action);
+ comp.setUrlType(urlType);
comp.setAlt(getItemValue(alt));
comp.setAnchorClass(anchorClass);
if (action.startsWith("javascript:")==false)
@@ -160,6 +163,11 @@ public class DataValueTag extends Empire
this.action = action;
}
+ public void setUrlType(String urlType)
+ {
+ this.urlType = urlType;
+ }
+
public void setItem(Object item)
{
this.item = item;
Modified: incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/tags/LinkTag.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/tags/LinkTag.java?rev=1026865&r1=1026864&r2=1026865&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/tags/LinkTag.java (original)
+++ incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/jsp/tags/LinkTag.java Sun Oct 24 19:02:28 2010
@@ -33,7 +33,8 @@ public class LinkTag extends EmpireTagSu
{
// LinkTag
protected String action;
- protected Object item;
+ protected String urlType;
+ protected Object item;
protected String text;
protected Object disabled;
protected String target;
@@ -54,6 +55,7 @@ public class LinkTag extends EmpireTagSu
{
// LinkTag
action = null;
+ urlType = null;
item = null;
text = null;
disabled = null;
@@ -92,6 +94,7 @@ public class LinkTag extends EmpireTagSu
}
// get Href
anchor.setAction(action);
+ anchor.setUrlType(urlType);
anchor.setText(getString(text));
anchor.setDisabled(getBoolean(disabled, false));
anchor.setTarget(target);
@@ -133,6 +136,11 @@ public class LinkTag extends EmpireTagSu
this.action = action;
}
+ public void setUrlType(String urlType)
+ {
+ this.urlType = urlType;
+ }
+
public void setItem(Object item)
{
this.item = item;
Added: incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/AppContext.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/AppContext.java?rev=1026865&view=auto
==============================================================================
--- incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/AppContext.java (added)
+++ incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/AppContext.java Sun Oct 24 19:02:28 2010
@@ -0,0 +1,51 @@
+/*
+ * 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.empire.struts2.web;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.Set;
+
+public interface AppContext {
+
+ String getContextName();
+ Object getExternalContext();
+ boolean isPortlet();
+
+ /* Resource Info */
+ String getMimeType(String file);
+ String getRealPath(String path);
+ Set<String> getResourcePaths(String path);
+ URL getResource(String path) throws MalformedURLException;
+
+ /* logging */
+ void log(java.lang.String msg);
+ void log(java.lang.String message, java.lang.Throwable throwable);
+
+ /* InitParam accessors */
+ Enumeration<String> getInitParameterNames();
+ String getInitParameter(java.lang.String name);
+
+ /* Attribute accessors */
+ Enumeration<String> getAttributeNames();
+ Object getAttribute(java.lang.String name);
+ void removeAttribute(java.lang.String name);
+ void setAttribute(java.lang.String name, java.lang.Object object);
+}
Propchange: incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/AppContext.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/DefaultWebRequest.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/DefaultWebRequest.java?rev=1026865&r1=1026864&r2=1026865&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/DefaultWebRequest.java (original)
+++ incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/DefaultWebRequest.java Sun Oct 24 19:02:28 2010
@@ -18,35 +18,33 @@
*/
package org.apache.empire.struts2.web;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
public class DefaultWebRequest implements WebRequest
{
- private HttpServletRequest httpRequest;
- private HttpServletResponse httpResponse;
+ private RequestContext request;
+ private ResponseContext response;
- public boolean init(HttpServletRequest request, HttpServletResponse response, Object session)
+ public boolean init(RequestContext request, ResponseContext response, Object session)
{
- this.httpRequest = request;
- this.httpResponse = response;
+ this.request = request;
+ this.response = response;
return true;
}
/**
* @see WebRequest#getHttpRequest()
*/
- public HttpServletRequest getHttpRequest()
+ public RequestContext getRequestContext()
{
- return httpRequest;
+ return request;
}
/**
* @see WebRequest#getHttpResponse()
*/
- public HttpServletResponse getHttpResponse()
+ public ResponseContext getResponseContext()
{
- return httpResponse;
+ return response;
}
/**
Modified: incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/EmpireFilterDispatcher.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/EmpireFilterDispatcher.java?rev=1026865&r1=1026864&r2=1026865&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/EmpireFilterDispatcher.java (original)
+++ incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/EmpireFilterDispatcher.java Sun Oct 24 19:02:28 2010
@@ -34,7 +34,8 @@ public class EmpireFilterDispatcher exte
// Default Constructor
}
- @Override
+ @SuppressWarnings("rawtypes")
+ @Override
protected Dispatcher createDispatcher(FilterConfig filterConfig)
{
Map<String, String> params = new HashMap<String, String>();
Added: incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/EmpirePortletDispatcher.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/EmpirePortletDispatcher.java?rev=1026865&view=auto
==============================================================================
--- incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/EmpirePortletDispatcher.java (added)
+++ incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/EmpirePortletDispatcher.java Sun Oct 24 19:02:28 2010
@@ -0,0 +1,256 @@
+/*
+ * 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.empire.struts2.web;
+
+import java.util.Map;
+
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletContext;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.portlet.PortletSession;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.empire.struts2.action.Disposable;
+import org.apache.empire.struts2.web.portlet.PortletContextWrapper;
+import org.apache.empire.struts2.web.portlet.PortletRequestWrapper;
+import org.apache.empire.struts2.web.portlet.PortletResponseWrapper;
+import org.apache.empire.struts2.web.portlet.PortletSessionWrapper;
+import org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher;
+
+public class EmpirePortletDispatcher extends Jsr168Dispatcher {
+ // Logger
+ protected static Log log = LogFactory.getLog(EmpireStrutsDispatcher.class);
+
+ public final String RENDER_DIRECT_ACTION = "struts.portlet.renderDirectAction";
+
+ public final String APPLICATION_CLASS = "ApplicationClass";
+ public final String SESSION_CLASS = "SessionClass";
+ public final String REQUEST_CLASS = "RequestClass";
+
+ private String sessionClassName = null;
+ private String requestClassName = null;
+
+ private boolean logRequestWarning = true;
+
+ /**
+ * Initialize the portlet with the init parameters from <tt>portlet.xml</tt>
+ */
+ @Override
+ public void init(PortletConfig cfg) throws PortletException {
+ super.init(cfg);
+
+ // Create Applicaton Object (if specified)
+ String appClassName = cfg.getInitParameter( APPLICATION_CLASS );
+ if (appClassName!=null)
+ {
+ createApplicationObject( cfg.getPortletContext(), appClassName);
+ }
+
+ // remember Session Class Name
+ sessionClassName = cfg.getInitParameter( SESSION_CLASS );
+ requestClassName = cfg.getInitParameter( REQUEST_CLASS );
+
+ // if no request class is specified use default
+ if (requestClassName==null || requestClassName.length()==0)
+ requestClassName = DefaultWebRequest.class.getName();
+ }
+
+ @Override
+ public void serviceAction(PortletRequest request, PortletResponse response, Map<String, Object> requestMap, Map<String, String[]> parameterMap,
+ Map<String, Object> sessionMap, Map<String, Object> applicationMap, String portletNamespace,
+ Integer phase) throws PortletException
+ {
+ try {
+ // Create Applicaton Class
+ if (sessionClassName!=null)
+ {
+ Object applObj = applicationMap.get( WebApplication.APPLICATION_NAME );
+ createSessionObject(request, applObj);
+ }
+ // Create Applicaton Class
+ boolean continueProcessing = true;
+ if (requestClassName!=null)
+ {
+ Object sessObj = sessionMap.get( WebSession.SESSION_NAME );
+ continueProcessing = createRequestObject(request, response, sessObj);
+ }
+ // Call Default
+ if (continueProcessing)
+ {
+ if (log.isDebugEnabled())
+ log.debug("starting portlet service request");
+
+ super.serviceAction(request, response, requestMap, parameterMap, sessionMap, applicationMap, portletNamespace, phase);
+ }
+
+ } catch (Exception e) {
+
+ log.error("Failed to process request due to Exception.", e);
+
+ } finally {
+ // cleanup
+ if (log.isDebugEnabled())
+ log.debug("cleanung up request");
+ // Dispose action first
+ int exitCode = disposeAction(request);
+ // Call Exit on Request
+ EmpireThreadManager.exit(exitCode);
+ }
+ }
+
+ /*
+ @Override
+ public HttpServletRequest wrapRequest(HttpServletRequest request, ServletContext servletContext)
+ throws IOException
+ {
+ HttpServletRequest wrappedRequest = super.wrapRequest(request, servletContext);
+ if (wrappedRequest instanceof MultiPartRequestWrapper)
+ {
+ boolean hasError = ((MultiPartRequestWrapper)wrappedRequest).hasErrors();
+ if (hasError)
+ { // Multipart-Error!
+ log.error("Multipart-Request has errors. Use normal Wrapper");
+ return new StrutsRequestWrapper(request);
+ }
+ }
+ return wrappedRequest;
+ }
+ */
+
+ private int disposeAction(PortletRequest request)
+ {
+ int exitCode = 0;
+ // Is the action still the?
+ Object action = request.getAttribute("action");
+ if (action!=null)
+ {
+ if (action instanceof Disposable)
+ { // Call dispose and return exitCode
+ exitCode = ((Disposable)action).dispose();
+ }
+ else
+ { // Disposible interface not implemented
+ log.warn("Cannot dispose action. Action does not implement the Disposible interface)");
+ }
+ // Cleanup the "action" Attribute on the HttpServletRequest
+ request.removeAttribute("action");
+ }
+ else
+ {
+ log.warn("Cannot dispose action. Action is not supplied on the request. (Missing ActionBasicsInterceptor?)");
+ }
+ // Exit Code
+ return exitCode;
+ }
+
+ @SuppressWarnings("rawtypes")
+ private Object createObject(String className)
+ throws ClassNotFoundException, IllegalAccessException, InstantiationException
+ {
+ // Create Instance for Object
+ Class c = Class.forName(className);
+ return c.newInstance();
+ }
+
+ protected void createApplicationObject(PortletContext portletContext, String appClassName)
+ {
+ try {
+ // Create Applicaton Class
+ if (portletContext.getAttribute( WebApplication.APPLICATION_NAME )==null)
+ {
+ Object app = createObject( appClassName );
+ if (app instanceof WebApplication)
+ {
+ ((WebApplication)app).init( new PortletContextWrapper(portletContext) );
+ }
+ else
+ log.warn("Application object does not implement IWebApplication!");
+ // Store it
+ portletContext.setAttribute( WebApplication.APPLICATION_NAME, app);
+ }
+ } catch(Exception e) {
+ log.error("Failed to create web application object of type " + appClassName + " --> " + e.getMessage());
+ }
+ }
+
+ protected void createSessionObject(PortletRequest request, Object applObj)
+ {
+ try {
+ // createSessionObject
+ PortletSession portletSession = request.getPortletSession(false);
+ if (portletSession==null || portletSession.getAttribute( WebSession.SESSION_NAME)==null)
+ {
+ Object session = createObject(sessionClassName);
+ portletSession = request.getPortletSession(true);
+ // Call init() if Session Object implements IWebSession
+ if (session instanceof WebSession)
+ {
+ ((WebSession)session).init( new PortletSessionWrapper(portletSession), applObj );
+ }
+ else
+ log.warn("Session object does not implement IWebSession!");
+ // Save Session
+ portletSession.setAttribute( WebSession.SESSION_NAME , session);
+ }
+ } catch(Exception e) {
+ // Error
+ log.error("Failed to create session [" + sessionClassName + "] msg= " + e.getMessage());
+ }
+ }
+
+ protected boolean createRequestObject(PortletRequest request, PortletResponse response, Object sessObj)
+ {
+ try {
+ // createSessionObject
+ Object reqObj = request.getAttribute( WebRequest.REQUEST_NAME );
+ if (reqObj==null)
+ {
+ // Create Request
+ reqObj = createObject( requestClassName );
+ // Store Request in Thread Local variable
+ EmpireThreadManager.setCurrentRequest( reqObj );
+ // Call init() if Request Object implements IWebRequest
+ if (reqObj instanceof WebRequest)
+ {
+ RequestContext req = new PortletRequestWrapper(request);
+ ResponseContext res = new PortletResponseWrapper(response);
+ return ((WebRequest)reqObj).init( req, res, sessObj );
+ }
+ else if (logRequestWarning)
+ {
+ log.warn("Request object does not implement IWebRequest!");
+ logRequestWarning = false;
+ }
+ }
+ // continue processing
+ return true;
+
+ } catch(Exception e) {
+ // Error
+ log.error("Failed to create request [" + requestClassName + "] msg= " + e.getMessage());
+ requestClassName = null; // don't try again
+ // continue processing
+ return true;
+ }
+ }
+
+}
Propchange: incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/EmpirePortletDispatcher.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/EmpirePortletResult.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/EmpirePortletResult.java?rev=1026865&view=auto
==============================================================================
--- incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/EmpirePortletResult.java (added)
+++ incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/EmpirePortletResult.java Sun Oct 24 19:02:28 2010
@@ -0,0 +1,101 @@
+/*
+ * 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.empire.struts2.web;
+
+import java.io.IOException;
+import java.util.Map;
+
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.empire.struts2.action.WebAction;
+import org.apache.struts2.portlet.PortletActionConstants;
+import org.apache.struts2.portlet.context.PortletActionContext;
+import org.apache.struts2.portlet.result.PortletResult;
+
+import com.opensymphony.xwork2.ActionInvocation;
+
+public class EmpirePortletResult extends PortletResult
+{
+ private static final long serialVersionUID = -6883272432993216278L;
+
+ protected static Log log = LogFactory.getLog(EmpirePortletResult.class);
+
+ private String renderMethod = "renderPortlet";
+
+ public EmpirePortletResult() {
+ super();
+ }
+
+ public EmpirePortletResult(String location) {
+ super(location);
+ }
+
+ public String getRenderMethod() {
+ return renderMethod;
+ }
+
+ public void setRenderMethod(String renderMethod) {
+ this.renderMethod = renderMethod;
+ }
+
+ @Override
+ protected void executeRenderResult(final String finalLocation)
+ throws PortletException, IOException
+ {
+ super.executeRenderResult(finalLocation);
+ }
+
+ @Override
+ protected void executeActionResult(String finalLocation, ActionInvocation invocation)
+ throws Exception
+ {
+ // Call base
+ super.executeActionResult(finalLocation, invocation);
+
+ // Handle Deferred Rendering
+ Map<String, Object> sessionMap = invocation.getInvocationContext().getSession();
+ if (sessionMap.containsKey(PortletActionConstants.RENDER_DIRECT_LOCATION))
+ { /*
+ * View is rendered outside an action...uh oh...
+ */
+ String actionName = invocation.getProxy().getActionName();
+ String resultCode = invocation.getResultCode();
+
+ // create action name
+ String namespace = invocation.getProxy().getNamespace();
+ if (namespace != null && namespace.length() > 0 && !namespace.endsWith("/")) {
+ namespace += "/";
+ }
+ String action = namespace + actionName + "!" + renderMethod;
+ if (log.isInfoEnabled())
+ log.info("Diverting Portlet render action: " + action);
+
+ // set action name
+ ActionResponse res = PortletActionContext.getActionResponse();
+ res.setRenderParameter(PortletActionConstants.ACTION_PARAM, action);
+ sessionMap.put(WebAction.PORTLET_ACTION_RESULT, resultCode);
+
+ // remove RENDER_DIRECT_LOCATION
+ sessionMap.remove(RENDER_DIRECT_LOCATION);
+ }
+ }
+}
Propchange: incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/EmpirePortletResult.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/EmpireStrutsDispatcher.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/EmpireStrutsDispatcher.java?rev=1026865&r1=1026864&r2=1026865&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/EmpireStrutsDispatcher.java (original)
+++ incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/EmpireStrutsDispatcher.java Sun Oct 24 19:02:28 2010
@@ -29,6 +29,10 @@ import javax.servlet.http.HttpSession;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.empire.struts2.action.Disposable;
+import org.apache.empire.struts2.web.servlet.ServletContextWrapper;
+import org.apache.empire.struts2.web.servlet.ServletRequestWrapper;
+import org.apache.empire.struts2.web.servlet.ServletResponseWrapper;
+import org.apache.empire.struts2.web.servlet.ServletSessionWrapper;
import org.apache.struts2.dispatcher.Dispatcher;
import org.apache.struts2.dispatcher.mapper.ActionMapping;
@@ -38,8 +42,6 @@ public class EmpireStrutsDispatcher exte
// Logger
protected static Log log = LogFactory.getLog(EmpireStrutsDispatcher.class);
- private static final ThreadLocal<Object> currentRequest = new ThreadLocal<Object>();
-
public final String APPLICATION_CLASS = "ApplicationClass";
public final String SESSION_CLASS = "SessionClass";
public final String REQUEST_CLASS = "RequestClass";
@@ -50,9 +52,13 @@ public class EmpireStrutsDispatcher exte
private boolean logRequestWarning = true;
// Accessor for Current Request
+ /**
+ * @deprecated use EmpireThreadManager.getCurrentRequest() instead.
+ */
+ @Deprecated
public static Object getCurrentRequest()
{
- return currentRequest.get();
+ return EmpireThreadManager.getCurrentRequest();
}
public EmpireStrutsDispatcher(ServletContext servletContext, Map<String, String> initParams)
@@ -95,7 +101,8 @@ public class EmpireStrutsDispatcher exte
// Call Default
if (continueProcessing)
{
- log.debug("calling Struts for request processing");
+ if (log.isDebugEnabled())
+ log.debug("starting servlet service request");
super.serviceAction(request, response, context, mapping);
}
@@ -105,20 +112,12 @@ public class EmpireStrutsDispatcher exte
} finally {
// cleanup
- log.debug("cleanung up request");
+ if (log.isDebugEnabled())
+ log.debug("cleanung up request");
// Dispose action first
int exitCode = disposeAction(request);
// Call Exit on Request
- Object reqObj = currentRequest.get();
- if (reqObj!=null)
- {
- if (reqObj instanceof WebRequest)
- {
- ((WebRequest)reqObj).exit(exitCode);
- }
- // Clear Thread local
- currentRequest.set( null );
- }
+ EmpireThreadManager.exit(exitCode);
}
}
@@ -157,7 +156,7 @@ public class EmpireStrutsDispatcher exte
log.warn("Cannot dispose action. Action does not implement the Disposible interface)");
}
// Cleanup the "action" Attribute on the HttpServletRequest
- request.setAttribute("action", null);
+ request.removeAttribute("action");
}
else
{
@@ -167,7 +166,8 @@ public class EmpireStrutsDispatcher exte
return exitCode;
}
- private Object createObject(String className)
+ @SuppressWarnings("rawtypes")
+ private Object createObject(String className)
throws ClassNotFoundException, IllegalAccessException, InstantiationException
{
// Create Instance for Object
@@ -184,7 +184,7 @@ public class EmpireStrutsDispatcher exte
Object app = createObject( appClassName );
if (app instanceof WebApplication)
{
- ((WebApplication)app).init( servletContext );
+ ((WebApplication)app).init( new ServletContextWrapper( servletContext ));
}
else
log.warn("Application object does not implement IWebApplication!");
@@ -208,7 +208,7 @@ public class EmpireStrutsDispatcher exte
// Call init() if Session Object implements IWebSession
if (session instanceof WebSession)
{
- ((WebSession)session).init( httpSession, applObj );
+ ((WebSession)session).init( new ServletSessionWrapper(httpSession), applObj );
}
else
log.warn("Session object does not implement IWebSession!");
@@ -231,11 +231,13 @@ public class EmpireStrutsDispatcher exte
// Create Request
reqObj = createObject( requestClassName );
// Store Request in Thread Local variable
- currentRequest.set( reqObj );
+ EmpireThreadManager.setCurrentRequest( reqObj );
// Call init() if Request Object implements IWebRequest
if (reqObj instanceof WebRequest)
{
- return ((WebRequest)reqObj).init( request, response, sessObj );
+ RequestContext req = new ServletRequestWrapper(request);
+ ResponseContext res = new ServletResponseWrapper(response);
+ return ((WebRequest)reqObj).init( req, res, sessObj );
}
else if (logRequestWarning)
{
Added: incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/EmpireThreadManager.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/EmpireThreadManager.java?rev=1026865&view=auto
==============================================================================
--- incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/EmpireThreadManager.java (added)
+++ incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/EmpireThreadManager.java Sun Oct 24 19:02:28 2010
@@ -0,0 +1,59 @@
+/*
+ * 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.empire.struts2.web;
+
+public final class EmpireThreadManager
+{
+
+ private static final ThreadLocal<Object> currentRequest = new ThreadLocal<Object>();
+
+ // Accessor for Current Request
+ public static Object getCurrentRequest()
+ {
+ return currentRequest.get();
+ }
+
+ /**
+ * Sets the request for the current thread
+ * @param request The request object
+ */
+ protected static void setCurrentRequest(Object request)
+ {
+ currentRequest.set(request);
+ }
+
+ /**
+ * cleans up the current thread.
+ * if a current request is set and the request object implements the WebRequest interface then the exit function is called.
+ * @param exitCode the exitCode
+ */
+ protected static void exit(int exitCode)
+ {
+ Object reqObj = currentRequest.get();
+ if (reqObj!=null)
+ {
+ if (reqObj instanceof WebRequest)
+ {
+ ((WebRequest)reqObj).exit(exitCode);
+ }
+ // Clear Thread local
+ currentRequest.set( null );
+ }
+ }
+}
Propchange: incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/EmpireThreadManager.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/RequestContext.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/RequestContext.java?rev=1026865&view=auto
==============================================================================
--- incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/RequestContext.java (added)
+++ incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/RequestContext.java Sun Oct 24 19:02:28 2010
@@ -0,0 +1,61 @@
+/*
+ * 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.empire.struts2.web;
+
+import java.security.Principal;
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.Map;
+
+public interface RequestContext {
+
+ Object getExternalRequest();
+ SessionContext getSessionContext();
+
+ String getRequestURI();
+
+ /* Request info */
+ String getAuthType();
+ String getContextPath();
+ String getRemoteUser();
+ Principal getUserPrincipal();
+ boolean isUserInRole(String role);
+ boolean isSecure();
+ String getScheme();
+ String getServerName();
+ int getServerPort();
+
+ String getRequestedSessionId();
+ boolean isRequestedSessionIdValid();
+
+ Locale getLocale();
+ Enumeration<Locale> getLocales();
+
+ /* Parameter accessors */
+ Enumeration<String> getParameterNames();
+ String getParameter(String name);
+ String[] getParameterValues(String name);
+ Map<String,String> getParameterMap();
+
+ /* Attribute accessors */
+ Enumeration<String> getAttributeNames();
+ Object getAttribute(String name);
+ void setAttribute(String name, Object o);
+ void removeAttribute(String name);
+}
Propchange: incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/RequestContext.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/ResponseContext.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/ResponseContext.java?rev=1026865&view=auto
==============================================================================
--- incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/ResponseContext.java (added)
+++ incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/ResponseContext.java Sun Oct 24 19:02:28 2010
@@ -0,0 +1,52 @@
+/*
+ * 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.empire.struts2.web;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.util.Locale;
+
+import javax.servlet.http.Cookie;
+
+public interface ResponseContext {
+
+ Object getExternalResponse();
+
+ // Action methods
+ void addCookie(Cookie cookie);
+ String encodeURL(String url);
+ String encodeRedirectURL(String url);
+ void sendRedirect(String location) throws IOException;
+
+ // Render methods
+ Locale getLocale();
+ String getCharacterEncoding();
+ String getContentType();
+ void setContentType(String type);
+ int getBufferSize();
+ void setBufferSize(int size);
+ PrintWriter getWriter() throws IOException;
+ OutputStream getOutputStream() throws IOException;
+ void flushBuffer() throws IOException;
+ void resetBuffer();
+ boolean isCommitted();
+ void reset();
+
+}
Propchange: incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/ResponseContext.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/SessionContext.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/SessionContext.java?rev=1026865&view=auto
==============================================================================
--- incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/SessionContext.java (added)
+++ incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/SessionContext.java Sun Oct 24 19:02:28 2010
@@ -0,0 +1,44 @@
+/*
+ * 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.empire.struts2.web;
+
+import java.util.Enumeration;
+
+public interface SessionContext {
+
+ /* Basic */
+ Object getExternalSession();
+ AppContext getAppContext();
+
+ /* Session Info */
+ String getId();
+ boolean isNew();
+ void invalidate();
+
+ long getCreationTime();
+ long getLastAccessedTime();
+ int getMaxInactiveInterval();
+ void setMaxInactiveInterval(int interval);
+
+ /* Attribute accessors */
+ Enumeration<String> getAttributeNames();
+ Object getAttribute(String name);
+ void setAttribute(String name, Object value);
+ void removeAttribute(String name);
+}
Propchange: incubator/empire-db/trunk/empire-db-struts2/src/main/java/org/apache/empire/struts2/web/SessionContext.java
------------------------------------------------------------------------------
svn:mime-type = text/plain