DSAMEHrefTag.java revision 25e37495f2591ee8f2c057f2644ed5570b4c078d
/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2005 Sun Microsystems Inc. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: DSAMEHrefTag.java,v 1.3 2008/06/25 05:41:50 qcheng Exp $
*
*/
/**
* Portions Copyrighted 2011 ForgeRock Inc.
* Portions Copyrighted 2012 Open Source Solution Technology Corporation
*/
/**
* Href tag reimplements JATO Href tag. It adds a content encoding
* query parameter and do not do extra encoding. This element helps
* web server to figure out the encoding used.
*/
public class DSAMEHrefTag
extends DisplayFieldTagBase
implements BodyTag {
private boolean displayed=false;
private CompleteRequestException abortedException;
static {
}
/** constructs a href tag */
public DSAMEHrefTag() {
super();
}
/**
* reset tag
*/
public void reset() {
super.reset();
bodyContent = null;
displayed = false;
}
/**
* performs start tag
*
* @return EVAL_BODY_BUFFERED always
* @throws JspException if request context is null
*/
public int doStartTag()
throws JspException {
reset();
try {
if (fireBeginDisplayEvent()) {
/*if (debug.messageEnabled()) {
* debug.message("URL value is : " + value);
*}
*/
if (paramIdx != -1) {
// parameter values followed by URL must be encoded
}
}
} else {
}
}
.append('=')
// buffer.append ("&val="+getName()+"&val2="+value);
// Append the Query String NVP's that might have been added
// as JSP tag attributes
.append("\"");
}
.append("\"");
}
// Append the additional "standard" attributes
displayed = true;
} else {
displayed = false;
}
} catch (CompleteRequestException e) {
// CompleteRequestException tunneling workaround:
// Workaround to allow developers to stop the request
// from a display event by throwing a CompleteRequestException.
// The problem is that some containers catch this exception in
// their JSP rendering subsystem, and so we need to tunnel it
// through for the developer.
// Save the exception here to rethrow later (in doEndTag)
abortedException = e;
return SKIP_BODY;
}
if (displayed) {
return EVAL_BODY_BUFFERED;
} else {
return SKIP_BODY;
}
}
int idx = 0;
int lastProcessedIdx = 0;
try {
if (debug.messageEnabled()) {
//debug.message("query string : " + qStr);
}
// If the encoded value has gx_charset , we need to remove it Since
// it may not have the correct value.
while (st.hasMoreTokens()) {
if (valueIdx != -1) {
} // end if
} // end if (valueIdx != -1)
} // end while
}
/*if (debug.messageEnabled()) {
* debug.message("Final buffer is : " + buffer);
*}
*/
} catch (ArrayIndexOutOfBoundsException ex) {
return;
} catch (Exception e) {
return;
}
}
/**
* does nothing here
*/
public void doInitBody()
throws JspException {
}
/**
* does nothing here
*/
public int doAfterBody()
throws JspException {
return SKIP_BODY;
}
/**
* does end tag
*
* @return SKIP_PAGE if tag is not going to be displayed
*/
public int doEndTag()
throws JspException {
try {
// If the display was aborted during the beginning of the process by
// a CompleteRequestException, we retrhow that exception here,
// because this is the only location we can safely return SKIP_PAGE
if (abortedException != null) {
throw abortedException;
}
if (displayed) {
if (bodyContent != null) {
// Assume that "true" is default for trim
} else {
}
}
}
} catch (CompleteRequestException e) {
// CompleteRequestException tunneling workaround:
// Workaround to allow developers to stop the request
// from a display event by throwing a CompleteRequestException.
// The problem is that some containers catch this exception in
// their JSP rendering subsystem, and so we need to tunnel it
// through for the developer.
// Mark the JSP rendering as cancelled. The calling
// ViewBean.foward() or ViewBean.include() methods
// should pick this up and then throw a complete request
// exception that was properly thrown here.
return SKIP_PAGE;
}
return EVAL_PAGE;
}
public BodyContent getBodyContent() {
return bodyContent;
}
bodyContent = value;
}
/**
* via the JSP tag attribute "queryParams".
* NOTE - this tag assumes that the JSP author has URL encoded the value
* portions of the name value pairs where needed.
* This tag also prepends an ampersand '&' before the first NVP, and assumes
* that the JSP author has provided the '&' delimiters between the remaining
* NVPs.
*
*/
throws JspException {
}
}
/**
* takes an arbitrarily deep namePath (e.g. "Page1.Repeated2.Foo") which
* describes the containment relationship of a given display field to
* its container views, and returns a reference to the display field itself.
*
* @param namePath - An arbitrarily deep namePath (e.g.
* "Page1.Repeated2.Foo") which describes the containment relationship of
* a display field to its container views
* @return requested DisplayField
*/
throws JspException {
// We can assume that the source class must be the parent view bean !!!
// The same is not true for the target though.
/*
* Descend through view hierarchy until you get to the direct parent
* field the direct parent may be a tiled view, arbitrarily nested
* start count at one,
*/
}
}
}
}
}
}
}
}
public String getQueryParams() {
}
}
}
}
}