You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2005/03/14 23:29:48 UTC
cvs commit: jakarta-tapestry/framework/src/test/org/apache/tapestry/describe TestHTMLDescriptionReceiver.java
hlship 2005/03/14 14:29:48
Modified: portlet/src/java/org/apache/tapestry/portlet
PortletWebContext.java PortletWebResponse.java
PortletWebRequest.java
framework/src/java/org/apache/tapestry/services/impl
ApplicationSpecificationInitializer.java
ApplicationGlobalsImpl.java
framework/src/test/org/apache/tapestry/services/impl
TestApplicationSpecificationInitializer.java
framework/src/java/org/apache/tapestry/describe
DescriptionReceiver.java
HTMLDescriptionReceiver.java
framework/src/java/org/apache/tapestry/web
ServletWebResponse.java WebRequest.java
WebResponse.java WebContext.java
ServletWebRequest.java ServletWebContext.java
framework/src/descriptor/META-INF hivemodule.xml
tapestry.init.xml tapestry.props.xml
tapestry.asset.xml tapestry.services.xml
tapestry.globals.xml
framework/src/java/org/apache/tapestry/asset
AssetService.java ContextAsset.java
ContextAssetFactory.java
framework/src/java/org/apache/tapestry/html
RequestDisplay.jwc RequestDisplay.html
ExceptionDisplay.java
framework/src/java/org/apache/tapestry/services
ApplicationGlobals.java
framework/src/test/org/apache/tapestry/describe
TestHTMLDescriptionReceiver.java
Added: portlet/src/java/org/apache/tapestry/portlet
PortletApplicationInitializer.java
ActionRequestServicer.java
ActionRequestServicerFilter.java
framework/src/java/org/apache/tapestry/services/impl
WebContextInitializer.java
InitializationParameterHolderPropertySource.java
framework/src/java/org/apache/tapestry/web
HttpServletWebActivator.java WebActivator.java
Removed: framework/src/java/org/apache/tapestry/services/impl
ContainerContextInitializer.java
ServletContextPropertySource.java
ApplicationSpecificationPropertySource.java
ServletPropertySource.java
framework/src/java/org/apache/tapestry/util
DelegatingPropertySource.java
ServletContextPropertySource.java
ServletPropertySource.java
LocalizedPropertySource.java
framework/src/test/org/apache/tapestry/junit
TestPropertySource.java
Log:
Continue "genericising" Tapestry away from pure servlet dependency.
Revision Changes Path
1.2 +10 -0 jakarta-tapestry/portlet/src/java/org/apache/tapestry/portlet/PortletWebContext.java
Index: PortletWebContext.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/portlet/src/java/org/apache/tapestry/portlet/PortletWebContext.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PortletWebContext.java 12 Mar 2005 20:49:15 -0000 1.1
+++ PortletWebContext.java 14 Mar 2005 22:29:47 -0000 1.2
@@ -23,6 +23,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hivemind.util.Defense;
+import org.apache.tapestry.describe.DescriptionReceiver;
import org.apache.tapestry.web.WebContext;
import org.apache.tapestry.web.WebUtils;
@@ -87,4 +88,13 @@
return _portletContext.getInitParameter(name);
}
+ public String getMimeType(String resourcePath)
+ {
+ return _portletContext.getMimeType(resourcePath);
+ }
+
+ public void describeTo(DescriptionReceiver receiver)
+ {
+ receiver.describeAlternate(_portletContext);
+ }
}
\ No newline at end of file
1.2 +5 -1 jakarta-tapestry/portlet/src/java/org/apache/tapestry/portlet/PortletWebResponse.java
Index: PortletWebResponse.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/portlet/src/java/org/apache/tapestry/portlet/PortletWebResponse.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PortletWebResponse.java 10 Mar 2005 23:24:33 -0000 1.1
+++ PortletWebResponse.java 14 Mar 2005 22:29:47 -0000 1.2
@@ -61,9 +61,13 @@
unsupported("setContentType");
}
+ public void setContentLength(int contentLength)
+ {
+ unsupported("setContentLength");
+ }
+
protected final void unsupported(String methodName)
{
throw new UnsupportedOperationException(PortletMessages.unsupportedMethod(methodName));
-
}
}
\ No newline at end of file
1.2 +6 -0 jakarta-tapestry/portlet/src/java/org/apache/tapestry/portlet/PortletWebRequest.java
Index: PortletWebRequest.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/portlet/src/java/org/apache/tapestry/portlet/PortletWebRequest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PortletWebRequest.java 10 Mar 2005 13:23:31 -0000 1.1
+++ PortletWebRequest.java 14 Mar 2005 22:29:47 -0000 1.2
@@ -20,6 +20,7 @@
import javax.portlet.PortletSession;
import org.apache.hivemind.util.Defense;
+import org.apache.tapestry.describe.DescriptionReceiver;
import org.apache.tapestry.web.WebRequest;
import org.apache.tapestry.web.WebSession;
import org.apache.tapestry.web.WebUtils;
@@ -133,4 +134,9 @@
{
throw new UnsupportedOperationException(PortletMessages.unsupportedMethod(methodName));
}
+
+ public void describeTo(DescriptionReceiver receiver)
+ {
+ receiver.describeAlternate(_portletRequest);
+ }
}
\ No newline at end of file
1.1 jakarta-tapestry/portlet/src/java/org/apache/tapestry/portlet/PortletApplicationInitializer.java
Index: PortletApplicationInitializer.java
===================================================================
// Copyright 2005 The Apache Software Foundation
//
// Licensed 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.tapestry.portlet;
import javax.portlet.Portlet;
/**
* Command interface for the <code>tapestry.portlet.ApplicationInitializer</code> configuration
* point, which is used by the application portlet to bootstrap the application.
*
* @author Howard M. Lewis Ship
* @since 3.1
*/
public interface PortletApplicationInitializer
{
public void initialize(Portlet portlet);
}
1.1 jakarta-tapestry/portlet/src/java/org/apache/tapestry/portlet/ActionRequestServicer.java
Index: ActionRequestServicer.java
===================================================================
// Copyright 2005 The Apache Software Foundation
//
// Licensed 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.tapestry.portlet;
import java.io.IOException;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletException;
/**
* Used to define the commands in the <code>tapestry.portlet.ActionRequestServicerPipeline</code>
* configuration.
*
* @author Howard M. Lewis Ship
* @since 3.1
*/
public interface ActionRequestServicer
{
public void service(ActionRequest request, ActionResponse response) throws IOException,
PortletException;
}
1.1 jakarta-tapestry/portlet/src/java/org/apache/tapestry/portlet/ActionRequestServicerFilter.java
Index: ActionRequestServicerFilter.java
===================================================================
// Copyright 2005 The Apache Software Foundation
//
// Licensed 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.tapestry.portlet;
import java.io.IOException;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletException;
/**
* Filter interface used for the commands in the
* <code>tapestry.portlet.ActionRequestServicerPipeline</code> configuration.
*
* @author Howard M. Lewis Ship
* @since 3.1
* @see org.apache.tapestry.portlet.ActionRequestServicer
*/
public interface ActionRequestServicerFilter
{
public void service(ActionRequest request, ActionResponse response,
ActionRequestServicer servicer) throws IOException, PortletException;
}
1.6 +4 -2 jakarta-tapestry/framework/src/java/org/apache/tapestry/services/impl/ApplicationSpecificationInitializer.java
Index: ApplicationSpecificationInitializer.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/services/impl/ApplicationSpecificationInitializer.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ApplicationSpecificationInitializer.java 7 Feb 2005 15:11:10 -0000 1.5
+++ ApplicationSpecificationInitializer.java 14 Mar 2005 22:29:47 -0000 1.6
@@ -26,6 +26,7 @@
import org.apache.tapestry.services.ClasspathResourceFactory;
import org.apache.tapestry.spec.ApplicationSpecification;
import org.apache.tapestry.spec.IApplicationSpecification;
+import org.apache.tapestry.web.HttpServletWebActivator;
/**
* Locates the application specification and informs the
@@ -61,7 +62,8 @@
else
spec = _parser.parseApplicationSpecification(specResource);
- _globals.store(servlet, spec);
+ _globals.storeActivator(new HttpServletWebActivator(servlet));
+ _globals.storeSpecification(spec);
}
private Resource findApplicationSpecification(HttpServlet servlet)
@@ -108,7 +110,7 @@
ApplicationSpecification result = new ApplicationSpecification();
// Pretend the file exists in the most common expected location.
-
+
Resource virtualLocation = new ContextResource(servlet.getServletContext(), "/WEB-INF/"
+ servletName + ".application");
1.6 +13 -22 jakarta-tapestry/framework/src/java/org/apache/tapestry/services/impl/ApplicationGlobalsImpl.java
Index: ApplicationGlobalsImpl.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/services/impl/ApplicationGlobalsImpl.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ApplicationGlobalsImpl.java 25 Feb 2005 00:54:47 -0000 1.5
+++ ApplicationGlobalsImpl.java 14 Mar 2005 22:29:47 -0000 1.6
@@ -15,11 +15,11 @@
package org.apache.tapestry.services.impl;
import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
import javax.servlet.http.HttpServlet;
import org.apache.tapestry.services.ApplicationGlobals;
import org.apache.tapestry.spec.IApplicationSpecification;
+import org.apache.tapestry.web.WebActivator;
import org.apache.tapestry.web.WebContext;
/**
@@ -30,44 +30,35 @@
*/
public class ApplicationGlobalsImpl implements ApplicationGlobals
{
- private HttpServlet _servlet;
-
- private ServletContext _context;
+ private WebActivator _activator;
private IApplicationSpecification _specification;
private WebContext _webContext;
- public void store(HttpServlet servlet, IApplicationSpecification applicationSpecification)
- {
- _servlet = servlet;
- _context = servlet.getServletContext();
- _specification = applicationSpecification;
- }
-
- public HttpServlet getServlet()
+ public void storeActivator(WebActivator activator)
{
- return _servlet;
+ _activator = activator;
}
- public IApplicationSpecification getSpecification()
+ public void storeSpecification(IApplicationSpecification applicationSpecification)
{
- return _specification;
+ _specification = applicationSpecification;
}
- public ServletContext getContext()
+ public WebActivator getActivator()
{
- return _context;
+ return _activator;
}
- public String getServletName()
+ public IApplicationSpecification getSpecification()
{
- return _servlet.getServletName();
+ return _specification;
}
- public ServletConfig getServletConfig()
+ public String getActivatorName()
{
- return _servlet.getServletConfig();
+ return _activator.getActivatorName();
}
public WebContext getWebContext()
@@ -75,7 +66,7 @@
return _webContext;
}
- public void store(WebContext context)
+ public void storeContext(WebContext context)
{
_webContext = context;
}
1.1 jakarta-tapestry/framework/src/java/org/apache/tapestry/services/impl/WebContextInitializer.java
Index: WebContextInitializer.java
===================================================================
// Copyright 2005 The Apache Software Foundation
//
// Licensed 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.tapestry.services.impl;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServlet;
import org.apache.tapestry.services.ApplicationGlobals;
import org.apache.tapestry.services.ApplicationInitializer;
import org.apache.tapestry.web.ServletWebContext;
import org.apache.tapestry.web.WebContext;
/**
* Gets the context from the servlet, creates a
* {@link org.apache.tapestry.web.ServletWebContext}, and stores that into the
* {@link org.apache.tapestry.services.ApplicationGlobals}.
*
* @author Howard M. Lewis Ship
* @since 3.1
*/
public class WebContextInitializer implements ApplicationInitializer
{
private ApplicationGlobals _globals;
public void initialize(HttpServlet servlet)
{
ServletContext servletContext = servlet.getServletContext();
WebContext context = new ServletWebContext(servletContext);
_globals.storeContext(context);
}
public void setGlobals(ApplicationGlobals globals)
{
_globals = globals;
}
}
1.1 jakarta-tapestry/framework/src/java/org/apache/tapestry/services/impl/InitializationParameterHolderPropertySource.java
Index: InitializationParameterHolderPropertySource.java
===================================================================
// Copyright 2004, 2005 The Apache Software Foundation
//
// Licensed 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.tapestry.services.impl;
import javax.servlet.ServletContext;
import org.apache.tapestry.engine.IPropertySource;
import org.apache.tapestry.web.InitializationParameterHolder;
/**
* Searches for property values inside objects that implement
* {@link org.apache.tapestry.web.InitializationParameterHolder}.
*
* @author Howard Lewis Ship
* @since 3.1
*/
public class InitializationParameterHolderPropertySource implements IPropertySource
{
private InitializationParameterHolder _holder;
public String getPropertyValue(String propertyName)
{
return _holder.getInitParameterValue(propertyName);
}
public void setHolder(InitializationParameterHolder holder)
{
_holder = holder;
}
}
1.5 +14 -20 jakarta-tapestry/framework/src/test/org/apache/tapestry/services/impl/TestApplicationSpecificationInitializer.java
Index: TestApplicationSpecificationInitializer.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/test/org/apache/tapestry/services/impl/TestApplicationSpecificationInitializer.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TestApplicationSpecificationInitializer.java 7 Feb 2005 15:11:10 -0000 1.4
+++ TestApplicationSpecificationInitializer.java 14 Mar 2005 22:29:47 -0000 1.5
@@ -81,12 +81,10 @@
parser.parseApplicationSpecification(appSpecResource);
parserControl.setReturnValue(as);
- ApplicationGlobals ag = (ApplicationGlobals) newMock(ApplicationGlobals.class);
+ ApplicationGlobals ag = new ApplicationGlobalsImpl();
i.setGlobals(ag);
- ag.store(servlet, as);
-
replayControls();
servlet.init(config);
@@ -95,6 +93,9 @@
i.initialize(servlet);
+ assertNotNull(ag.getActivator());
+ assertSame(as, ag.getSpecification());
+
verifyControls();
}
@@ -169,12 +170,10 @@
parser.parseApplicationSpecification(r);
parserControl.setReturnValue(as);
- ApplicationGlobals ag = (ApplicationGlobals) newMock(ApplicationGlobals.class);
+ ApplicationGlobals ag = new ApplicationGlobalsImpl();
i.setGlobals(ag);
- ag.store(servlet, as);
-
replayControls();
servlet.init(config);
@@ -247,12 +246,10 @@
parser.parseApplicationSpecification(r);
parserControl.setReturnValue(as);
- ApplicationGlobals ag = (ApplicationGlobals) newMock(ApplicationGlobals.class);
+ ApplicationGlobals ag = new ApplicationGlobalsImpl();
i.setGlobals(ag);
- ag.store(servlet, as);
-
replayControls();
servlet.init(config);
@@ -342,19 +339,10 @@
config.getServletContext();
configControl.setReturnValue(context);
- IApplicationSpecification as = new ApplicationSpecification();
- as.setName("wilma");
- as.setSpecificationLocation(new ContextResource(context, "/WEB-INF/wilma.application"));
-
- MockControl agControl = newControl(ApplicationGlobals.class);
-
- ApplicationGlobals ag = (ApplicationGlobals) agControl.getMock();
+ ApplicationGlobals ag = new ApplicationGlobalsImpl();
i.setGlobals(ag);
- ag.store(servlet, as);
- agControl.setMatcher(new SmartApplicationSpecificationMatcher());
-
replayControls();
servlet.init(config);
@@ -364,6 +352,12 @@
i.initialize(servlet);
verifyControls();
+
+ IApplicationSpecification as = ag.getSpecification();
+
+ assertEquals("wilma", as.getName());
+ assertEquals(new ContextResource(context, "/WEB-INF/wilma.application"), as
+ .getSpecificationLocation());
}
/**
@@ -385,7 +379,7 @@
configControl.setReturnValue(null);
config.getServletContext();
- configControl.setReturnValue(context, 3);
+ configControl.setReturnValue(context, 2);
config.getServletName();
configControl.setReturnValue("dino", 2);
1.2 +6 -0 jakarta-tapestry/framework/src/java/org/apache/tapestry/describe/DescriptionReceiver.java
Index: DescriptionReceiver.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/describe/DescriptionReceiver.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DescriptionReceiver.java 7 Mar 2005 19:51:53 -0000 1.1
+++ DescriptionReceiver.java 14 Mar 2005 22:29:47 -0000 1.2
@@ -26,6 +26,12 @@
public interface DescriptionReceiver
{
/**
+ * Invoke to describe another object instead of the current object.
+ */
+
+ public void describeAlternate(Object alternate);
+
+ /**
* Provides a title for the object; usually the object's class name.
*
* @throws IllegalStateException
1.2 +8 -0 jakarta-tapestry/framework/src/java/org/apache/tapestry/describe/HTMLDescriptionReceiver.java
Index: HTMLDescriptionReceiver.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/describe/HTMLDescriptionReceiver.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- HTMLDescriptionReceiver.java 7 Mar 2005 19:51:53 -0000 1.1
+++ HTMLDescriptionReceiver.java 14 Mar 2005 22:29:47 -0000 1.2
@@ -23,6 +23,9 @@
/**
* Implementation of {@link org.apache.tapestry.describe.DescriptionReceiver}that produces HTML
* output using a {@link org.apache.tapestry.IMarkupWriter}.
+ * <p>
+ * TODO: Make {@link #describeAlternate(Object)} exclusive with the other methods
+ * {@link #title(String)},{@link #property(String, Object)}, etc.
*
* @author Howard M. Lewis Ship
* @since 3.1
@@ -65,6 +68,11 @@
finishUp(object);
}
+ public void describeAlternate(Object alternate)
+ {
+ _adapter.describeObject(alternate, this);
+ }
+
void finishUp(Object object)
{
if (_emitDefault)
1.3 +5 -0 jakarta-tapestry/framework/src/java/org/apache/tapestry/web/ServletWebResponse.java
Index: ServletWebResponse.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/web/ServletWebResponse.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ServletWebResponse.java 8 Mar 2005 15:36:36 -0000 1.2
+++ ServletWebResponse.java 14 Mar 2005 22:29:47 -0000 1.3
@@ -76,4 +76,9 @@
{
_servletResponse.setContentType(contentType);
}
+
+ public void setContentLength(int length)
+ {
+ _servletResponse.setContentLength(length);
+ }
}
\ No newline at end of file
1.7 +3 -1 jakarta-tapestry/framework/src/java/org/apache/tapestry/web/WebRequest.java
Index: WebRequest.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/web/WebRequest.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- WebRequest.java 12 Mar 2005 20:49:16 -0000 1.6
+++ WebRequest.java 14 Mar 2005 22:29:47 -0000 1.7
@@ -16,6 +16,8 @@
import java.util.List;
+import org.apache.tapestry.describe.Describable;
+
/**
* Contains information about the current request, including URLs, schemes, parameters, properties
* and attributes.
@@ -23,7 +25,7 @@
* @author Howard M. Lewis Ship
* @since 3.1
*/
-public interface WebRequest extends AttributeHolder
+public interface WebRequest extends AttributeHolder, Describable
{
/**
* Returns the names of all query parameters for this request. Note that this may return an
1.3 +2 -0 jakarta-tapestry/framework/src/java/org/apache/tapestry/web/WebResponse.java
Index: WebResponse.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/web/WebResponse.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- WebResponse.java 8 Mar 2005 15:36:36 -0000 1.2
+++ WebResponse.java 14 Mar 2005 22:29:47 -0000 1.3
@@ -51,4 +51,6 @@
public void reset();
public void setContentType(String contentType);
+
+ public void setContentLength(int contentLength);
}
\ No newline at end of file
1.2 +8 -1 jakarta-tapestry/framework/src/java/org/apache/tapestry/web/WebContext.java
Index: WebContext.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/web/WebContext.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- WebContext.java 25 Feb 2005 00:54:46 -0000 1.1
+++ WebContext.java 14 Mar 2005 22:29:47 -0000 1.2
@@ -16,6 +16,8 @@
import java.net.URL;
+import org.apache.tapestry.describe.Describable;
+
/**
* A representation of a set of servlets (or portlets) packaged together as a web application
* archive. Attributes stored within the context are global to all 'lets (but not distributed across
@@ -23,7 +25,7 @@
*
* @author Howard M. Lewis Ship
*/
-public interface WebContext extends AttributeHolder, InitializationParameterHolder
+public interface WebContext extends AttributeHolder, InitializationParameterHolder, Describable
{
/**
* Returns a URL to the resource that is mapped to a specified path. The path must begin with a
@@ -31,4 +33,9 @@
*/
public URL getResource(String path);
+
+ /**
+ * Returns the MIME type of the specified file, or null if the MIME type is not known.
+ */
+ public String getMimeType(String resourcePath);
}
\ No newline at end of file
1.7 +6 -0 jakarta-tapestry/framework/src/java/org/apache/tapestry/web/ServletWebRequest.java
Index: ServletWebRequest.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/web/ServletWebRequest.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ServletWebRequest.java 12 Mar 2005 20:49:16 -0000 1.6
+++ ServletWebRequest.java 14 Mar 2005 22:29:47 -0000 1.7
@@ -26,6 +26,7 @@
import org.apache.hivemind.ApplicationRuntimeException;
import org.apache.hivemind.HiveMind;
import org.apache.hivemind.util.Defense;
+import org.apache.tapestry.describe.DescriptionReceiver;
/**
* Adapter from {@link javax.servlet.http.HttpServletRequest} to
@@ -184,4 +185,9 @@
return pathInfo == null ? servletPath : servletPath + pathInfo;
}
+
+ public void describeTo(DescriptionReceiver receiver)
+ {
+ receiver.describeAlternate(_servletRequest);
+ }
}
\ No newline at end of file
1.2 +13 -2 jakarta-tapestry/framework/src/java/org/apache/tapestry/web/ServletWebContext.java
Index: ServletWebContext.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/web/ServletWebContext.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ServletWebContext.java 25 Feb 2005 00:54:46 -0000 1.1
+++ ServletWebContext.java 14 Mar 2005 22:29:47 -0000 1.2
@@ -23,10 +23,11 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hivemind.util.Defense;
+import org.apache.tapestry.describe.Describable;
+import org.apache.tapestry.describe.DescriptionReceiver;
/**
- * Adapts {@link javax.servlet.ServletContext} as
- * {@link org.apache.tapestry.web.WebContext}.
+ * Adapts {@link javax.servlet.ServletContext} as {@link org.apache.tapestry.web.WebContext}.
*
* @author Howard M. Lewis Ship
* @since 3.1
@@ -37,6 +38,11 @@
private final ServletContext _servletContext;
+ public void describeTo(DescriptionReceiver receiver)
+ {
+ receiver.describeAlternate(_servletContext);
+ }
+
public ServletWebContext(ServletContext context)
{
Defense.notNull(context, "context");
@@ -86,4 +92,9 @@
{
return WebUtils.toSortedList(_servletContext.getInitParameterNames());
}
+
+ public String getMimeType(String resourcePath)
+ {
+ return _servletContext.getMimeType(resourcePath);
+ }
}
\ No newline at end of file
1.1 jakarta-tapestry/framework/src/java/org/apache/tapestry/web/HttpServletWebActivator.java
Index: HttpServletWebActivator.java
===================================================================
// Copyright 2005 The Apache Software Foundation
//
// Licensed 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.tapestry.web;
import java.util.List;
import javax.servlet.http.HttpServlet;
import org.apache.tapestry.describe.DescriptionReceiver;
/**
* Adapts {@link javax.servlet.http.HttpServlet} as
* {@link org.apache.tapestry.web.WebActivator}.
*
* @author Howard M. Lewis Ship
* @since 3.1
*/
public class HttpServletWebActivator implements WebActivator
{
private HttpServlet _httpServlet;
public HttpServletWebActivator(HttpServlet servlet)
{
_httpServlet = servlet;
}
public String getActivatorName()
{
return _httpServlet.getServletName();
}
public List getInitParameterNames()
{
return WebUtils.toSortedList(_httpServlet.getInitParameterNames());
}
public String getInitParameterValue(String name)
{
return _httpServlet.getInitParameter(name);
}
public void describeTo(DescriptionReceiver receiver)
{
receiver.describeAlternate(_httpServlet);
}
}
1.1 jakarta-tapestry/framework/src/java/org/apache/tapestry/web/WebActivator.java
Index: WebActivator.java
===================================================================
// Copyright 2005 The Apache Software Foundation
//
// Licensed 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.tapestry.web;
import org.apache.tapestry.describe.Describable;
/**
* A wrapper around a {@link javax.servlet.http.HttpServlet} or {@link *
* {@link javax.portlet.Portlet}.
*
* @author Howard M. Lewis Ship
* @since 3.1
*/
public interface WebActivator extends InitializationParameterHolder, Describable
{
public String getActivatorName();
}
1.31 +2 -2 jakarta-tapestry/framework/src/descriptor/META-INF/hivemodule.xml
Index: hivemodule.xml
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/descriptor/META-INF/hivemodule.xml,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- hivemodule.xml 7 Mar 2005 19:51:58 -0000 1.30
+++ hivemodule.xml 14 Mar 2005 22:29:47 -0000 1.31
@@ -82,8 +82,8 @@
<set-service property="request" service-id="tapestry.globals.WebRequest"/>
<set-service property="response" service-id="tapestry.globals.WebResponse"/>
<set-service property="componentPropertySource" service-id="tapestry.props.ComponentPropertySource"/>
- <set-object property="applicationId" value="service-property:tapestry.globals.ApplicationGlobals:servletName"/>
- <set-object property="context" value="service-property:tapestry.globals.ApplicationGlobals:webContext"/>
+ <set-object property="applicationId" value="service-property:tapestry.globals.ApplicationGlobals:activatorName"/>
+ <set-service property="context" service-id="tapestry.globals.WebContext"/>
<set-service property="threadLocale" service-id="hivemind.ThreadLocale"/>
</construct>
</invoke-factory>
1.6 +3 -3 jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.init.xml
Index: tapestry.init.xml
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.init.xml,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- tapestry.init.xml 24 Feb 2005 23:05:02 -0000 1.5
+++ tapestry.init.xml 14 Mar 2005 22:29:47 -0000 1.6
@@ -48,12 +48,12 @@
</invoke-factory>
</service-point>
- <service-point id="ContainerContextInitializer" interface="ApplicationInitializer">
+ <service-point id="WebContextInitializer" interface="ApplicationInitializer">
Creates and stores the ContainerContext into ApplicationGlobals.
<invoke-factory>
- <construct class="impl.ContainerContextInitializer">
+ <construct class="impl.WebContextInitializer">
<set-service property="globals" service-id="tapestry.globals.ApplicationGlobals"/>
</construct>
</invoke-factory>
@@ -61,7 +61,7 @@
</service-point>
<contribution configuration-id="ApplicationInitializers">
- <command id="ContainerContextInitializer" object="service:ContainerContextInitializer" before="*"/>
+ <command id="WebContextInitializer" object="service:WebContextInitializer" before="*"/>
<command id="ApplicationSpecificationInitializer" object="service:ApplicationSpecificationInitializer"/>
</contribution>
1.9 +18 -17 jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.props.xml
Index: tapestry.props.xml
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.props.xml,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- tapestry.props.xml 24 Feb 2005 18:54:19 -0000 1.8
+++ tapestry.props.xml 14 Mar 2005 22:29:47 -0000 1.9
@@ -40,24 +40,24 @@
</service-point>
- <service-point id="ServletPropertySource" interface="IPropertySource">
+ <service-point id="WebActivatorPropertySource" interface="IPropertySource">
- Searches for properties in the application servlets' configuration.
+ Searches for properties in the web activator's (i.e. HttpServlet's) configuration.
<invoke-factory>
- <construct class="org.apache.tapestry.services.impl.ServletPropertySource">
- <set-object property="servletConfig" value="service-property:tapestry.globals.ApplicationGlobals:servletConfig"/>
- </construct>
+ <construct class="org.apache.tapestry.services.impl.InitializationParameterHolderPropertySource">
+ <set-object property="holder" value="service-property:tapestry.globals.ApplicationGlobals:activator"/>
+ </construct>
</invoke-factory>
</service-point>
- <service-point id="ServletContextPropertySource" interface="IPropertySource">
+ <service-point id="WebContextPropertySource" interface="IPropertySource">
- Searches the servlet context for properties.
+ Searches the WebContext (i.e., ServletContext) for properties.
<invoke-factory>
- <construct class="org.apache.tapestry.services.impl.ServletContextPropertySource">
- <set-object property="context" value="service-property:tapestry.globals.ApplicationGlobals:context"/>
+ <construct class="org.apache.tapestry.services.impl.InitializationParameterHolderPropertySource">
+ <set-service property="holder" service-id="tapestry.globals.WebContext"/>
</construct>
</invoke-factory>
</service-point>
@@ -72,7 +72,8 @@
</service-point>
- <service-point id="SymbolSourcesPropertySourceFactory" interface="org.apache.hivemind.ServiceImplementationFactory" parameters-occurs="none">
+ <service-point id="SymbolSourcesPropertySourceFactory" interface="org.apache.hivemind.ServiceImplementationFactory"
+ parameters-occurs="none" visibility="private">
A special-purpose ServiceImplementationFactory used just to create the SymbolSourcesPropertySource service.
@@ -80,8 +81,8 @@
</service-point>
<contribution configuration-id="GlobalPropertySources">
- <command id="servlet" object="service:ServletPropertySource"/>
- <command id="context" object="service:ServletContextPropertySource" after="servlet"/>
+ <command id="activator" object="service:WebActivatorPropertySource"/>
+ <command id="context" object="service:WebContextPropertySource" after="activator"/>
<command id="symbols" object="service:SymbolSourcesPropertySource" after="context"/>
</contribution>
@@ -122,10 +123,10 @@
<contribution configuration-id="ApplicationPropertySources">
<command id="app-spec" object="service:ApplicationSpecificationPropertySource"/>
- <command id="servlet" object="service:ServletPropertySource" after="app-spec"/>
- <command id="context" object="service:ServletContextPropertySource" after="servlet"/>
+ <command id="activator" object="service:WebActivatorPropertySource" after="app-spec"/>
+ <command id="context" object="service:WebContextPropertySource" after="activator"/>
<command id="delegate" object="service:DelegatePropertySource" after="context"/>
- <command id="symbols" object="service:SymbolSourcesPropertySource" after="context"/>
+ <command id="symbols" object="service:SymbolSourcesPropertySource" after="delegate"/>
</contribution>
<service-point id="ApplicationSpecificationPropertySource" interface="IPropertySource">
@@ -133,8 +134,8 @@
Obtains property values from application specification meta-data.
<invoke-factory>
- <construct class="org.apache.tapestry.services.impl.ApplicationSpecificationPropertySource">
- <set-object property="specification" value="infrastructure:applicationSpecification"/>
+ <construct class="org.apache.tapestry.util.PropertyHolderPropertySource">
+ <object>infrastructure:applicationSpecification</object>
</construct>
</invoke-factory>
1.8 +2 -2 jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.asset.xml
Index: tapestry.asset.xml
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.asset.xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- tapestry.asset.xml 12 Mar 2005 20:49:15 -0000 1.7
+++ tapestry.asset.xml 14 Mar 2005 22:29:47 -0000 1.8
@@ -62,7 +62,7 @@
<invoke-factory>
<construct class="ContextAssetFactory">
- <set-service property="servletContext" service-id="tapestry.globals.ServletContext"/>
+ <set-service property="context" service-id="infrastructure:context"/>
<set-object property="contextPath" value="infrastructure:contextPath"/>
</construct>
</invoke-factory>
@@ -117,7 +117,7 @@
<service-point id="ResourceDigestSource" interface="ResourceDigestSource">
- Reads and caches Digest digests of fiel exposed by the AssetService.
+ Reads and caches Digest digests of files exposed by the AssetService.
<invoke-factory>
<construct class="ResourceDigestSourceImpl"/>
1.17 +2 -2 jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.services.xml
Index: tapestry.services.xml
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.services.xml,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- tapestry.services.xml 12 Mar 2005 20:49:15 -0000 1.16
+++ tapestry.services.xml 14 Mar 2005 22:29:47 -0000 1.17
@@ -74,8 +74,8 @@
<set-object property="exceptionReporter" value="infrastructure:requestExceptionReporter"/>
<set-service property="assetExternalizer" service-id="tapestry.asset.AssetExternalizer"/>
<set-object property="linkFactory" value="infrastructure:linkFactory"/>
- <set-object property="servletContext" value="service:tapestry.globals.ServletContext"/>
- <set-object property="servletResponse" value="service:tapestry.globals.HttpServletResponse"/>
+ <set-service property="context" service-id="tapestry.globals.WebContext"/>
+ <set-object property="response" value="service:tapestry.globals.WebResponse"/>
<set-service property="digestSource" service-id="tapestry.asset.ResourceDigestSource"/>
</construct>
</invoke-factory>
1.11 +5 -4 jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.globals.xml
Index: tapestry.globals.xml
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.globals.xml,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- tapestry.globals.xml 8 Mar 2005 15:51:43 -0000 1.10
+++ tapestry.globals.xml 14 Mar 2005 22:29:47 -0000 1.11
@@ -74,14 +74,15 @@
</invoke-factory>
</service-point>
- <service-point id="ServletContext" interface="javax.servlet.ServletContext">
+ <service-point id="WebContext" interface="org.apache.tapestry.web.WebContext">
- Exposes the global ServletContext instance as a service.
+ Exposes the global WebContext (a wrapper around the Servlet or Portlet context)
+ as a service.
<invoke-factory service-id="hivemind.lib.ServicePropertyFactory">
- <construct service-id="ApplicationGlobals" property="context"/>
+ <construct service-id="ApplicationGlobals" property="webContext"/>
</invoke-factory>
- </service-point>
+ </service-point>
</module>
\ No newline at end of file
1.12 +21 -16 jakarta-tapestry/framework/src/java/org/apache/tapestry/asset/AssetService.java
Index: AssetService.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/asset/AssetService.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- AssetService.java 12 Mar 2005 22:58:23 -0000 1.11
+++ AssetService.java 14 Mar 2005 22:29:48 -0000 1.12
@@ -22,9 +22,7 @@
import java.util.HashMap;
import java.util.Map;
-import javax.servlet.ServletContext;
import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletResponse;
import org.apache.hivemind.ApplicationRuntimeException;
import org.apache.hivemind.ClassResolver;
@@ -39,6 +37,8 @@
import org.apache.tapestry.services.LinkFactory;
import org.apache.tapestry.services.RequestExceptionReporter;
import org.apache.tapestry.services.ServiceConstants;
+import org.apache.tapestry.web.WebContext;
+import org.apache.tapestry.web.WebResponse;
/**
* A service for building URLs to and accessing {@link org.apache.tapestry.IAsset}s. Most of the
@@ -68,10 +68,10 @@
private LinkFactory _linkFactory;
/** @since 3.1 */
- private ServletContext _servletContext;
+ private WebContext _context;
/** @since 3.1 */
- private HttpServletResponse _servletResponse;
+ private WebResponse _response;
/** @since 3.1 */
private ResourceDigestSource _digestSource;
@@ -153,15 +153,20 @@
return Tapestry.ASSET_SERVICE;
}
- private static String getMimeType(String path)
+ private String getMimeType(String path)
{
- int dotx = path.lastIndexOf('.');
- String key = path.substring(dotx + 1).toLowerCase();
-
- String result = (String) _mimeTypes.get(key);
+ String result = _context.getMimeType(path);
if (result == null)
- result = "text/plain";
+ {
+ int dotx = path.lastIndexOf('.');
+ String key = path.substring(dotx + 1).toLowerCase();
+
+ result = (String) _mimeTypes.get(key);
+
+ if (result == null)
+ result = "text/plain";
+ }
return result;
}
@@ -213,11 +218,11 @@
// on support from the application server (represented
// here by the servletContext).
- String contentType = _servletContext.getMimeType(resourcePath);
+ String contentType = getMimeType(resourcePath);
int contentLength = resourceConnection.getContentLength();
if (contentLength > 0)
- _servletResponse.setContentLength(contentLength);
+ _response.setContentLength(contentLength);
// Set the content type. If the servlet container doesn't
// provide it, try and guess it by the extension.
@@ -280,15 +285,15 @@
}
/** @since 3.1 */
- public void setServletContext(ServletContext servletContext)
+ public void setContext(WebContext context)
{
- _servletContext = servletContext;
+ _context = context;
}
/** @since 3.1 */
- public void setServletResponse(HttpServletResponse servletResponse)
+ public void setResponse(WebResponse response)
{
- _servletResponse = servletResponse;
+ _response = response;
}
/** @since 3.1 */
1.6 +3 -4 jakarta-tapestry/framework/src/java/org/apache/tapestry/asset/ContextAsset.java
Index: ContextAsset.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/asset/ContextAsset.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ContextAsset.java 28 Jan 2005 21:07:16 -0000 1.5
+++ ContextAsset.java 14 Mar 2005 22:29:48 -0000 1.6
@@ -19,10 +19,9 @@
import org.apache.hivemind.ApplicationRuntimeException;
import org.apache.hivemind.Location;
-import org.apache.hivemind.util.ContextResource;
+import org.apache.hivemind.Resource;
import org.apache.hivemind.util.Defense;
import org.apache.tapestry.IAsset;
-import org.apache.tapestry.IEngine;
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.Tapestry;
@@ -39,9 +38,9 @@
private String _resolvedURL;
- public ContextAsset(String contextPath, ContextResource resourceLocation, Location location)
+ public ContextAsset(String contextPath, Resource resource, Location location)
{
- super(resourceLocation, location);
+ super(resource, location);
Defense.notNull(contextPath, "contextPath");
1.5 +10 -11 jakarta-tapestry/framework/src/java/org/apache/tapestry/asset/ContextAssetFactory.java
Index: ContextAssetFactory.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/asset/ContextAssetFactory.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ContextAssetFactory.java 28 Jan 2005 21:07:16 -0000 1.4
+++ ContextAssetFactory.java 14 Mar 2005 22:29:48 -0000 1.5
@@ -16,32 +16,31 @@
import java.util.Locale;
-import javax.servlet.ServletContext;
-
import org.apache.hivemind.ApplicationRuntimeException;
import org.apache.hivemind.Location;
import org.apache.hivemind.Resource;
-import org.apache.hivemind.util.ContextResource;
import org.apache.tapestry.IAsset;
+import org.apache.tapestry.web.WebContext;
+import org.apache.tapestry.web.WebContextResource;
/**
- * For the moment, all "context:" prefixed asset paths are interpreted relative to the servlet
- * context (the web application's root folder).
+ * For the moment, all "context:" prefixed asset paths are interpreted relative to the web context
+ * (the web application's root folder).
*
* @author Howard M. Lewis Ship
* @since 3.1
*/
public class ContextAssetFactory implements AssetFactory
{
- private ServletContext _servletContext;
+ private WebContext _context;
private String _contextPath;
- private ContextResource _servletRoot;
+ private Resource _servletRoot;
public void initializeService()
{
- _servletRoot = new ContextResource(_servletContext, "/");
+ _servletRoot = new WebContextResource(_context, "/");
}
public IAsset createAsset(Resource baseResource, String path, Locale locale, Location location)
@@ -53,12 +52,12 @@
throw new ApplicationRuntimeException(AssetMessages.missingAsset(path, _servletRoot),
location, null);
- return new ContextAsset(_contextPath, (ContextResource) localized, location);
+ return new ContextAsset(_contextPath, localized, location);
}
- public void setServletContext(ServletContext servletContext)
+ public void setContext(WebContext context)
{
- _servletContext = servletContext;
+ _context = context;
}
public void setContextPath(String contextPath)
1.2 +3 -3 jakarta-tapestry/framework/src/java/org/apache/tapestry/html/RequestDisplay.jwc
Index: RequestDisplay.jwc
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/html/RequestDisplay.jwc,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- RequestDisplay.jwc 8 Mar 2005 22:36:40 -0000 1.1
+++ RequestDisplay.jwc 14 Mar 2005 22:29:48 -0000 1.2
@@ -27,8 +27,8 @@
Displays an HTML representation of the request, session, context and servlet.
</description>
- <inject property="request" object="service:tapestry.globals.HttpServletRequest"/>
- <inject property="context" object="service:tapestry.globals.ServletContext"/>
- <inject property="servlet" object="service-property:tapestry.globals.ApplicationGlobals:servlet"/>
+ <inject property="request" object="service:tapestry.globals.WebRequest"/>
+ <inject property="context" object="service:tapestry.globals.WebContext"/>
+ <inject property="activator" object="service-property:tapestry.globals.ApplicationGlobals:activator"/>
</component-specification>
1.2 +2 -2 jakarta-tapestry/framework/src/java/org/apache/tapestry/html/RequestDisplay.html
Index: RequestDisplay.html
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/html/RequestDisplay.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- RequestDisplay.html 8 Mar 2005 22:36:40 -0000 1.1
+++ RequestDisplay.html 14 Mar 2005 22:29:48 -0000 1.2
@@ -2,10 +2,10 @@
<span jwcid="@Describe" object="ognl:request"/>
<span jwcid="@Conditional" condition="ognl:request.getSession(false) != null">
-<span jwcid="@Describe" object="ognl:request.session"/>
+<span jwcid="@Describe" object="ognl:request.getSession(false)"/>
</span>
-<span jwcid="@Describe" object="ognl:servlet"/>
+<span jwcid="@Describe" object="ognl:activator"/>
<span jwcid="@Describe" object="ognl:context"/>
<span jwcid="@Delegator" delegate="ognl:systemPropertiesRenderer"/>
1.7 +0 -1 jakarta-tapestry/framework/src/java/org/apache/tapestry/html/ExceptionDisplay.java
Index: ExceptionDisplay.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/html/ExceptionDisplay.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ExceptionDisplay.java 7 Mar 2005 19:51:57 -0000 1.6
+++ ExceptionDisplay.java 14 Mar 2005 22:29:48 -0000 1.7
@@ -18,7 +18,6 @@
import org.apache.tapestry.IMarkupWriter;
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.bean.EvenOdd;
-import org.apache.tapestry.describe.RenderableAdapterFactory;
import org.apache.tapestry.util.exception.ExceptionDescription;
/**
1.6 +7 -12 jakarta-tapestry/framework/src/java/org/apache/tapestry/services/ApplicationGlobals.java
Index: ApplicationGlobals.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/services/ApplicationGlobals.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ApplicationGlobals.java 25 Feb 2005 00:54:47 -0000 1.5
+++ ApplicationGlobals.java 14 Mar 2005 22:29:48 -0000 1.6
@@ -14,11 +14,8 @@
package org.apache.tapestry.services;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServlet;
-
import org.apache.tapestry.spec.IApplicationSpecification;
+import org.apache.tapestry.web.WebActivator;
import org.apache.tapestry.web.WebContext;
/**
@@ -35,13 +32,15 @@
* Invoked by the (indirectly) by the servlet at init(), after parsing the application
* specification.
*/
- public void store(HttpServlet servlet, IApplicationSpecification applicationSpecification);
+ public void storeActivator(WebActivator activator);
+
+ public void storeSpecification(IApplicationSpecification applicationSpecification);
/**
* Invoked by the (indirectly) by the servlet at init().
*/
- public void store(WebContext context);
+ public void storeContext(WebContext context);
/**
* Returns the previously stored context.
@@ -51,13 +50,9 @@
public WebContext getWebContext();
- public HttpServlet getServlet();
+ public WebActivator getActivator();
public IApplicationSpecification getSpecification();
- public ServletContext getContext();
-
- public String getServletName();
-
- public ServletConfig getServletConfig();
+ public String getActivatorName();
}
\ No newline at end of file
1.2 +18 -0 jakarta-tapestry/framework/src/test/org/apache/tapestry/describe/TestHTMLDescriptionReceiver.java
Index: TestHTMLDescriptionReceiver.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/test/org/apache/tapestry/describe/TestHTMLDescriptionReceiver.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestHTMLDescriptionReceiver.java 7 Mar 2005 19:51:58 -0000 1.1
+++ TestHTMLDescriptionReceiver.java 14 Mar 2005 22:29:48 -0000 1.2
@@ -425,6 +425,24 @@
verifyControls();
}
+ public void testDescribeAlternate()
+ {
+ IMarkupWriter writer = newWriter();
+ DescribableAdapter adapter = newAdapter();
+
+ Object alternate = new Object();
+
+ HTMLDescriptionReceiver dr = new HTMLDescriptionReceiver(writer, adapter);
+
+ adapter.describeObject(alternate, dr);
+
+ replayControls();
+
+ dr.describeAlternate(alternate);
+
+ verifyControls();
+ }
+
public void testIntegration() throws Exception
{
IMarkupWriter writer = newWriter();
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org