View Javadoc

1   /*
2    * $Id$
3    *
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  package org.apache.struts2.components;
22  
23  import com.opensymphony.xwork2.util.ValueStack;
24  
25  import javax.servlet.http.HttpServletRequest;
26  import javax.servlet.http.HttpServletResponse;
27  import java.util.Map;
28  
29  /***
30   * Implemntations of this interface can be used to build a URL
31   */
32  public interface UrlProvider {
33      /***
34       * The includeParams attribute may have the value 'none', 'get' or 'all'.
35       * It is used when the url tag is used without a value attribute.
36       * Its value is looked up on the ValueStack
37       * If no includeParams is specified then 'get' is used.
38       * none - include no parameters in the URL
39       * get  - include only GET parameters in the URL (default)
40       * all  - include both GET and POST parameters in the URL
41       */
42      public static final String NONE = "none";
43      public static final String GET = "get";
44      public static final String ALL = "all";
45  
46      boolean isPutInContext();
47  
48      String getVar();
49  
50      String getValue();
51  
52      String findString(String value);
53  
54      void setValue(String string);
55  
56      String getUrlIncludeParams();
57  
58      String getIncludeParams();
59  
60      Map getParameters();
61  
62      HttpServletRequest getHttpServletRequest();
63  
64      String getAction();
65  
66      ExtraParameterProvider getExtraParameterProvider();
67  
68      String getScheme();
69  
70      String getNamespace();
71  
72      String getMethod();
73  
74      HttpServletResponse getHttpServletResponse();
75  
76      boolean isIncludeContext();
77  
78      boolean isEncode();
79  
80      boolean isForceAddSchemeHostAndPort();
81  
82      boolean isEscapeAmp();
83      
84      String getPortletMode();
85      
86      String getWindowState();
87  
88      String determineActionURL(String action, String namespace, String method, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Map parameters, String scheme, boolean includeContext, boolean encode, boolean forceAddSchemeHostAndPort, boolean escapeAmp);
89      
90      String determineNamespace(String namespace, ValueStack stack, HttpServletRequest req);
91  
92      String getAnchor();
93      
94      String getPortletUrlType();
95      
96      ValueStack getStack();
97  
98      void setUrlIncludeParams(String urlIncludeParams);
99  
100     void setHttpServletRequest(HttpServletRequest req);
101 
102     void setHttpServletResponse(HttpServletResponse res);
103 
104     void setUrlRenderer(UrlRenderer urlRenderer);
105 
106     void setExtraParameterProvider(ExtraParameterProvider provider);
107 
108     void setIncludeParams(String includeParams);
109 
110     void setScheme(String scheme);
111 
112     void setAction(String action);
113 
114     void setPortletMode(String portletMode);
115 
116     void setNamespace(String namespace);
117 
118     void setMethod(String method);
119 
120     void setEncode(boolean encode);
121 
122     void setIncludeContext(boolean includeContext);
123 
124     void setWindowState(String windowState);
125 
126     void setPortletUrlType(String portletUrlType);
127 
128     void setAnchor(String anchor);
129 
130     void setEscapeAmp(boolean escapeAmp);
131 
132     void setForceAddSchemeHostAndPort(boolean forceAddSchemeHostAndPort);
133 
134     void putInContext(String result);
135 }