001: /*
002: * $Id: URLTag.java 565422 2007-08-13 17:09:16Z jholmes $
003: *
004: * Licensed to the Apache Software Foundation (ASF) under one
005: * or more contributor license agreements. See the NOTICE file
006: * distributed with this work for additional information
007: * regarding copyright ownership. The ASF licenses this file
008: * to you under the Apache License, Version 2.0 (the
009: * "License"); you may not use this file except in compliance
010: * with the License. You may obtain a copy of the License at
011: *
012: * http://www.apache.org/licenses/LICENSE-2.0
013: *
014: * Unless required by applicable law or agreed to in writing,
015: * software distributed under the License is distributed on an
016: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017: * KIND, either express or implied. See the License for the
018: * specific language governing permissions and limitations
019: * under the License.
020: */
021: package org.apache.struts2.views.jsp;
022:
023: import javax.servlet.http.HttpServletRequest;
024: import javax.servlet.http.HttpServletResponse;
025:
026: import org.apache.struts2.components.Component;
027: import org.apache.struts2.components.URL;
028:
029: import com.opensymphony.xwork2.util.ValueStack;
030:
031: /**
032: * @see URL
033: */
034: public class URLTag extends ComponentTagSupport {
035:
036: private static final long serialVersionUID = 1722460444125206226L;
037:
038: protected String includeParams;
039: protected String scheme;
040: protected String value;
041: protected String action;
042: protected String namespace;
043: protected String method;
044: protected String encode;
045: protected String includeContext;
046: protected String escapeAmp;
047: protected String portletMode;
048: protected String windowState;
049: protected String portletUrlType;
050: protected String anchor;
051: protected String forceAddSchemeHostAndPort;
052:
053: public Component getBean(ValueStack stack, HttpServletRequest req,
054: HttpServletResponse res) {
055: return new URL(stack, req, res);
056: }
057:
058: protected void populateParams() {
059: super .populateParams();
060:
061: URL url = (URL) component;
062: url.setIncludeParams(includeParams);
063: url.setScheme(scheme);
064: url.setValue(value);
065: url.setMethod(method);
066: url.setNamespace(namespace);
067: url.setAction(action);
068: url.setPortletMode(portletMode);
069: url.setPortletUrlType(portletUrlType);
070: url.setWindowState(windowState);
071: url.setAnchor(anchor);
072:
073: if (encode != null) {
074: url.setEncode(Boolean.valueOf(encode).booleanValue());
075: }
076: if (includeContext != null) {
077: url.setIncludeContext(Boolean.valueOf(includeContext)
078: .booleanValue());
079: }
080: if (escapeAmp != null) {
081: url.setEscapeAmp(Boolean.valueOf(escapeAmp).booleanValue());
082: }
083: if (forceAddSchemeHostAndPort != null) {
084: url.setForceAddSchemeHostAndPort(Boolean.valueOf(
085: forceAddSchemeHostAndPort).booleanValue());
086: }
087: }
088:
089: public void setEncode(String encode) {
090: this .encode = encode;
091: }
092:
093: public void setIncludeContext(String includeContext) {
094: this .includeContext = includeContext;
095: }
096:
097: public void setEscapeAmp(String escapeAmp) {
098: this .escapeAmp = escapeAmp;
099: }
100:
101: public void setIncludeParams(String name) {
102: includeParams = name;
103: }
104:
105: public void setAction(String action) {
106: this .action = action;
107: }
108:
109: public void setNamespace(String namespace) {
110: this .namespace = namespace;
111: }
112:
113: public void setMethod(String method) {
114: this .method = method;
115: }
116:
117: public void setScheme(String scheme) {
118: this .scheme = scheme;
119: }
120:
121: public void setValue(String value) {
122: this .value = value;
123: }
124:
125: public void setPortletMode(String portletMode) {
126: this .portletMode = portletMode;
127: }
128:
129: public void setPortletUrlType(String portletUrlType) {
130: this .portletUrlType = portletUrlType;
131: }
132:
133: public void setWindowState(String windowState) {
134: this .windowState = windowState;
135: }
136:
137: public void setAnchor(String anchor) {
138: this .anchor = anchor;
139: }
140:
141: public void setForceAddSchemeHostAndPort(
142: String forceAddSchemeHostAndPort) {
143: this.forceAddSchemeHostAndPort = forceAddSchemeHostAndPort;
144: }
145: }
|