View Javadoc

1   /*
2    * Copyright (c) 2001 - 2005 ivata limited.
3    * All rights reserved.
4    * ---------------------------------------------------------
5    * ivata groupware may be redistributed under the GNU General Public
6    * License as published by the Free Software Foundation;
7    * version 2 of the License.
8    *
9    * These programs are free software; you can redistribute them and/or
10   * modify them under the terms of the GNU General Public License
11   * as published by the Free Software Foundation; version 2 of the License.
12   *
13   * These programs are distributed in the hope that they will be useful,
14   * but WITHOUT ANY WARRANTY; without even the implied warranty of
15   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16   *
17   * See the GNU General Public License in the file LICENSE.txt for more
18   * details.
19   *
20   * If you would like a copy of the GNU General Public License write to
21   *
22   * Free Software Foundation, Inc.
23   * 59 Temple Place - Suite 330
24   * Boston, MA 02111-1307, USA.
25   *
26   *
27   * To arrange commercial support and licensing, contact ivata at
28   *                  http://www.ivata.com/contact.jsp
29   * ---------------------------------------------------------
30   * $Log: LinkTag.java,v $
31   * Revision 1.2  2005/04/28 18:23:35  colinmacleod
32   * Added server/contextPath rewriting.
33   *
34   * Revision 1.1  2005/04/11 14:56:37  colinmacleod
35   * Added base tag, link tag and rewrite tag to
36   * change the host name via environment entries.
37   * Added errors tag to handle errors even when
38   * the message is not found in the application
39   * resources.
40   *
41   * Revision 1.1.1.1  2005/03/10 17:52:41  colinmacleod
42   * Restructured ivata op around Hibernate/PicoContainer.
43   * Renamed ivata groupware.
44   *
45   * ---------------------------------------------------------
46   */
47  package com.ivata.mask.web.tag.html;
48  
49  import javax.servlet.http.HttpServletRequest;
50  import javax.servlet.jsp.JspException;
51  
52  import com.ivata.mask.web.RewriteHandling;
53  
54  /***
55   * <p>
56   * Overridden from <strong>Struts</strong> to let you specify a server and
57   * context as environment entries.
58   * </p>
59   *
60   * @since ivata groupware 0.10 (09-Mar-2005)
61   * @author Colin MacLeod <colin.macleod@ivata.com>
62   * @version $Revision: 1.2 $
63   */
64  
65  public class LinkTag extends org.apache.struts.taglib.html.LinkTag {
66      /***
67       * Return the complete URL to which this hyperlink will direct the user.
68       *
69       * @exception JspException if an exception is thrown calculating the value
70       * @return complete URL to which this hyperlink will direct the user.
71       */
72      protected String calculateURL() throws JspException {
73          String url = super.calculateURL();
74          HttpServletRequest request = (HttpServletRequest)
75          pageContext.getRequest();
76          return RewriteHandling.rewriteURL(url, request.getContextPath());
77      }
78  }