You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tiles.apache.org by ap...@apache.org on 2007/03/19 16:52:36 UTC
svn commit: r519978 [2/2] - in /tiles/framework/trunk:
tiles-api/src/main/java/org/apache/tiles/mgmt/
tiles-api/src/main/java/org/apache/tiles/web/
tiles-core/src/main/java/org/apache/tiles/context/portlet/
tiles-core/src/main/java/org/apache/tiles/con...
Modified: tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/definition/DefinitionTag.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/definition/DefinitionTag.java?view=diff&rev=519978&r1=519977&r2=519978
==============================================================================
--- tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/definition/DefinitionTag.java (original)
+++ tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/definition/DefinitionTag.java Mon Mar 19 08:52:33 2007
@@ -42,61 +42,150 @@
*
* @version $Rev$ $Date$
*/
+/**
+ * @author PTRNTN77A26E506O
+ *
+ */
+/**
+ * @author PTRNTN77A26E506O
+ *
+ */
+/**
+ * @author PTRNTN77A26E506O
+ *
+ */
public class DefinitionTag extends TagSupport
implements PutAttributeTagParent {
+ /**
+ * Name of the definition to configure.
+ */
private String name;
+
+ /**
+ * The template of the definition.
+ */
private String template;
+
+ /**
+ * The (optional) definition name that this definition extends.
+ */
private String extend;
+
+ /**
+ * The role to check when rendering this definition.
+ */
private String role;
+
+ /**
+ * The definition view preparer.
+ */
private String preparer;
+ /**
+ * The mutable Tiles container to use.
+ */
private MutableTilesContainer container;
+
+ /**
+ * Maps attribute names with their attributes.
+ */
private Map<String, ComponentAttribute> attributes;
+ /**
+ * Returns the name of the definition to configure.
+ *
+ * @return The definition name.
+ */
public String getName() {
return name;
}
+ /**
+ * Sets the name of the definition to configure.
+ *
+ * @param name The definition name.
+ */
public void setName(String name) {
this.name = name;
}
+ /**
+ * Returns the template URI of the definition.
+ *
+ * @return The template URI.
+ */
public String getTemplate() {
return template;
}
+ /**
+ * Sets the template URI of the definition.
+ *
+ * @param template The template URI.
+ */
public void setTemplate(String template) {
this.template = template;
}
+ /**
+ * Returns the (optional) definition name that this definition extends.
+ *
+ * @return The extending definition name.
+ */
public String getExtends() {
return extend;
}
+ /**
+ * Sets the (optional) definition name that this definition extends.
+ *
+ * @param extend The extending definition name.
+ */
public void setExtends(String extend) {
this.extend = extend;
}
+ /**
+ * Returns the role to check when rendering this definition.
+ *
+ * @return The role to check.
+ */
public String getRole() {
return role;
}
+ /**
+ * Sets the role to check when rendering this definition.
+ *
+ * @param role The role to check.
+ */
public void setRole(String role) {
this.role = role;
}
+ /**
+ * Returns the definition view preparer.
+ *
+ * @return The view preparer name.
+ */
public String getPreparer() {
return preparer;
}
+ /**
+ * Sets the definition view preparer.
+ *
+ * @param preparer The view preparer name.
+ */
public void setPreparer(String preparer) {
this.preparer = preparer;
}
+ /** {@inheritDoc} */
public void release() {
super.release();
name = null;
@@ -107,6 +196,7 @@
attributes.clear();
}
+ /** {@inheritDoc} */
public int doStartTag() throws JspException {
attributes = new HashMap<String, ComponentAttribute>();
@@ -125,6 +215,7 @@
return EVAL_BODY_INCLUDE;
}
+ /** {@inheritDoc} */
public int doEndTag() throws JspException {
TileDefinition d = new TileDefinition();
d.setName(name);
@@ -145,8 +236,10 @@
/**
* Reset member values for reuse. This method calls super.release(),
* which invokes TagSupport.release(), which typically does nothing.
+ *
+ * @param nestedTag The nested <code>PutAttributeTag</code>
+ * @throws JspException Never thrown, it's here for API compatibility.
*/
-
public void processNestedTag(PutAttributeTag nestedTag) throws JspException {
ComponentAttribute attr = new ComponentAttribute(nestedTag.getValue(),
nestedTag.getRole(), nestedTag.getType());
Modified: tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/definition/InitContainerTag.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/definition/InitContainerTag.java?view=diff&rev=519978&r1=519977&r2=519978
==============================================================================
--- tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/definition/InitContainerTag.java (original)
+++ tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/definition/InitContainerTag.java Mon Mar 19 08:52:33 2007
@@ -55,44 +55,62 @@
public class InitContainerTag extends BodyTagSupport
implements PutAttributeTagParent {
+ /**
+ * The logging object.
+ */
private static final Log LOG =
LogFactory.getLog(InitContainerTag.class);
+ /**
+ * The container factory class name to use.
+ */
private String containerFactory;
+
+ /**
+ * Init parameters map.
+ */
private Map<String, String> initParameters;
+ /**
+ * Returns the container factory class name.
+ *
+ * @return The container factory class name.
+ */
public String getContainerFactory() {
return containerFactory;
}
+ /**
+ * Sets the container factory class name.
+ *
+ * @param containerFactory The container factory class name.
+ */
public void setContainerFactory(String containerFactory) {
this.containerFactory = containerFactory;
}
+ /** {@inheritDoc} */
public void processNestedTag(PutAttributeTag nestedTag) throws JspException {
initParameters.put(nestedTag.getName(), nestedTag.getValue().toString());
}
- /**
- * Release all allocated resources.
- */
+ /** {@inheritDoc} */
public void release() {
super.release();
containerFactory = null;
initParameters = null;
}
+ /** {@inheritDoc} */
public int doStartTag() {
initParameters = new HashMap<String, String>();
return EVAL_BODY_INCLUDE;
}
- /**
- * TODO Add a MutableContainer so that this can be done?
- * Do start tag.
- */
+ /** {@inheritDoc} */
+ // TODO Add a MutableContainer so that this can be done?
public int doEndTag() throws JspException {
TilesContainer container =
TilesAccess.getContainer(pageContext.getServletContext());
@@ -131,90 +149,129 @@
+ /**
+ * A servlet context created "on the fly" for container initialization.
+ */
public class RuntimeConfiguredContext implements ServletContext {
+ /**
+ * The root servlet context.
+ */
private ServletContext rootContext;
+
+ /**
+ * The custom init parameters.
+ */
private Map<String, String> initParameters;
+ /**
+ * Constructor.
+ *
+ * @param rootContext The "real" servlet context.
+ */
public RuntimeConfiguredContext(ServletContext rootContext) {
this.rootContext = rootContext;
this.initParameters = new HashMap<String, String>();
}
+ /** {@inheritDoc} */
public ServletContext getContext(String string) {
return rootContext.getContext(string);
}
+ /** {@inheritDoc} */
public int getMajorVersion() {
return rootContext.getMajorVersion();
}
+ /** {@inheritDoc} */
public int getMinorVersion() {
return rootContext.getMinorVersion();
}
+ /** {@inheritDoc} */
public String getMimeType(String string) {
return rootContext.getMimeType(string);
}
+ /** {@inheritDoc} */
@SuppressWarnings("unchecked")
public Set getResourcePaths(String string) {
return rootContext.getResourcePaths(string);
}
+ /** {@inheritDoc} */
public URL getResource(String string) throws MalformedURLException {
return rootContext.getResource(string);
}
+ /** {@inheritDoc} */
public InputStream getResourceAsStream(String string) {
return rootContext.getResourceAsStream(string);
}
+ /** {@inheritDoc} */
public RequestDispatcher getRequestDispatcher(String string) {
return rootContext.getRequestDispatcher(string);
}
+ /** {@inheritDoc} */
public RequestDispatcher getNamedDispatcher(String string) {
return rootContext.getNamedDispatcher(string);
}
+ /** {@inheritDoc} */
@SuppressWarnings("deprecation")
public Servlet getServlet(String string) throws ServletException {
return rootContext.getServlet(string);
}
+ /** {@inheritDoc} */
@SuppressWarnings({ "deprecation", "unchecked" })
public Enumeration getServlets() {
return rootContext.getServlets();
}
+ /** {@inheritDoc} */
@SuppressWarnings({ "deprecation", "unchecked" })
public Enumeration getServletNames() {
return rootContext.getServletNames();
}
+ /** {@inheritDoc} */
public void log(String string) {
rootContext.log(string);
}
+ /** {@inheritDoc} */
@SuppressWarnings("deprecation")
public void log(Exception exception, String string) {
rootContext.log(exception, string);
}
+ /** {@inheritDoc} */
public void log(String string, Throwable throwable) {
rootContext.log(string, throwable);
}
+ /** {@inheritDoc} */
public String getRealPath(String string) {
return rootContext.getRealPath(string);
}
+ /** {@inheritDoc} */
public String getServerInfo() {
return rootContext.getServerInfo();
}
+ /**
+ * Takes the init parameters either from the custom parameters or from
+ * the root context.
+ *
+ * @param string The parameter name.
+ * @see javax.servlet.ServletContext#getInitParameter(java.lang.String)
+ */
public String getInitParameter(String string) {
if (initParameters.containsKey(string)) {
return initParameters.get(string);
@@ -222,32 +279,50 @@
return rootContext.getInitParameter(string);
}
+ /**
+ * Sets an init parameter value.
+ *
+ * @param name The name of the parameter.
+ * @param value The value of the parameter.
+ */
public void setInitParameter(String name, String value) {
initParameters.put(name, value);
}
+ /**
+ * Returns init parameter names, including the custom and the original
+ * ones.
+ *
+ * @see javax.servlet.ServletContext#getInitParameterNames()
+ */
@SuppressWarnings("unchecked")
public Enumeration getInitParameterNames() {
+ // FIXME This implementation is wrong!
return rootContext.getInitParameterNames();
}
+ /** {@inheritDoc} */
public Object getAttribute(String string) {
return rootContext.getAttribute(string);
}
+ /** {@inheritDoc} */
@SuppressWarnings("unchecked")
public Enumeration getAttributeNames() {
return rootContext.getAttributeNames();
}
+ /** {@inheritDoc} */
public void setAttribute(String string, Object object) {
rootContext.setAttribute(string, object);
}
+ /** {@inheritDoc} */
public void removeAttribute(String string) {
rootContext.removeAttribute(string);
}
+ /** {@inheritDoc} */
public String getServletContextName() {
return rootContext.getServletContextName();
}
Modified: tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/servlet/IncludingServlet.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/servlet/IncludingServlet.java?view=diff&rev=519978&r1=519977&r2=519978
==============================================================================
--- tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/servlet/IncludingServlet.java (original)
+++ tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/servlet/IncludingServlet.java Mon Mar 19 08:52:33 2007
@@ -37,10 +37,18 @@
*/
public class IncludingServlet extends HttpServlet {
+ /**
+ * Init parameter value, that indicates the pate to include.
+ */
private String include;
/**
- * Initializes the servlet, reading the <code>include</code> init parameter
+ * Initializes the servlet, reading the <code>include</code> init
+ * parameter
+ *
+ * @param config The servlet configuration object to use.
+ * @throws ServletException Thrown by
+ * {@link HttpServlet#init(ServletConfig)}
*/
public void init(ServletConfig config) throws ServletException {
super.init(config);
@@ -50,6 +58,11 @@
/**
* Processes the request, including the specified page.
+ *
+ * @param request The request object.
+ * @param response The response object.
+ * @throws ServletException Thrown by the {@link #include} method.
+ * @throws IOException Thrown by the {@link #include} method.
*/
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
Modified: tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/servlet/SelectLocaleServlet.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/servlet/SelectLocaleServlet.java?view=diff&rev=519978&r1=519977&r2=519978
==============================================================================
--- tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/servlet/SelectLocaleServlet.java (original)
+++ tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/servlet/SelectLocaleServlet.java Mon Mar 19 08:52:33 2007
@@ -36,23 +36,36 @@
import org.apache.tiles.ComponentConstants;
/**
+ * Servlet able to let a user choose a locale.
+ *
* @version $Rev$ $Date$
*/
public class SelectLocaleServlet extends HttpServlet {
+ /** {@inheritDoc} */
@Override
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
process(request, response);
}
+ /** {@inheritDoc} */
@Override
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
- // TODO Auto-generated method stub
process(request, response);
}
+ /**
+ * Processes the request.
+ *
+ * @param request The request object.
+ * @param response The response object.
+ * @throws ServletException If something goes wrong when rendering
+ * <code>test.localized.definition</code> definition.
+ * @throws IOException It will be never thrown, it is there only for API
+ * compatibility.
+ */
private void process(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
String localeParameter = request.getParameter("locale");