From e4e0223452b84ab31a82e5014329ba7bb389aa19 Mon Sep 17 00:00:00 2001 From: "Eric J. Bowersox" Date: Wed, 24 Apr 2002 06:39:29 +0000 Subject: [PATCH] the erbo_reorg_04202002 branch is no more...development continues on the trunk while the stable_branch_04202002 branch takes the 'stable' role --- rpcscripts/session.js | 4 +- scripts/comm/invite.js | 3 +- scripts/comm/photo.js | 3 +- scripts/comm/show.js | 3 +- scripts/conf/invite_conf.js | 3 +- scripts/conf/invite_topic.js | 4 +- scripts/conf/posts.js | 3 +- scripts/login.js | 8 +- scripts/logout.js | 6 +- scripts/new_account.js | 5 +- scripts/new_account_2.js | 4 +- scripts/profile_photo.js | 3 +- scripts/showuser.js | 3 +- scripts/sysadmin/modify_photo.js | 3 +- .../venice/except/InternalStateError.java | 84 +- .../venice/except/NoSuchServiceException.java | 60 + .../venice/except/VeniceException.java | 41 +- .../venice/except/VeniceRuntimeException.java | 159 ++ .../silverwrist/venice/ui/RequestInput.java | 326 +++- .../silverwrist/venice/ui/RequestOutput.java | 46 +- .../venice/ui/conf/jsp/PostBoxTag.java | 20 +- .../venice/ui/conf/jsp/PostRewriteTag.java | 9 +- .../venice/ui/conf/view/FindPostView.java | 8 +- .../venice/ui/conf/view/PostsView.java | 11 +- .../venice/ui/dlg/BaseDialogField.java | 11 +- .../venice/ui/dlg/CategoryHeader.java | 6 +- .../venice/ui/dlg/CommunityLogoField.java | 7 +- src/com/silverwrist/venice/ui/dlg/Dialog.java | 17 +- .../venice/ui/dlg/ImageButton.java | 4 +- .../venice/ui/dlg/UserPhotoField.java | 7 +- .../venice/ui/helpers/ConfirmBox.java | 17 +- .../venice/ui/helpers/CookieControl.java | 31 + .../venice/ui/helpers/ErrorBox.java | 20 +- .../venice/ui/helpers/HTMLRendering.java | 72 + .../venice/ui/helpers/ImageHandler.java | 3 +- .../venice/ui/helpers/SessionControl.java | 33 + .../venice/ui/helpers/ThrowableContent.java | 93 +- .../venice/ui/jsp/FrameBodyTag.java | 5 +- .../venice/ui/jsp/UtilButtonTag.java | 8 +- .../venice/ui/jsp/UtilColorTag.java | 5 +- .../venice/ui/jsp/UtilCommentTag.java | 4 +- .../venice/ui/jsp/UtilExpandServletTag.java | 7 +- .../venice/ui/jsp/UtilFontTag.java | 7 +- .../venice/ui/jsp/UtilFormTag.java | 10 +- .../venice/ui/jsp/UtilHeaderTag.java | 6 +- .../venice/ui/jsp/UtilHrefTag.java | 4 +- .../venice/ui/jsp/UtilImageTag.java | 7 +- .../venice/ui/jsp/UtilLinkTag.java | 10 +- .../venice/ui/jsp/UtilMenuHeaderTag.java | 17 +- .../venice/ui/jsp/UtilStdBulletTag.java | 8 +- .../venice/ui/jsp/UtilStockMessageTag.java | 6 +- .../venice/ui/jsp/UtilXLinkTag.java | 7 +- .../venice/ui/menus/CommunityMenu.java | 19 +- .../venice/ui/menus/ImageItem.java | 4 +- .../silverwrist/venice/ui/menus/LinkItem.java | 41 +- src/com/silverwrist/venice/ui/menus/Menu.java | 9 +- .../venice/ui/rpc/XmlRpcMethod.java | 24 +- .../venice/ui/rpc/XmlRpcServlet.java | 4 +- .../venice/ui/script/ScriptLibrary.java | 21 + .../venice/ui/script/ScriptManager.java | 71 +- .../ui/script/ScriptManagerContainer.java | 8 +- .../venice/ui/script/ScriptSupport.java | 34 + .../venice/ui/servlet/BaseServlet.java | 35 +- .../venice/ui/servlet/FrameServlet.java | 3 +- .../ui/servlet/HttpVeniceUISession.java | 12 +- .../venice/ui/servlet/RequestImpl.java | 1519 +++++++++++------ .../venice/ui/servlet/ScriptExecServlet.java | 10 +- .../venice/ui/servlet/StyleSheetServlet.java | 51 +- .../venice/ui/servlet/UserServlet.java | 8 +- .../venice/ui/sidebox/CommunityBox.java | 21 +- .../venice/ui/sidebox/ConferenceBox.java | 24 +- .../silverwrist/venice/ui/view/AuditView.java | 25 +- .../silverwrist/venice/ui/view/FindView.java | 10 +- .../silverwrist/venice/ui/view/JSPView.java | 10 +- .../venice/ui/view/NestedJSPView.java | 8 +- .../venice/ui/view/PhotoUploader.java | 6 +- .../venice/ui/view/SideBoxNestedView.java | 17 +- .../venice/ui/view/TextMessage.java | 15 +- .../venice/util/ServiceProvider.java | 58 + 79 files changed, 2275 insertions(+), 1043 deletions(-) create mode 100644 src/com/silverwrist/venice/except/NoSuchServiceException.java create mode 100644 src/com/silverwrist/venice/except/VeniceRuntimeException.java create mode 100644 src/com/silverwrist/venice/ui/helpers/CookieControl.java create mode 100644 src/com/silverwrist/venice/ui/helpers/HTMLRendering.java create mode 100644 src/com/silverwrist/venice/ui/helpers/SessionControl.java create mode 100644 src/com/silverwrist/venice/ui/script/ScriptSupport.java create mode 100644 src/com/silverwrist/venice/util/ServiceProvider.java diff --git a/rpcscripts/session.js b/rpcscripts/session.js index efeda16..327e9b1 100644 --- a/rpcscripts/session.js +++ b/rpcscripts/session.js @@ -18,6 +18,7 @@ importPackage(java.util); importPackage(Packages.com.silverwrist.venice.core); +importPackage(Packages.com.silverwrist.venice.ui.helpers); importPackage(Packages.com.silverwrist.venice.ui.rpc); rinput = bsf.lookupBean("request"); @@ -32,7 +33,8 @@ if ("destroy"==call_name) vlib.output(new XmlRpcFault(XmlRpcFault.INVALID_PARAMS,"parameter count mismatch")); else { // end the session - rinput.endSession(); + sctl = vlib.querySessionControl(rinput); + sctl.endSession(); vlib.output(vlib.booleanObject(true)); } // end else diff --git a/scripts/comm/invite.js b/scripts/comm/invite.js index c8e3504..ad40429 100644 --- a/scripts/comm/invite.js +++ b/scripts/comm/invite.js @@ -38,7 +38,8 @@ if ("GET"==rinput.verb) { // set up the invitation screen parameters rinput.setRequestAttribute("invitation.title","Send Community Invitation:"); rinput.setRequestAttribute("invitation.subtitle",comm.name); - rinput.setRequestAttribute("invitation.action",rinput.formatURL("comm/invite.js.vs",LinkTypes.SERVLET)); + html = vlib.queryHTMLRendering(rinput); + rinput.setRequestAttribute("invitation.action",html.formatURL("comm/invite.js.vs",html.SERVLET)); rinput.setRequestAttribute("invitation.params", ""); diff --git a/scripts/comm/photo.js b/scripts/comm/photo.js index 89242b5..0a71e98 100644 --- a/scripts/comm/photo.js +++ b/scripts/comm/photo.js @@ -43,7 +43,8 @@ if ("GET"==rinput.verb) { // create and initialize the PhotoUploader rc = new PhotoUploader("Upload Community Logo","comm/photo.js.vs",LinkTypes.SERVLET); rc.addHiddenParameter("cc",comm.communityID); - rc.photoTag = rinput.getCommunityLogoTag(comm.getContactInfo().photoURL); + html = vlib.queryHTMLRendering(rinput); + rc.photoTag = html.getCommunityLogoTag(comm.getContactInfo().photoURL); rc.label = "New community logo"; } // end try diff --git a/scripts/comm/show.js b/scripts/comm/show.js index 18d2150..69571a1 100644 --- a/scripts/comm/show.js +++ b/scripts/comm/show.js @@ -68,7 +68,8 @@ try rinput.setRequestAttribute("address.country",ce.name); // Save off the community logo tag. - rinput.setRequestAttribute("community.logo",rinput.getCommunityLogoTag(ci.photoURL)); + html = vlib.queryHTMLRendering(rinput); + rinput.setRequestAttribute("community.logo",html.getCommunityLogoTag(ci.photoURL)); // create the view object rc = new JSPView("Community Profile: " + comm.name,"comm/profile.jsp"); diff --git a/scripts/conf/invite_conf.js b/scripts/conf/invite_conf.js index 0c120c0..5d42e67 100644 --- a/scripts/conf/invite_conf.js +++ b/scripts/conf/invite_conf.js @@ -41,7 +41,8 @@ if ("GET"==rinput.verb) { // set up the invitation screen parameters rinput.setRequestAttribute("invitation.title","Send Conference Invitation:"); rinput.setRequestAttribute("invitation.subtitle",conf.name); - rinput.setRequestAttribute("invitation.action",rinput.formatURL("conf/invite_conf.js.vs",LinkTypes.SERVLET)); + html = vlib.queryHTMLRendering(rinput); + rinput.setRequestAttribute("invitation.action",html.formatURL("conf/invite_conf.js.vs",html.SERVLET)); rinput.setRequestAttribute("invitation.params", ""); diff --git a/scripts/conf/invite_topic.js b/scripts/conf/invite_topic.js index 5706eaa..c27e604 100644 --- a/scripts/conf/invite_topic.js +++ b/scripts/conf/invite_topic.js @@ -45,8 +45,8 @@ if ("GET"==rinput.verb) { // set up the invitation screen parameters rinput.setRequestAttribute("invitation.title","Send Topic Invitation:"); rinput.setRequestAttribute("invitation.subtitle",topic.name); - rinput.setRequestAttribute("invitation.action", - rinput.formatURL("conf/invite_topic.js.vs",LinkTypes.SERVLET)); + html = vlib.queryHTMLRendering(rinput); + rinput.setRequestAttribute("invitation.action",html.formatURL("conf/invite_topic.js.vs",html.SERVLET)); rinput.setRequestAttribute("invitation.params", "PrintStream. Also prints the - * backtrace of any "wrapped" exception. - * - * @param s PrintStream to use for output. - */ - public void printStackTrace(PrintStream s) - { - super.printStackTrace(s); - if (inner!=null) - { // print the inner stack trace - s.print("Root cause: "); - inner.printStackTrace(s); - - } // end if - - } // end printStackTrace - - /** - * Prints this exception and its backtrace to the specified PrintWriter. Also prints the - * backtrace of any "wrapped" exception. - * - * @param s PrintWriter to use for output. - */ - public void printStackTrace(PrintWriter s) - { - super.printStackTrace(s); - if (inner!=null) - { // print the inner stack trace - s.print("Root cause: "); - inner.printStackTrace(s); - - } // end if - - } // end printStackTrace - - /*-------------------------------------------------------------------------------- - * External operations - *-------------------------------------------------------------------------------- - */ - - /** - * Returns the exception wrapped by this exception, or null if there is none. - * - * @return See above. - */ - public Throwable getException() - { - return inner; - - } // end getException - } // end class InternalStateError diff --git a/src/com/silverwrist/venice/except/NoSuchServiceException.java b/src/com/silverwrist/venice/except/NoSuchServiceException.java new file mode 100644 index 0000000..09e93b4 --- /dev/null +++ b/src/com/silverwrist/venice/except/NoSuchServiceException.java @@ -0,0 +1,60 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.except; + +/** + * An exception thrown by objects that implement ServiceProvider when they + * don't implement a service of a specified class and ID. + * + * @author Eric J. Bowersox <erbo@silcom.com> + * @version X + * @see com.silverwrist.venice.util.ServiceProvider + */ +public class NoSuchServiceException extends VeniceRuntimeException +{ + /*-------------------------------------------------------------------------------- + * Constructors + *-------------------------------------------------------------------------------- + */ + + /** + * Constructs a new NoSuchServiceException. + * + * @param context Context for the generated exception. + * @param klass Class of the service that was requested. + */ + public NoSuchServiceException(String context, Class klass) + { + super(context + ": no service with class " + klass.getName()); + + } // end constructor + + /** + * Constructs a new NoSuchServiceException. + * + * @param context Context for the generated exception. + * @param klass Class of the service that was requested. + * @param serviceid ID of the service that was requested. + */ + public NoSuchServiceException(String context, Class klass, String serviceid) + { + super(context + ": no service with class " + klass.getName() + " and ID " + serviceid); + + } // end constructor + +} // end class NoSuchServiceException diff --git a/src/com/silverwrist/venice/except/VeniceException.java b/src/com/silverwrist/venice/except/VeniceException.java index 3d96ec5..e78071d 100644 --- a/src/com/silverwrist/venice/except/VeniceException.java +++ b/src/com/silverwrist/venice/except/VeniceException.java @@ -112,12 +112,7 @@ public class VeniceException extends Exception implements SupplyFaultCode public void printStackTrace(PrintStream s) { super.printStackTrace(s); - if (inner!=null) - { // print the inner stack trace - s.print("Root cause: "); - inner.printStackTrace(s); - - } // end if + printRootCause(s,inner); } // end printStackTrace @@ -130,12 +125,7 @@ public class VeniceException extends Exception implements SupplyFaultCode public void printStackTrace(PrintWriter s) { super.printStackTrace(s); - if (inner!=null) - { // print the inner stack trace - s.print("Root cause: "); - inner.printStackTrace(s); - - } // end if + printRootCause(s,inner); } // end printStackTrace @@ -150,6 +140,33 @@ public class VeniceException extends Exception implements SupplyFaultCode } // end getFaultCode + /*-------------------------------------------------------------------------------- + * External static operations + *-------------------------------------------------------------------------------- + */ + + public static void printRootCause(PrintStream s, Throwable t) + { + if (t!=null) + { // print the inner stack trace + s.print("Root cause: "); + t.printStackTrace(s); + + } // end if + + } // end printRootCause + + public static void printRootCause(PrintWriter s, Throwable t) + { + if (t!=null) + { // print the inner stack trace + s.print("Root cause: "); + t.printStackTrace(s); + + } // end if + + } // end printRootCause + /*-------------------------------------------------------------------------------- * External operations *-------------------------------------------------------------------------------- diff --git a/src/com/silverwrist/venice/except/VeniceRuntimeException.java b/src/com/silverwrist/venice/except/VeniceRuntimeException.java new file mode 100644 index 0000000..fb7c462 --- /dev/null +++ b/src/com/silverwrist/venice/except/VeniceRuntimeException.java @@ -0,0 +1,159 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version 1.1 + * (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * + * Contributor(s): + */ +package com.silverwrist.venice.except; + +import java.io.PrintStream; +import java.io.PrintWriter; + +/** + * The root exception of all runtime exceptions thrown by the Venice core code. It is capable of + * "wrapping" another exception within it. + * + * @author Eric J. Bowersox <erbo@silcom.com> + * @version X + */ +public class VeniceRuntimeException extends RuntimeException implements SupplyFaultCode +{ + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private Throwable inner = null; // internal "root cause" exception + + /*-------------------------------------------------------------------------------- + * Constructors + *-------------------------------------------------------------------------------- + */ + + /** + * Constructs a new VeniceRuntimeException. + */ + public VeniceRuntimeException() + { + super(); + + } // end constructor + + /** + * Constructs a new VeniceRuntimeException with a text message. + * + * @param msg The message to set in this exception. + */ + public VeniceRuntimeException(String msg) + { + super(msg); + + } // end constructor + + /** + * Constructs a new VeniceRuntimeException wrapping another exception. + * + * @param inner The exception wrapped by this one. + */ + public VeniceRuntimeException(Throwable inner) + { + super(inner.getMessage()); + this.inner = inner; + + } // end constructor + + /** + * Constructs a new VeniceRuntimeException wrapping another exception. + * + * @param msg The message to set in this exception. + * @param inner The exception wrapped by this one. + */ + public VeniceRuntimeException(String msg, Throwable inner) + { + super(msg); + this.inner = inner; + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Overrides from class Throwable + *-------------------------------------------------------------------------------- + */ + + /** + * Prints this exception and its backtrace to the standard error stream. Also prints the backtrace + * of any "wrapped" exception. + * + * @see java.lang.System#err + */ + public void printStackTrace() + { + this.printStackTrace(System.err); + + } // end printStackTrace + + /** + * Prints this exception and its backtrace to the specified PrintStream. Also prints the + * backtrace of any "wrapped" exception. + * + * @param s PrintStream to use for output. + */ + public void printStackTrace(PrintStream s) + { + super.printStackTrace(s); + VeniceException.printRootCause(s,inner); + + } // end printStackTrace + + /** + * Prints this exception and its backtrace to the specified PrintWriter. Also prints the + * backtrace of any "wrapped" exception. + * + * @param s PrintWriter to use for output. + */ + public void printStackTrace(PrintWriter s) + { + super.printStackTrace(s); + VeniceException.printRootCause(s,inner); + + } // end printStackTrace + + /*-------------------------------------------------------------------------------- + * Implementations from interface SupplyFaultCode + *-------------------------------------------------------------------------------- + */ + + public int getFaultCode() + { + return 0; + + } // end getFaultCode + + /*-------------------------------------------------------------------------------- + * External operations + *-------------------------------------------------------------------------------- + */ + + /** + * Returns the exception wrapped by this exception, or null if there is none. + * + * @return See above. + */ + public Throwable getException() + { + return inner; + + } // end getException + +} // end class VeniceException diff --git a/src/com/silverwrist/venice/ui/RequestInput.java b/src/com/silverwrist/venice/ui/RequestInput.java index daa8c46..7af525f 100644 --- a/src/com/silverwrist/venice/ui/RequestInput.java +++ b/src/com/silverwrist/venice/ui/RequestInput.java @@ -17,10 +17,8 @@ */ package com.silverwrist.venice.ui; -import java.awt.Dimension; import java.io.InputStream; import java.io.IOException; -import java.util.Date; import java.util.Enumeration; import java.util.Map; import org.w3c.dom.Document; @@ -33,163 +31,333 @@ import com.silverwrist.venice.ui.dlg.Dialog; import com.silverwrist.venice.ui.helpers.ErrorBox; import com.silverwrist.venice.ui.menus.MenuComponent; import com.silverwrist.venice.ui.script.ScriptManager; +import com.silverwrist.venice.util.ServiceProvider; -public interface RequestInput extends LinkTypes +public interface RequestInput extends ServiceProvider { - public static final String LOGIN_COOKIE = "VeniceAuth"; - public static final int LOGIN_COOKIE_AGE = 60*60*24*365; // one year public static final String LEFT_MENU_SESSION_ATTR = "LeftMenu"; + /** + * Returns a String containing the real path for a given virtual path. For example, + * the virtual path "/index.html" has a real path of whatever file on the server's filesystem + * would be served by a request for "/index.html".

+ * This method returns null if the virtual path cannot be translated to a real path for + * any reason. + * + * @param s A String specifying a virtual path. + * @return A String specifying the real path, or null if the translation cannot + * be performed. + */ public abstract String mapPath(String s); + /** + * Returns the portion of the request URI that indicates the context of the request, i.e. the servlet + * context under which Venice is installed. The context path always comes first in a request URI. The + * path starts with a "/" character but does not end with a "/" character. + * + * @return A String specifying the portion of the request URI that indicates the context + * of the request. + */ public abstract String getContextPath(); + /** + * Returns the part of this request's URI that calls the servlet. This includes either the servlet name + * or a path to the servlet, but does not include any extra path information or a query string. + * + * @return A String containing the name or path of the servlet being called, as specified + * in the request URI. + */ public abstract String getServletPath(); + /** + * Returns any extra path information associated with the URI the client sent when it made this request. + * The extra path information follows the servlet path but precedes the query string. This method + * returns null if there was no extra path information. In Venice, the path information is + * used to specify parameters in certain servlets. + * + * @return A String specifying extra path information that comes after the servlet path + * but before the query string in the request URI; or null if the URI does not + * have any extra path information. + */ public abstract String getPathInfo(); + /** + * Returns the query string that is contained in the request URI after the path. This method returns + * null if the URI does not have a query string. + * + * @return A String containing the query string or null if the URI contains + * no query string. + */ public abstract String getQueryString(); + /** + * Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT. + * + * @return A String specifying the name of the method with which this request was made. + */ public abstract String getVerb(); + /** + * Returns the Internet Protocol (IP) address of the client that sent the request. + * + * @return A String containing the IP address of the client that sent the request. + */ public abstract String getSourceAddress(); - public abstract void endSession(); - + /** + * Returns true if the request parameter with the specified name is defined, + * false if not. For standard Venice requests, parameters are contained in the + * query string or posted form data. + * + * @param name Parameter name to be checked. + * @return See above. + */ public abstract boolean hasParameter(String name); + /** + * Returns the value of a request parameter as a String, or null if the + * parameter does not exist. For standard Venice requests, parameters are contained in the query + * string or posted form data.

+ * You should only use this method when you are sure the parameter has only one value. If the parameter + * might have more than one value, use {@link #getParameterValues(java.lang.String)}.

+ * If you use this method with a multivalued parameter, the value returned is equal to the first value + * in the array returned by getParameterValues. + * + * @param name A String specifying the name of the parameter. + * @return A String representing the single value of the parameter. + * @see #getParameterValues(java.lang.String) + */ public abstract String getParameter(String name); + /** + * Returns the value of a request parameter as a int, or a specified default value if + * the parameter does not exist. For standard Venice requests, parameters are contained in the query + * string or posted form data.

+ * If you use this method with a multivalued parameter, the value returned is equal to the + * int equivalent of the first value in the array returned by getParameterValues. + * + * @param name A String specifying the name of the parameter. + * @param default_value The default value to use for the parameter if the specified parameter does not exist. + * @return An int representing the single value of the parameter. + */ public abstract int getParameterInt(String name, int default_value); + /** + * Returns the value of a request parameter as a short, or a specified default value if + * the parameter does not exist. For standard Venice requests, parameters are contained in the query + * string or posted form data.

+ * If you use this method with a multivalued parameter, the value returned is equal to the + * short equivalent of the first value in the array returned by getParameterValues. + * + * @param name A String specifying the name of the parameter. + * @param default_value The default value to use for the parameter if the specified parameter does not exist. + * @return A short representing the single value of the parameter. + */ public abstract short getParameterShort(String name, short default_value); + /** + * Returns the value of a request parameter as a long, or a specified default value if + * the parameter does not exist. For standard Venice requests, parameters are contained in the query + * string or posted form data.

+ * If you use this method with a multivalued parameter, the value returned is equal to the + * long equivalent of the first value in the array returned by getParameterValues. + * + * @param name A String specifying the name of the parameter. + * @param default_value The default value to use for the parameter if the specified parameter does not exist. + * @return A long representing the single value of the parameter. + */ public abstract long getParameterLong(String name, long default_value); + /** + * Returns an Enumeration of String objects containing the names of the + * parameters contained in this request. If the request has no parameters, the method returns an empty + * Enumeration. + * + * @return An Enumeration of String objects, each String + * containing the name of a request parameter, or an empty Enumeration if the + * request has no parameters. + */ public abstract Enumeration getParameterNames(); + /** + * Returns an array of String objects containing all of the values the given request + * parameter has, or null if the parameter does not exist.

+ * If the parameter has a single value, the array has a length of 1. + * + * @param name A String containing the name of the parameter whose value is requested. + * @return An array of String objects containing the parameter's values. + * @see #getParameter(java.lang.String) + */ public abstract String[] getParameterValues(String name); + /** + * Returns true if the specified parameter is a file parameter, false if + * not. If the parameter does not exist, the return value is false. + * + * @param name A String containing the name of the parameter to test. + * @return See above. + */ public abstract boolean isFileParam(String name); + /** + * Returns the MIME type of the specified parameter. If the type cannot be determined, the return + * value is null.

+ * N.B.: For non-file parameters, or all parameters to a request that is not a file upload, the MIME + * type is "text/plain". + * + * @param name A String containing the name of the parameter to test. + * @return See above. + */ public abstract String getParameterType(String name); + /** + * Returns the size in bytes of the specified parameter. If the size cannot be determined, the return + * value is -1.

+ * N.B.: For non-file parameters, or all parameters to a request that is not a file upload, the size + * is the number of bytes occupied by the parameter, expressed in UTF-8 encoding. + * + * @param name A String containing the name of the parameter to test. + * @return See above. + */ public abstract int getParameterSize(String name); + /** + * Returns an InputStream reading from the data of the named file parameter. If the + * named parameter does not exist or is not a file parameter, returns null; + * + * @param name A String containing the name of the parameter whose value is requested. + * @return See above. + * @exception com.silverwrist.util.ServletMultipartException If there is a problem retrieving + * the parameter data stream. + */ public abstract InputStream getParameterDataStream(String name) throws ServletMultipartException; - public abstract Document getRequestDocument(); - - public abstract boolean sessionBound(); - + /** + * Returns true if the parameter set reflects the clicking of an image button with a + * specified name, false if not. + * + * @param name A String containing the name of the image button to test. + * @return See above. + */ public abstract boolean isImageButtonClicked(String name); + /** + * Returns the application-level attribute with the given name, or null if there is no + * attribute by that name. + * + * @param name A String specifying the name of the attribute. + * @return An Object containing the value of the attribute, or null if no + * attribute exists matching the given name. + */ public abstract Object getAppAttribute(String name); + /** + * Sets the application-level attribute with the given name. + * + * @param name A String specifying the name of the attribute. + * @param o The object to be bound as the value of that attribute, or null if the binding + * is to be removed. + */ public abstract void setAppAttribute(String name, Object o); + /** + * Returns the session-level attribute with the given name, or null if there is no + * attribute by that name. + * + * @param name A String specifying the name of the attribute. + * @return An Object containing the value of the attribute, or null if no + * attribute exists matching the given name. + */ public abstract Object getSessionAttribute(String name); + /** + * Sets the session-level attribute with the given name. + * + * @param name A String specifying the name of the attribute. + * @param o The object to be bound as the value of that attribute, or null if the binding + * is to be removed. + */ public abstract void setSessionAttribute(String name, Object o); + /** + * Returns the request-level attribute with the given name, or null if there is no + * attribute by that name. + * + * @param name A String specifying the name of the attribute. + * @return An Object containing the value of the attribute, or null if no + * attribute exists matching the given name. + */ public abstract Object getRequestAttribute(String name); + /** + * Sets the request-level attribute with the given name. + * + * @param name A String specifying the name of the attribute. + * @param o The object to be bound as the value of that attribute, or null if the binding + * is to be removed. + */ public abstract void setRequestAttribute(String name, Object o); - public abstract void savePersistentCookie(String name, String value, int max_age); - - public abstract void saveTemporaryCookie(String name, String value); - - public abstract void deleteCookie(String name); - + /** + * Returns the instance of the Venice engine associated with the application. + * + * @return See above. + */ public abstract VeniceEngine getEngine(); + /** + * Returns the instance of the Venice user object associated with the session. + * + * @return See above. + */ public abstract UserContext getUser(); - public abstract void replaceUser(UserContext new_user); - - public abstract ScriptManager getScriptManager(); - - public abstract String getStyleSheetData() throws IOException; - - public abstract String getColor(int selector); - - public abstract String getColor(String name); - - public abstract boolean useHTMLComments(); - - public abstract String formatURL(String url, int type); - - public abstract String formatDate(Date date); - - public abstract String getFontTag(int colorsel, int size); - - public abstract String getFontTag(String color, int size); - - public abstract String getFontTag(int colorsel, String size); - - public abstract String getFontTag(String color, String size); - - public abstract int convertLinkType(String str); - + /** + * Returns the current servlet location. This is used, for instance, as the context to return to + * after a login. + * + * @return The current servlet location. + */ public abstract String getLocation(); + /** + * Sets the "current" servlet location that is displayed. This is used, for instance, + * as the context to return to after a login. + * + * @param str The new location to be set. + */ public abstract void setLocation(String str); + /** + * Returns true if the "Log In" link is to be displayed on the outer frame, + * false if not. + * + * @return See above. + */ public abstract boolean getDisplayLogin(); + /** + * Sets whether or not the "Log In" link is to be displayed on the outer frame. + * + * @param val true to display the "Log In" link on the outer frame, + * false to omit it. + */ public abstract void setDisplayLogin(boolean val); - public abstract String getStockMessage(String key); - - public abstract String getStockMessage(String key, Map vars); - - public abstract String getStaticPath(String s); - - public abstract String getExternalStaticPath(String s); - - public abstract String getImagePath(String s); - public abstract MenuComponent getMenu(String name); public abstract MenuComponent getMenu(String name, Map vars); - public abstract String getScriptName(String raw_name); - - public abstract String getScriptName(boolean strip_ext); - - public abstract String getScriptLoggerName(String raw_name); - - public abstract String getScriptLoggerName(); - - public abstract String getRPCScriptName(String raw_name); - - public abstract String getRPCScriptLoggerName(String raw_name); - public abstract Dialog getDialog(String name); public abstract Content[] getSideBoxes() throws AccessError, DataException; - public abstract String getUserPhotoTag(String url); - - public abstract String getUserPhotoTag(String url, Dimension size); - public abstract CommunityContext getCommunity(); public abstract CommunityContext getCommunity(boolean required, String on_error) throws ErrorBox; - public abstract String getActivityString(Date date); - public abstract String getDefaultServletAddress(CommunityContext comm); - public abstract String getCommunityLogoTag(String url); - - public abstract String expandServletPath(String spath); - public abstract void registerCleanup(AutoCleanup ac); - public abstract void pushSession(VeniceUISession sess); - - public abstract void popSession(); - } // end interface RequestInput diff --git a/src/com/silverwrist/venice/ui/RequestOutput.java b/src/com/silverwrist/venice/ui/RequestOutput.java index ee2a1ad..afd1924 100644 --- a/src/com/silverwrist/venice/ui/RequestOutput.java +++ b/src/com/silverwrist/venice/ui/RequestOutput.java @@ -11,20 +11,18 @@ * * The Initial Developer of the Original Code is Eric J. Bowersox , * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. * * Contributor(s): */ package com.silverwrist.venice.ui; -import java.awt.Dimension; import java.io.IOException; import java.io.Writer; -import java.util.Date; -import java.util.Map; import javax.servlet.ServletException; +import com.silverwrist.venice.util.ServiceProvider; -public interface RequestOutput extends LinkTypes +public interface RequestOutput extends ServiceProvider, LinkTypes { public abstract Writer getWriter() throws IOException; @@ -54,42 +52,4 @@ public interface RequestOutput extends LinkTypes public abstract void writeContentHeader(String primary, String secondary) throws IOException; - public abstract String formatURL(String url, int type); - - public abstract String formatDate(Date date); - - public abstract String getColor(int selector); - - public abstract String getColor(String name); - - public abstract String getFontTag(int colorsel, int size); - - public abstract String getFontTag(String color, int size); - - public abstract String getFontTag(int colorsel, String size); - - public abstract String getFontTag(String color, String size); - - public abstract String getStockMessage(String key); - - public abstract String getStockMessage(String key, Map vars); - - public abstract String getStaticPath(String s); - - public abstract String getExternalStaticPath(String s); - - public abstract String getImagePath(String s); - - public abstract String getButtonVisual(String id); - - public abstract String getButtonInput(String id); - - public abstract String getUserPhotoTag(String url); - - public abstract String getUserPhotoTag(String url, Dimension size); - - public abstract String getActivityString(Date date); - - public abstract String getCommunityLogoTag(String url); - } // end interface RequestOutput diff --git a/src/com/silverwrist/venice/ui/conf/jsp/PostBoxTag.java b/src/com/silverwrist/venice/ui/conf/jsp/PostBoxTag.java index cdf53c4..31c00cb 100644 --- a/src/com/silverwrist/venice/ui/conf/jsp/PostBoxTag.java +++ b/src/com/silverwrist/venice/ui/conf/jsp/PostBoxTag.java @@ -11,7 +11,7 @@ * * The Initial Developer of the Original Code is Eric J. Bowersox , * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. * * Contributor(s): */ @@ -22,8 +22,9 @@ import java.util.*; import javax.servlet.jsp.*; import javax.servlet.jsp.tagext.*; import com.silverwrist.venice.ui.*; +import com.silverwrist.venice.ui.helpers.HTMLRendering; -public class PostBoxTag extends VeniceConfBodyTagSupport implements ColorSelectors +public class PostBoxTag extends VeniceConfBodyTagSupport { /*-------------------------------------------------------------------------------- * Attributes @@ -53,7 +54,8 @@ public class PostBoxTag extends VeniceConfBodyTagSupport implements ColorSelecto { if (action==null) throw new JspTagException(" action= attribute not specified!"); - real_type = getRequestInput().convertLinkType(type); + HTMLRendering html = (HTMLRendering)(getRequestInput().queryService(HTMLRendering.class)); + real_type = html.convertLinkType(type); if (real_type<0) throw new JspTagException(" type= attribute not a valid link type"); return EVAL_BODY_TAG; @@ -76,11 +78,13 @@ public class PostBoxTag extends VeniceConfBodyTagSupport implements ColorSelecto throw new JspTagException(" tag has no tag inside it!"); if (buttons.isEmpty()) throw new JspTagException(" tag has no tags inside it!"); - RequestOutput ro = getRequestOutput(); + + HTMLRendering html = (HTMLRendering)(getRequestOutput().queryService(HTMLRendering.class)); + try { // write out what we came here to accomplish JspWriter out = pageContext.getOut(); - out.write("

\n"); Iterator it = params.entrySet().iterator(); while (it.hasNext()) @@ -91,7 +95,7 @@ public class PostBoxTag extends VeniceConfBodyTagSupport implements ColorSelecto } // end while - String my_font = ro.getFontTag(CONTENT_FOREGROUND,"content"); + String my_font = html.getFontTag(html.CONTENT_FOREGROUND,"content"); out.write("\n"); if (newtopic_name!=null) { // write the "new topic name" field @@ -117,7 +121,7 @@ public class PostBoxTag extends VeniceConfBodyTagSupport implements ColorSelecto out.write(" CHECKED"); out.write("> Attach a file\n\n\n\n\n\n" + "
\n" + my_font + "Message:\n" + my_font - + "\nHTML Guide\n
\n