001 // Copyright 2004, 2005 The Apache Software Foundation 002 // 003 // Licensed under the Apache License, Version 2.0 (the "License"); 004 // you may not use this file except in compliance with the License. 005 // You may obtain a copy of the License at 006 // 007 // http://www.apache.org/licenses/LICENSE-2.0 008 // 009 // Unless required by applicable law or agreed to in writing, software 010 // distributed under the License is distributed on an "AS IS" BASIS, 011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 012 // See the License for the specific language governing permissions and 013 // limitations under the License. 014 015 package org.apache.tapestry.link; 016 017 import org.apache.tapestry.engine.ILink; 018 019 /** 020 * Used by {@link org.apache.tapestry.link.GenericLink} to represent 021 * an external, static URL. 022 * 023 * @author Howard Lewis Ship 024 * @since 3.0 025 * 026 **/ 027 public class StaticLink implements ILink 028 { 029 private String _url; 030 031 public StaticLink(String url) 032 { 033 _url = url; 034 } 035 036 public String getURL() 037 { 038 return _url; 039 } 040 041 public String getURL(String anchor, boolean includeParameters) 042 { 043 if (anchor == null) 044 return _url; 045 046 return _url + "#" + anchor; 047 } 048 049 public String getAbsoluteURL() 050 { 051 return _url; 052 } 053 054 public String getAbsoluteURL( 055 String scheme, 056 String server, 057 int port, 058 String anchor, 059 boolean includeParameters) 060 { 061 return getURL(anchor, false); 062 } 063 064 public String[] getParameterNames() 065 { 066 return null; 067 } 068 069 public String[] getParameterValues(String name) 070 { 071 throw new IllegalArgumentException(); 072 } 073 074 }