Skip to content

Package: RequestContext

RequestContext

Coverage

1: /*
2: * #%L
3: * *********************************************************************************************************************
4: *
5: * NorthernWind - lightweight CMS
6: * http://northernwind.tidalwave.it - git clone https://bitbucket.org/tidalwave/northernwind-src.git
7: * %%
8: * Copyright (C) 2011 - 2023 Tidalwave s.a.s. (http://tidalwave.it)
9: * %%
10: * *********************************************************************************************************************
11: *
12: * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
13: * the License. You may obtain a copy of the License at
14: *
15: * http://www.apache.org/licenses/LICENSE-2.0
16: *
17: * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
18: * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
19: * specific language governing permissions and limitations under the License.
20: *
21: * *********************************************************************************************************************
22: *
23: *
24: * *********************************************************************************************************************
25: * #L%
26: */
27: package it.tidalwave.northernwind.core.model;
28:
29: import javax.annotation.Nonnull;
30: import it.tidalwave.util.Key;
31: import it.tidalwave.northernwind.core.model.spi.RequestResettable;
32:
33: /***********************************************************************************************************************
34: *
35: * The context for a {@link Request} provides access to some items that are only available during the processing of
36: * the request.
37: *
38: * @author Fabrizio Giudici
39: *
40: **********************************************************************************************************************/
41: public interface RequestContext extends RequestResettable
42: {
43: /*******************************************************************************************************************
44: *
45: * Sets the current {@link Content}.
46: *
47: * @param content the current {@code Content}
48: *
49: ******************************************************************************************************************/
50: public void setContent (@Nonnull Content content);
51:
52: /*******************************************************************************************************************
53: *
54: * Returns the current {@link Content} properties.
55: *
56: * @return the properties
57: *
58: ******************************************************************************************************************/
59: @Nonnull
60: public ResourceProperties getContentProperties();
61:
62: /*******************************************************************************************************************
63: *
64: * Clears the current {@link Resource}.
65: *
66: ******************************************************************************************************************/
67: public void clearContent();
68:
69: /*******************************************************************************************************************
70: *
71: * Sets the current {@link SiteNode}.
72: *
73: * @param node the current {@code SiteNode}
74: *
75: ******************************************************************************************************************/
76: public void setNode (@Nonnull SiteNode node);
77:
78: /*******************************************************************************************************************
79: *
80: * Returns the current {@link SiteNode} properties.
81: *
82: * @return the properties
83: *
84: ******************************************************************************************************************/
85: @Nonnull
86: public ResourceProperties getNodeProperties();
87:
88: /*******************************************************************************************************************
89: *
90: * Clears the current {@link SiteNode}.
91: *
92: ******************************************************************************************************************/
93: public void clearNode();
94:
95: /*******************************************************************************************************************
96: *
97: * Sets a dynamic node property. These properties can be associated to the current {@link SiteNode}, created in
98: * a dynamic fashion while processing the {@link Request} and available only in the {@link RequestContext}.
99: *
100: * This property will be made available by {@link #getNodeProperties()}, which e.g. is used by the
101: * {@code $nodeProperty(...)$} macro.
102: *
103: * @param key the property key
104: * @param value the property value
105: *
106: ******************************************************************************************************************/
107: public <T> void setDynamicNodeProperty (@Nonnull Key<T> key, @Nonnull T value);
108: }