Execution.java

Index Score
org.zkoss.zk.ui
ZK

View: Reasons, Metrics, Source Code

These are the metrics that contribute to the Enerjy Score for this file, ranked by impact. So the metrics listed at the top influence the score to a greater extent that the metrics listed at the bottom.

MetricDescription
DOC_COMMENTNumber of javadoc comment lines
COMMENTSComment lines
DECL_COMMENTSComments in declarations
JAVA0110JAVA0110 Incorrect javadoc: no @return tag
JAVA0108JAVA0108 Incorrect javadoc: no @param tag for 'parameter'
PARAMSNumber of formal parameter declarations
FUNCTIONSNumber of function declarations
JAVA0141JAVA0141 Unnecessary modifier for method in interface
SIZESize of the file in bytes
LINESNumber of lines in the source file
JAVA0115JAVA0115 Incorrect javadoc: no @throws or @exception tag for 'exception'
JAVA0034JAVA0034 Missing braces in if statement
INTERFACE_COMPLEXITYInterface complexity
CYCLOMATICCyclomatic complexity
JAVA0117JAVA0117 Missing javadoc: method 'method'
COMMENT_DENSITYComment density
PROGRAM_VOLUMEHalstead program volume
JAVA0136JAVA0136 N methods defined in class (maximum: M)
UNIQUE_OPERANDSNumber of unique operands
EXEC_COMMENTSComments in executable code
JAVA0126JAVA0126 Method declares unchecked exception in throws
LINE_COMMENTNumber of line comments
COMPARISONSNumber of comparison operators
BLOCKSNumber of blocks
RETURNSNumber of return points from functions
LOCLines of code
LOOPSNumber of loops
EXITSProcedure exits
WHITESPACENumber of whitespace lines
OPERATORSNumber of operators
ELOCEffective lines of code
PROGRAM_VOCABHalstead program vocabulary
PROGRAM_LENGTHHalstead program length
/* Execution.java {{IS_NOTE Purpose: Description: History: Fri Jun 3 17:55:01 2005, Created by tomyeh }}IS_NOTE Copyright (C) 2005 Potix Corporation. All Rights Reserved. {{IS_RIGHT This program is distributed under GPL Version 2.0 in the hope that it will be useful, but WITHOUT ANY WARRANTY. }}IS_RIGHT */ package org.zkoss.zk.ui; import java.util.Iterator; import java.util.Map; import java.io.Reader; import java.io.Writer; import java.io.IOException; import java.security.Principal; import org.zkoss.xel.VariableResolver; import org.zkoss.idom.Document; import org.zkoss.web.servlet.Servlets; import org.zkoss.web.servlet.http.Encodes; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.metainfo.PageDefinition; import org.zkoss.zk.ui.metainfo.LanguageDefinition; import org.zkoss.zk.xel.Evaluator; import org.zkoss.zk.au.AuResponse; /** * An execution of a client request (e.g., ServletRequest). * When a request sent from a client, the server constructs * a {@link Execution} * object to hold execution relevant info, and then serves the request * thru this execution. * * <p>A client request, e.g., HttpServletRequest, might consist of * multiple ZK request ({@link org.zkoss.zk.au.AuRequest}). * However, these ZK requests * must target the same desktop of pages ({@link Page}). * * <p>Because a request might come from HTTP or other protocol, Execution * also serves as an isolation layer. * * @author tomyeh * @see Page */ public interface Execution { /** Returns the desktop for this execution. * Each execution is against exactly one desktop. */ public Desktop getDesktop(); /** Returns whether this execution is asynchronous updating the * specified page (thru ZK Update Engine). * * @return whether the specified page is being asynchronous updated * by this execution. * If the specified page is null, this method returns * whether this execution is asynchronous updating a page * (rather than creating/loading a new page). * Each execution remembers the page being creating. * All other pages are consided as being asynchronous updated. */ public boolean isAsyncUpdate(Page page); /** Returns an array of String objects containing all of the values * the given request parameter has, or null if the parameter does not exist. */ public String[] getParameterValues(String name); /** Returns the value of a request parameter as a String, * or null if the parameter does not exist */ public String getParameter(String name); /** Returns a Map of the parameters of this request. * Request parameters are extra information sent with the request. */ public Map getParameterMap(); /** Returns the evaluator (never null). * It is usually used to parse the expression into {@link org.zkoss.xel.Expression} * or used with {@link org.zkoss.zk.xel.ExValue}. * for performance improvement. * * @param page the page that this evaluator is associated. * If null, the current page and then the first page is assumed. * @param expfcls the implementation of {@link org.zkoss.xel.ExpressionFactory}, * or null to use the default ({@link org.zkoss.zk.ui.util.Configuration#getExpressionFactoryClass}. * @since 3.0.0 */ public Evaluator getEvaluator(Page page, Class expfcls); /** Returns the evaluator of the current execution. * It is a shortcut of getEvaluator(comp != null ? comp.getPage(): null) * * @param comp the component to retrieve the page for the evaluator * @param expfcls the implementation of {@link org.zkoss.xel.ExpressionFactory}, * or null to use the default ({@link org.zkoss.zk.ui.util.Configuration#getExpressionFactoryClass}. * @since 3.0.0 */ public Evaluator getEvaluator(Component comp, Class expfcls); /** Evluates the specified expression with ${link #getVariableResolver} * and {@link Page#getFunctionMapper} of the page of the specified * component. * * <p>The function mapper is retrieved from component's page's function * mapper ({@link Page#getFunctionMapper}). * If null, the current page, if any, is used to retrieve * the mapper. * * <p>For better performance, you can use the instance returned by *{@link #getEvaluator} to parse and cached the parsed expression. * {@link org.zkoss.zk.xel.ExValue} is a utility class to simply * the task. * * @param comp used as the self variable and to retrieve the function * mapper. Ignored if null. * @see #getVariableResolver * @see #getEvaluator */ public Object evaluate(Component comp, String expr, Class expectedType); /** Evluates the specified expression with ${link #getVariableResolver} * and {@link Page#getFunctionMapper} of the specified * page. * * <p>The function mapper is retrieved from component's page's function * mapper ({@link Page#getFunctionMapper}). * If null, the current page, if any, is used to retrieve * the mapper. * * <p>For better performance, you can use the instance returned by *{@link #getEvaluator} to parse and cached the parsed expression. * {@link org.zkoss.zk.xel.ExValue} is a utility class to simply * the task. * * @param page used as the self variable and to retrieve the function * mapper. Ignored if null. * @see #getVariableResolver * @see #getEvaluator */ public Object evaluate(Page page, String expr, Class expectedType); /** Returns the variable resolver for this execution, or null if not * available. * * <p>Note: the resolver is similar to PageContext's if this execution * is caused by a HTTP request. * @see #evaluate(Component,String,Class) */ public VariableResolver getVariableResolver(); /** Queues an event to this execution. * In other words, the event is placed to the event queue. * * <p>The priority of the event is assumed to be 0. Refer to * {@link #postEvent(int, Event)}. */ public void postEvent(Event evt); /** Queues an event with the specified priority to this execution. * In other words, the event is placed to the event queue * with the specified prority. * * <p>The posted events are processed from the higher priority to the * lower one. If two events are posted with the same priority, * the earlier the event being posted is processed earlier * (first-in-first-out). * * <p>The priority posted by posted by {@link #postEvent(Event)} is * 0. * Applications shall not use the priority higher than 10,000 and * lower than -10,000 since they are reserved for component * development. * * @param priority the priority of the event. * @since 3.0.7 */ public void postEvent(int priority, Event evt); /** Whether to overwrite uri if both uri and params contain the same * parameter. */ public static final int OVERWRITE_URI = Servlets.OVERWRITE_URI; /** Whether to ignore params if both uri and params contain the same * parameter. */ public static final int IGNORE_PARAM = Servlets.IGNORE_PARAM; /** Whether to append params if both uri and params contain the same * parameter. In other words, they both appear as the final query string. */ public static final int APPEND_PARAM = Servlets.APPEND_PARAM; /** Whether the specified parameters shall be passed thru the request's * attribute called arg. */ public static final int PASS_THRU_ATTR = Servlets.PASS_THRU_ATTR; /** Includes a page. * * @param writer the output to write. If null, the response's default * writer is used. * @param page the page's uri; null to denote the same request * @param mode one of {@link #OVERWRITE_URI}, {@link #IGNORE_PARAM}, * {@link #APPEND_PARAM} and {@link #PASS_THRU_ATTR}. * It defines how to handle if both uri and params contains * the same parameter. * mode is used only if both uri contains query string and params is * not empty. */ public void include(Writer writer, String page, Map params, int mode) throws IOException; /** A shortcut of include(null, page, null, 0). */ public void include(String page) throws IOException; /** Forwards to another page. * * <p>Note: this method can be called only when loading a page. * Use {@link #sendRedirect(String)} instead if you want to change * to another desktop when processing a request from the client. * * @param writer the output to write. If null, the response's default * writer is used. * @param page the page's uri; null to denote the same request * @param mode one of {@link #OVERWRITE_URI}, {@link #IGNORE_PARAM}, * {@link #APPEND_PARAM} and {@link #PASS_THRU_ATTR}. * It defines how to handle if both uri and params contains * the same parameter. * mode is used only if both uri contains query string and params is * not empty. */ public void forward(Writer writer, String page, Map params, int mode) throws IOException; /** A shortcut of forward(null, page, null, 0). */ public void forward(String page) throws IOException; /** Returns whether the execution is voided. * By void we mean the request is taken charged by other servlet. * The execution shall not do anything more. In other words, * the execution is avoided and won't generate any ouput. * * <p>The common cause of being voided is the invocation of * {@link #forward}. * * @since 2.4.0 */ public boolean isVoided(); /** Sets whether the execution is voided. * By void we mean the request is taken charged by other servlet. * * <p>If you invoke {@link #forward}, this method is called automatically * with true. Thus, you rarely need to invoke this method, unless * you forward to other servlet by use javax.servlet.RequestDispatcher * directly. * * @since 2.4.1 */ public void setVoided(boolean voided); /** Returns whether this execution is included by some other pages. */ public boolean isIncluded(); /** Returns whether the execution is forwarded from other pages. * @since 2.4.0 */ public boolean isForwarded(); /** Converts the specified URI to an absolute URI, if uri is related * and the current execution is not included ({@link #isIncluded}). * * <p>Note: an asynchrous update is processed by the update servlet. * It is different from the servlet for rendering the ZUML page. * In other words, a relative URI won't be interpreted correctly, * so you have to invoke this method to convert them if necessary. * * <p>In addtions, RequestDispatcher.include doesn't handle related URI * well. * * @param skipInclude whether not to convert to an absolute URI if * the current page is included by another page. * If you are not sure, you might specify false. */ public String toAbsoluteURI(String uri, boolean skipInclude); /** Encodes an URL. * * <p>It resolves "*" contained in URI, if any, to the proper Locale, * and the browser code. * Refer to {@link Servlets#locate(ServletContext, ServletRequest, String, Locator)} * for details. */ public String encodeURL(String uri); /** Returns a java.security.Principal object containing the name of the * current authenticated user. * If the user has not been authenticated, the method returns null. */ public Principal getUserPrincipal(); /** Returns a boolean indicating whether the authenticated user is * included in the specified logical "role". Roles and role membership * can be defined using deployment descriptors. * If the user has not been authenticated, the method returns false. * * @param role a String specifying the name of the role */ public boolean isUserInRole(String role); /** Returns the login of the user making this request, if the user has * been authenticated, or null if the user has not been authenticated. * Whether the user name is sent with each subsequent request depends on * the browser and type of authentication. */ public String getRemoteUser(); /** Returns the fully qualified name of the client or the last proxy * that sent the request. * If the engine cannot or chooses not to resolve the hostname * (to improve performance), this method returns the dotted-string form of * the IP address. */ public String getRemoteHost(); /** @deprecated As of release 3.0.1, replaced by {@link #getRemoteHost}. */ public String getRemoteName(); /** Returns the Internet Protocol (IP) address of the client or last * proxy that sent the request. */ public String getRemoteAddr(); /** Returns the host name of the server to which the request was sent. * It is the value of the part before ":" in the Host header value, if any, * or the resolved server name, or the server IP address. * * @see #getLocalName */ public String getServerName(); /** Returns the port number to which the request was sent. * It is the value of the part after ":" in the Host header value, if any, * or the server port where the client connection was accepted on. * * @see #getLocalPort */ public int getServerPort(); /** Returns the host name of the Internet Protocol (IP) interface * on which the request was received. * * <p>Note: it is the host name defined in the server. To retrieve the name * in URL, use {@link #getServerName}. * * @see #getServerName */ public String getLocalName(); /** Returns the Internet Protocol (IP) address of the interface on which * the request was received. */ public String getLocalAddr(); /** Returns the Internet Protocol (IP) port number of the interface on which * the request was received. * * @see #getServerPort */ public int getLocalPort(); /** Returns the name of the scheme used to make this request, * for example, http, https, or ftp. * Different schemes have different rules for constructing URLs, * as noted in RFC 1738. * @since 3.5.0 */ public String getScheme(); /** Returns the portion of the request URI that indicates the context of * the current execution. The path starts with a "/" character but does not end with * a "/" character. For servlets in the default (root) context, * this method returns "". * * <p>If the client is not using HTTP to access, this method return ""; * * @see Page#getRequestPath */ public String getContextPath(); //-- page utilities --// /** Returns the page definition from the page file specified by an URI. * * <p>Implemetation Notes: this method must invoke * {@link org.zkoss.zk.ui.sys.UiFactory#getPageDefinition(org.zkoss.zk.ui.sys.RequestInfo, String)} * * @param uri the URI of the page file. * * @see #getPageDefinitionDirectly(String, String) * @see #getPageDefinitionDirectly(Document, String) * @see #getPageDefinitionDirectly(Reader, String) */ public PageDefinition getPageDefinition(String uri); /** Converts the specified page content to a page definition. * * <p>Implemetation Notes: this method must invoke * {@link org.zkoss.zk.ui.sys.UiFactory#getPageDefinitionDirectly(org.zkoss.zk.ui.sys.RequestInfo, String, String)} * * @param content the raw content of the page. It must be in ZUML. * @param extension the default extension if the content doesn't specify * an language. In other words, if * the content doesn't specify an language, {@link LanguageDefinition#getByExtension} * is called. * If extension is null and the content doesn't specify a language, * the language called "xul/html" is assumed. * @see #getPageDefinitionDirectly(Document, String) * @see #getPageDefinitionDirectly(Reader, String) * @see #getPageDefinition */ public PageDefinition getPageDefinitionDirectly(String content, String extension); /** Converts the specified page content, in DOM, to a page definition. * * @param content the raw content of the page in DOM. * @param extension the default extension if the content doesn't specify * an language. In other words, if * the content doesn't specify an language, {@link LanguageDefinition#getByExtension} * is called. * If extension is null and the content doesn't specify a language, * the language called "xul/html" is assumed. * @see #getPageDefinitionDirectly(String, String) * @see #getPageDefinitionDirectly(Reader, String) * @see #getPageDefinition */ public PageDefinition getPageDefinitionDirectly(Document content, String extension); /** Reads the raw content from a reader and converts it into * a page definition. * * @param reader used to input the raw content of the page. It must be in ZUML. * @param extension the default extension if the content doesn't specify * an language. In other words, if * the content doesn't specify an language, {@link LanguageDefinition#getByExtension} * is called. * If extension is null and the content doesn't specify a language, * the language called "xul/html" is assumed. * @see #getPageDefinitionDirectly(String, String) * @see #getPageDefinitionDirectly(Document, String) * @see #getPageDefinition */ public PageDefinition getPageDefinitionDirectly(Reader reader, String extension) throws IOException; /** Creates components from the specified page definition. * The created components become the child of the specified parent, * or become the root components of the current page if parent is specified * as null. * * @param pagedef the page definition to use. It cannot be null. * @param parent the parent component, or null if you want it to be * a root component. If parent is null, the page is assumed to be * the current page, which is determined by the execution context. * @param arg a map of parameters that is accessible by the arg variable * in EL, or by {@link Execution#getArg}. * Ignored if null. * @return the first component being created. * @see #createComponents(String, Component, Map) */ public Component createComponents(PageDefinition pagedef, Component parent, Map arg); /** Creates components from a page file specified by an URI. * The created components become the child of the specified parent, * or become the root components of the current page if parent is specified * as null. * * <p>It loads the page definition from the specified URI (by * use {@link #getPageDefinition} ), and then * invokes {@link #createComponents(PageDefinition,Component,Map)} * to create components. * * @param parent the parent component, or null if you want it to be * a root component. If parent is null, the page is assumed to be * the current page, which is determined by the execution context. * @param arg a map of parameters that is accessible by the arg variable * in EL, or by {@link Execution#getArg}. * Ignored if null. * @see #createComponents(PageDefinition, Component, Map) * @see #createComponentsDirectly(String, String, Component, Map) * @see #createComponentsDirectly(Document, String, Component, Map) * @see #createComponentsDirectly(Reader, String, Component, Map) */ public Component createComponents(String uri, Component parent, Map arg); /** Creates components from the raw content specified by a string. * The created components become the child of the specified parent, * or become the root components of the current page if parent is specified * as null. * * <p>The raw content is parsed to a page defintion by use of * {@link #getPageDefinitionDirectly(String, String)}, and then * invokes {@link #createComponents(PageDefinition,Component,Map)} * to create components. * * @param content the raw content of the page. It must be in ZUML. * @param extension the default extension if the content doesn't specify * an language. In other words, if * the content doesn't specify an language, {@link LanguageDefinition#getByExtension} * is called. * If extension is null and the content doesn't specify a language, * the language called "xul/html" is assumed. * @param parent the parent component, or null if you want it to be * a root component. If parent is null, the page is assumed to be * the current page, which is determined by the execution context. * @param arg a map of parameters that is accessible by the arg variable * in EL, or by {@link Execution#getArg}. * Ignored if null. * @see #createComponents(PageDefinition, Component, Map) * @see #createComponents(String, Component, Map) * @see #createComponentsDirectly(Document, String, Component, Map) * @see #createComponentsDirectly(Reader, String, Component, Map) */ public Component createComponentsDirectly(String content, String extension, Component parent, Map arg); /** Creates components from the raw content specified by a DOM tree. * The created components become the child of the specified parent, * or become the root components of the current page if parent is specified * as null. * * <p>The raw content is parsed to a page defintion by use of * {@link #getPageDefinitionDirectly(Document, String)}, and then * invokes {@link #createComponents(PageDefinition,Component,Map)} * to create components. * * @param content the raw content in DOM. * @param extension the default extension if the content doesn't specify * an language. In other words, if * the content doesn't specify an language, {@link LanguageDefinition#getByExtension} * is called. * If extension is null and the content doesn't specify a language, * the language called "xul/html" is assumed. * @param parent the parent component, or null if you want it to be * a root component. If parent is null, the page is assumed to be * the current page, which is determined by the execution context. * @param arg a map of parameters that is accessible by the arg variable * in EL, or by {@link Execution#getArg}. * Ignored if null. * @see #createComponents(PageDefinition, Component, Map) * @see #createComponents(String, Component, Map) * @see #createComponentsDirectly(Document, String, Component, Map) * @see #createComponentsDirectly(Reader, String, Component, Map) */ public Component createComponentsDirectly(Document content, String extension, Component parent, Map arg); /** Creates components from the raw content read from the specified reader. * The created components become the child of the specified parent, * or become the root components of the current page if parent is specified * as null. * * <p>The raw content is loaded and parsed to a page defintion by use of * {@link #getPageDefinitionDirectly(Reader,String)}, and then * invokes {@link #createComponents(PageDefinition,Component,Map)} * to create components. * * @param reader the reader to retrieve the raw content in ZUML. * @param extension the default extension if the content doesn't specify * an language. In other words, if * the content doesn't specify an language, {@link LanguageDefinition#getByExtension} * is called. * If extension is null and the content doesn't specify a language, * the language called "xul/html" is assumed. * @param parent the parent component, or null if you want it to be * a root component. If parent is null, the page is assumed to be * the current page, which is determined by the execution context. * @param arg a map of parameters that is accessible by the arg variable * in EL, or by {@link Execution#getArg}. * Ignored if null. * @see #createComponents(PageDefinition, Component, Map) * @see #createComponents(String, Component, Map) * @see #createComponentsDirectly(Document, String, Component, Map) * @see #createComponentsDirectly(String, String, Component, Map) */ public Component createComponentsDirectly(Reader reader, String extension, Component parent, Map arg) throws IOException; /** Creates components that don't belong to any page * from the specified page definition. * * @param pagedef the page definition to use. It cannot be null. * @param arg a map of parameters that is accessible by the arg variable * in EL, or by {@link Execution#getArg}. * Ignored if null. * @return the first component being created. * @see #createComponents(String, Map) * @since 2.4.0 */ public Component[] createComponents(PageDefinition pagedef, Map arg); /** Creates components that don't belong to any page * from a page file specified by an URI. * * <p>It loads the page definition from the specified URI (by * use {@link #getPageDefinition} ), and then * invokes {@link #createComponents(PageDefinition,Component,Map)} * to create components. * * @param arg a map of parameters that is accessible by the arg variable * in EL, or by {@link Execution#getArg}. * Ignored if null. * @see #createComponents(PageDefinition, Map) * @see #createComponentsDirectly(String, String, Map) * @see #createComponentsDirectly(Document, String, Map) * @see #createComponentsDirectly(Reader, String, Map) * @since 2.4.0 */ public Component[] createComponents(String uri, Map arg); /** Creates components that don't belong to any page * from the raw content specified by a string. * * <p>The raw content is parsed to a page defintion by use of * {@link #getPageDefinitionDirectly(String, String)}, and then * invokes {@link #createComponents(PageDefinition,Component,Map)} * to create components. * * @param content the raw content of the page. It must be in ZUML. * @param extension the default extension if the content doesn't specify * an language. In other words, if * the content doesn't specify an language, {@link LanguageDefinition#getByExtension} * is called. * If extension is null and the content doesn't specify a language, * the language called "xul/html" is assumed. * @param arg a map of parameters that is accessible by the arg variable * in EL, or by {@link Execution#getArg}. * Ignored if null. * @see #createComponents(PageDefinition, Map) * @see #createComponents(String, Map) * @see #createComponentsDirectly(Document, String, Map) * @see #createComponentsDirectly(Reader, String, Map) * @since 2.4.0 */ public Component[] createComponentsDirectly(String content, String extension, Map arg); /** Creates components that don't belong to any page * from the raw content specified by a DOM tree. * * <p>The raw content is parsed to a page defintion by use of * {@link #getPageDefinitionDirectly(Document, String)}, and then * invokes {@link #createComponents(PageDefinition,Component,Map)} * to create components. * * @param content the raw content in DOM. * @param extension the default extension if the content doesn't specify * an language. In other words, if * the content doesn't specify an language, {@link LanguageDefinition#getByExtension} * is called. * If extension is null and the content doesn't specify a language, * the language called "xul/html" is assumed. * @param arg a map of parameters that is accessible by the arg variable * in EL, or by {@link Execution#getArg}. * Ignored if null. * @see #createComponents(PageDefinition, Map) * @see #createComponents(String, Map) * @see #createComponentsDirectly(Document, String, Map) * @see #createComponentsDirectly(Reader, String, Map) * @since 2.4.0 */ public Component[] createComponentsDirectly(Document content, String extension, Map arg); /** Creates components that don't belong to any page * from the raw content read from the specified reader. * * <p>The raw content is loaded and parsed to a page defintion by use of * {@link #getPageDefinitionDirectly(Reader,String)}, and then * invokes {@link #createComponents(PageDefinition,Component,Map)} * to create components. * * @param reader the reader to retrieve the raw content in ZUML. * @param extension the default extension if the content doesn't specify * an language. In other words, if * the content doesn't specify an language, {@link LanguageDefinition#getByExtension} * is called. * If extension is null and the content doesn't specify a language, * the language called "xul/html" is assumed. * @param arg a map of parameters that is accessible by the arg variable * in EL, or by {@link Execution#getArg}. * Ignored if null. * @see #createComponents(PageDefinition, Map) * @see #createComponents(String, Map) * @see #createComponentsDirectly(Document, String, Map) * @see #createComponentsDirectly(String, String, Map) * @since 2.4.0 */ public Component[] createComponentsDirectly(Reader reader, String extension, Map arg) throws IOException; /** Sends a temporary redirect response to the client using the specified * redirect location URL. * * <p>It is the same as sendRedirect(url, null). * * <p>After calling this method, the caller shall end the processing * immediately (by returning). All pending requests and events will * be dropped. * * @param uri the URI to redirect to, or null to reload the same page */ public void sendRedirect(String uri); /** Sends a temporary redirect response to the client using the specified * redirect location URL and redirect to the specified browser window. * * <p>After calling this method, the caller shall end the processing * immediately (by returning). All pending requests and events will * be dropped. * * <p>Note: if you specify target other than null and "_self", it'll * fail if the browser prevent the server to popup a window. * * @param uri the URI to redirect to, or null to reload the same page * @param target the name of the browser window that send-redirect will * load the sepcified URI, or null if the current browser window * is used. */ public void sendRedirect(String uri, String target); /** Returns the parameters (aka., arg) if {@link #pushArg} is called recently, * or an empty map if not available. * * <p>The use of parameters is application dependent. * ZK only provides the way to store ({@link #pushArg} and to * restore {@link #popArg}. And, let the parameters being accessible in * EL by referring it as the arg variable. * * <p>Currently, {@link #createComponents(String,Component,Map)} * and similar methods use this mechanism to let caller customize a page * definition. * * <p>Notice that {@link #createComponents(String,Component,Map)} * pops arg after creating components, and before processing any event. * In other words, it is not aviable for event listener, including onCreate. * However, {@link org.zkoss.zk.ui.event.CreateEvent#getArg} preserves * the map for its event listeners. */ public Map getArg(); /** Pushes the parameters (aka., arg) that EL could refer it by the arg variable. * Remember to call {@link #popArg} in the finally clause. * @see #getArg */ public void pushArg(Map arg); /** Pops the parameters (aka., arg) that is pushed by {@link #pushArg}. * <p>It never throws an exception. * @see #getArg */ public void popArg(); /** Adds an asynchronous response ({@link AuResponse}) which will be * sent to client at the end of the execution. * * <p>If {@link AuResponse#getDepends} is not null, the response * depends on the returned componet. In other words, the response * is removed if the component is removed. * If it is null, the response is component-independent. * * @param key could be anything. The second invocation of this method * in the same execution with the same key will override the previous one. * In other words, the previous one will be dropped. * If null is specified, the response is simply appended to the end * without overriding any previous one. */ public void addAuResponse(String key, AuResponse resposne); /** Returns whether the client is a browser. */ public boolean isBrowser(); /** Returns whether the client is a robot (such as Web crawlers). * * <p>Because there are too many robots, it returns true if the user-agent * is not recognized. */ public boolean isRobot(); /** Returns whether the client is Internet Explorer. * If true, it also implies {@link #isExplorer7} is true. */ public boolean isExplorer(); /** Returns whether the client is Internet Explorer 7 or later. */ public boolean isExplorer7(); /** Returns whether the client is Gecko based, such as Mozilla, Firefox and Camino. */ public boolean isGecko(); /** Returns whether the client is Safari. */ public boolean isSafari(); /** Returns whether the client is a mobile device supporting MIL * (Mobile Interactive Language). * @since 2.4.1 */ public boolean isMilDevice(); /** Returns whether the client is a mobile device supporting HIL * (Handset Interactive Language). * * <p>Note: ZK Mobile for Android supports both MIL and HIL. * That is, both {@link #isHilDevice} and {@link #isMilDevice} * return true. * * @since 3.0.2 */ public boolean isHilDevice(); /** Returns the user-agent header, which indicates what the client is, * or an empty string if not available. * * <p>Note: it doesn't return null, so it is easy to test what * the client is with {@link String#indexOf}. * * @since 3.0.2 */ public String getUserAgent(); /** Returns the native request, or null if not available. * * <p>The returned object depends on the Web container. * If it is based Java servlet container, an instance of * javax.servlet.ServletRequest is returned. */ public Object getNativeRequest(); /** Returns the native response, or null if not available. * * <p>The returned object depends on the Web container. * If it is based Java servlet container, an instance of * javax.servlet.ServletResponse is returned. */ public Object getNativeResponse(); /** Returns the value of the specified request attribute. */ public Object getAttribute(String name); /** Sets the value of the specified request attribute. * * @param value the value. If null, the attribute is removed. */ public void setAttribute(String name, Object value); /** Removes the specified request attribute. */ public void removeAttribute(String name); /** Returns a map of request attributes associated with this session. */ public Map getAttributes(); /** Returns the value of the specified header as a {@link String}, * or null if not found. * @since 3.5.0 */ public String getHeader(String name); /** Returns all the values of the specified header as a {@link Iterator} * of {@link String} objects. * * <p>If the request did not include any headers of the specified name, * this method returns an empty {@link Iterator}. * If the container does not allow access to header information, * it returns null. * * @since 3.5.0 */ public Iterator getHeaders(String name); /** Returns all header names this request contains. * If the request has no headers, this method returns an empty * {@link Iterator}. * If the container does not allow access to header information, * it returns null. * @since 3.5.0 */ public Iterator getHeaderNames(); /** Sets a response header with the give name and value. * If the header had already been set, the new value overwrites the previous one. * @since 3.5.0 * @see #containsResponseHeader */ public void setResponseHeader(String name, String value); /** Adds a response header with the give name and value. * This method allows response headers to have multiple values. * @since 3.5.0 */ public void addResponseHeader(String name, String value); /** Returns whether the named response header has already been set. * @since 3.5.0 */ public boolean containsResponseHeader(String name); }

The table below shows all metrics for Execution.java.

MetricValueDescription
BLOCKS 0.00Number of blocks
BLOCK_COMMENT18.00Number of block comment lines
COMMENTS741.00Comment lines
COMMENT_DENSITY 6.74Comment density
COMPARISONS 0.00Number of comparison operators
CYCLOMATIC76.00Cyclomatic complexity
DECL_COMMENTS83.00Comments in declarations
DOC_COMMENT722.00Number of javadoc comment lines
ELOC110.00Effective lines of code
EXEC_COMMENTS 0.00Comments in executable code
EXITS 0.00Procedure exits
FUNCTIONS76.00Number of function declarations
HALSTEAD_DIFFICULTY17.82Halstead difficulty
HALSTEAD_EFFORT 0.00Halstead effort
INTERFACE_COMPLEXITY86.00Interface complexity
JAVA0001 0.00JAVA0001 Package name does not contain only lower case letters
JAVA0002 0.00JAVA0002 Package name does not begin with a top level domain name or country code
JAVA0003 0.00JAVA0003 Minimize use of on-demand (.*) imports
JAVA0004 0.00JAVA0004 Unnecessary import from java.lang
JAVA0005 1.00JAVA0005 Imports not in specified order
JAVA0006 0.00JAVA0006 Empty finally block
JAVA0007 0.00JAVA0007 Should not declare public field
JAVA0008 0.00JAVA0008 Empty catch block
JAVA0009 0.00JAVA0009 Protected member in final class
JAVA0010 0.00JAVA0010 Non-instantiable class does not contain a non-private static member
JAVA0011 0.00JAVA0011 Abstract class does not contain an abstract method
JAVA0012 0.00JAVA0012 Non-constructor method with same name as declaring class
JAVA0013 0.00JAVA0013 Non-blank final field is not static
JAVA0014 0.00JAVA0014 Class with only static members has non-private constructor
JAVA0015 0.00JAVA0015 Package class contains public nested type
JAVA0016 0.00JAVA0016 Abstract class contains public constructor
JAVA0017 0.00JAVA0017 Class name does not have required form
JAVA0018 0.00JAVA0018 Method name does not have required form
JAVA0019 0.00JAVA0019 Interface name does not have required form
JAVA0020 0.00JAVA0020 Field name does not have required form
JAVA0021 0.00JAVA0021 Interface method name does not have required form
JAVA0022 0.00JAVA0022 Static final field name does not have required form
JAVA0023 0.00JAVA0023 Empty finalize method
JAVA0024 0.00JAVA0024 Empty class
JAVA0025 0.00JAVA0025 Method override is empty
JAVA0026 0.00JAVA0026 Finalize method with parameters
JAVA0029 0.00JAVA0029 Private method not used
JAVA0030 0.00JAVA0030 Private field not used
JAVA0031 0.00JAVA0031 Case statement not properly closed
JAVA0032 0.00JAVA0032 Switch statement missing default
JAVA0033 0.00JAVA0033 default: not last case in switch statement
JAVA0034 0.00JAVA0034 Missing braces in if statement
JAVA0035 0.00JAVA0035 Missing braces in for statement
JAVA0036 0.00JAVA0036 Missing braces in while statement
JAVA0038 0.00JAVA0038 Non-case label in switch statement
JAVA0039 0.00JAVA0039 Break statement with label
JAVA0040 0.00JAVA0040 Switch statement contains N cases (maximum: M)
JAVA0041 0.00JAVA0041 Nested synchronized block
JAVA0042 0.00JAVA0042 Empty synchronized statement
JAVA0043 0.00JAVA0043 Inner class does not use outer class
JAVA0044 0.00JAVA0044 Serializable class with no instance variables
JAVA0045 0.00JAVA0045 Serializable class with only transient fields
JAVA0046 0.00JAVA0046 Name of class not derived from Exception ends with 'Exception'
JAVA0047 0.00JAVA0047 Serializable class derives from invalid base class
JAVA0048 0.00JAVA0048 Name of class derived from Exception does not end with 'Exception'
JAVA0049 0.00JAVA0049 Nested block at depth N (maximum: M)
JAVA0050 0.00JAVA0050 Class derives from java.lang.Error
JAVA0051 0.00JAVA0051 Class derives from java.lang.RuntimeException
JAVA0052 0.00JAVA0052 Class derives from java.lang.Throwable
JAVA0053 0.00JAVA0053 Unused label
JAVA0054 0.00JAVA0054 Inheritance depth N exceeds maximum M
JAVA0055 0.00JAVA0055 Class should be interface
JAVA0056 0.00JAVA0056 Unnecessary abstract modifier for interface or annotation
JAVA0057 0.00JAVA0057 Unnecessary default constructor
JAVA0058 0.00JAVA0058 Constructor calls super()
JAVA0059 0.00JAVA0059 Method override only calls super()
JAVA0061 0.00JAVA0061 Inaccessible member in anonymous class
JAVA0062 0.00JAVA0062 Public class missing public member or protected constructor
JAVA0063 0.00JAVA0063 Identifier name should not contain '$'
JAVA0064 0.00JAVA0064 N variations of identifier name (maximum: M)
JAVA0065 0.00JAVA0065 Unnecessary final modifier for method in final class
JAVA0066 0.00JAVA0066 Unnecessary modifier for interface nested type
JAVA0067 0.00JAVA0067 Array descriptor on identifier name
JAVA0068 0.00JAVA0068 Modifiers not declared in recommended order
JAVA0071 0.00JAVA0071 Strings compared with ==
JAVA0073 0.00JAVA0073 Integer division in floating-point context
JAVA0074 0.00JAVA0074 Use of Object.notify()
JAVA0075 0.00JAVA0075 Method parameter hides field
JAVA0076 0.00JAVA0076 Use of magic number
JAVA0077 0.00JAVA0077 Private field not used in declaring class
JAVA0078 0.00JAVA0078 Floating point values compared with ==
JAVA0079 0.00JAVA0079 Use of instance to reference static member
JAVA0080 1.00JAVA0080 Import declaration not used
JAVA0081 0.00JAVA0081 Boolean literal in comparison
JAVA0082 0.00JAVA0082 Unnecessary widening cast
JAVA0083 0.00JAVA0083 Unnecessary instanceof test
JAVA0084 0.00JAVA0084 Should use compound assignment operator
JAVA0085 0.00JAVA0085 Use of sun.* class
JAVA0087 0.00JAVA0087 Use of Thread.sleep()
JAVA0089 0.00JAVA0089 Use of restricted package
JAVA0092 0.00JAVA0092 Use of restricted type
JAVA0093 0.00JAVA0093 Redundant assignment
JAVA0094 0.00JAVA0094 Field hides a superclass field
JAVA0095 0.00JAVA0095 Uninitialized private field
JAVA0096 0.00JAVA0096 Field in nested class hides outer field
JAVA0098 0.00JAVA0098 Minimize use of implicit field initializers
JAVA0100 0.00JAVA0100 Class contains N non-final fields (maximum: M)
JAVA0101 4.00JAVA0101 Unnecessary modifier for field in interface
JAVA0102 0.00JAVA0102 Last statement in finalize() not super.finalize()
JAVA0103 0.00JAVA0103 Explicit call to finalize()
JAVA0104 0.00JAVA0104 finalize() only calls super.finalize()
JAVA0105 0.00JAVA0105 Duplicate import declaration
JAVA0106 0.00JAVA0106 Unnecessary import from current package
JAVA010830.00JAVA0108 Incorrect javadoc: no @param tag for 'parameter'
JAVA0109 0.00JAVA0109 Incorrect javadoc: no parameter 'parameter'
JAVA011057.00JAVA0110 Incorrect javadoc: no @return tag
JAVA0111 0.00JAVA0111 Incorrect javadoc: @return tag for void method
JAVA0112 0.00JAVA0112 Incorrect javadoc: no exception 'exception' in throws
JAVA0113 0.00JAVA0113 Incorrect javadoc: no @author tag
JAVA0114 1.00JAVA0114 Incorrect javadoc: no @version tag
JAVA0115 7.00JAVA0115 Incorrect javadoc: no @throws or @exception tag for 'exception'
JAVA0116 0.00JAVA0116 Missing javadoc: field 'field'
JAVA0117 0.00JAVA0117 Missing javadoc: method 'method'
JAVA0118 0.00JAVA0118 Missing javadoc: type 'type'
JAVA0119 0.00JAVA0119 Control variable changed within body of for loop
JAVA0123 0.00JAVA0123 Use all three components of for loop
JAVA0125 0.00JAVA0125 Continue statement with label
JAVA0126 0.00JAVA0126 Method declares unchecked exception in throws
JAVA0128 0.00JAVA0128 Public constructor in non-public class
JAVA0130 0.00JAVA0130 Non-static method does not use instance fields
JAVA0131 0.00JAVA0131 Compatible method does not override base
JAVA0132 0.00JAVA0132 Method overload with compatible signature
JAVA0133 0.00JAVA0133 Non-synchronized method overrides synchronized method
JAVA0135 0.00JAVA0135 Only one of Object.equals and Object.hashCode defined: missing 'method'
JAVA0136 1.00JAVA0136 N methods defined in class (maximum: M)
JAVA0137 0.00JAVA0137 Non-abstract class missing constructor
JAVA0138 0.00JAVA0138 N parameters defined for method (maximum: M)
JAVA0139 0.00JAVA0139 Definition of main other than public static void main(java.lang.String[])
JAVA014176.00JAVA0141 Unnecessary modifier for method in interface
JAVA0143 0.00JAVA0143 Synchronized method
JAVA0144 0.00JAVA0144 Line exceeds maximum M characters
JAVA0145809.00JAVA0145 Tab character used in source file
JAVA0150 0.00JAVA0150 java.lang.Error (or subclass) thrown
JAVA0153 0.00JAVA0153 Inefficient conversion of integer to string
JAVA0159 0.00JAVA0159 Inefficient conversion of string to integer
JAVA0160 0.00JAVA0160 Method does not throw specified exception
JAVA0161 0.00JAVA0161 Conditional wait() not in loop
JAVA0163 0.00JAVA0163 Empty statement
JAVA0165 0.00JAVA0165 Conflicting return statement in finally block
JAVA0166 0.00JAVA0166 Generic exception caught
JAVA0167 0.00JAVA0167 ThreadDeath not rethrown
JAVA0169 0.00JAVA0169 Unnecessary catch block: exception 'exception'
JAVA0170 0.00JAVA0170 Caught exception not derived from java.lang.Exception
JAVA0171 0.00JAVA0171 Unused local variable
JAVA0173 0.00JAVA0173 Unused method parameter
JAVA0174 0.00JAVA0174 Assigned local variable never used
JAVA0175 0.00JAVA0175 Successive assignment to variable
JAVA0176 0.00JAVA0176 Local variable name does not have required form
JAVA0177 0.00JAVA0177 Variable declaration missing initializer
JAVA0179 0.00JAVA0179 Local variable hides visible field
JAVA0233 0.00JAVA0233 Definition of serialVersionUID other than 'private static final long serialVersionUID'
JAVA0234 0.00JAVA0234 Class is Serializable but does not define serialVersionUID
JAVA0235 0.00JAVA0235 Class defines serialVersionUID but does not implement Serializable
JAVA0236 0.00JAVA0236 Attempt to clone an object which does not implement Cloneable
JAVA0237 0.00JAVA0237 Class implements Cloneable but does not have public clone method
JAVA0238 0.00JAVA0238 Clone method does not call super.clone()
JAVA0239 0.00JAVA0239 Class declares 'readObject' or 'writeObject' but does not implement Serializable
JAVA0240 0.00JAVA0240 Serializable class which declares readObject or writeObject but not both
JAVA0241 0.00JAVA0241 'readObject' or 'writeObject' should be declared private in Serializable class
JAVA0242 0.00JAVA0242 Transient field in non-Serializable class
JAVA0243 0.00JAVA0243 'readResolve' or 'writeReplace' should be declared private or protected
JAVA0244 0.00JAVA0244 Field or method name in subclass differs only by case from inherited field or method
JAVA0245 0.00JAVA0245 JUnit TestCase with non-trivial constructor
JAVA0246 0.00JAVA0246 JUnit assertXXX statement missing message parameter
JAVA0247 0.00JAVA0247 JUnit 'setUp()' and 'tearDown()' should call super method
JAVA0248 0.00JAVA0248 JUnit method 'setUp' or 'tearDown' with incorrect signature
JAVA0249 0.00JAVA0249 JUnit TestCase 'suite()' should be declared static
JAVA0250 0.00JAVA0250 JUnit TestCase declares testXXX method with incorrect signature
JAVA0251 0.00JAVA0251 Use '%n' for line breaks in printf/format for platform independence
JAVA0252 0.00JAVA0252 'enum' is a Java 1.5 reserved word
JAVA0253 0.00JAVA0253 Not all enum constants consumed in switch statement
JAVA0254 0.00JAVA0254 Use enhanced for loop construct instead of Iterator
JAVA0255 0.00JAVA0255 Result of method invocation not used
JAVA0256 0.00JAVA0256 Assignment of external collection/array to field
JAVA0257 0.00JAVA0257 Use of 'Constant Interface' anti-pattern
JAVA0258 1.00JAVA0258 Implement Iterable for foreach compatibility
JAVA0259 0.00JAVA0259 Return of collection/array field
JAVA0260 0.00JAVA0260 Use 'enum' instead of Enumerated Type pattern
JAVA0261 0.00JAVA0261 Use specialized Enum collection types
JAVA0262 0.00JAVA0262 Use of char in integer context
JAVA0263 0.00JAVA0263 Long literal ends with 'l' instead of 'L'
JAVA0264 0.00JAVA0264 Integer math in long context - check for overflow
JAVA0265 0.00JAVA0265 Use of Throwable.printStackTrace()
JAVA0266 0.00JAVA0266 Use of System.out
JAVA0267 0.00JAVA0267 Use of System.err
JAVA0269 0.00JAVA0269 Contents of StringBuffer never used
JAVA0270 0.00JAVA0270 Use Java 5.0 enhanced for loop construct to iterate over all elements in an array
JAVA0271 0.00JAVA0271 Minimize use of on-demand (.*) static imports
JAVA0272 0.00JAVA0272 Thread.run() called
JAVA0273 0.00JAVA0273 Non-final derivative of Thread calls start() in constructor
JAVA0274 0.00JAVA0274 Serializable class has a synchronized readObject()
JAVA0275 0.00JAVA0275 Serializable class has a synchronized writeObject() and no other synchronized methods
JAVA0276 0.00JAVA0276 Unnecessary use of String constructor
JAVA0277 0.00JAVA0277 Iterator.next() implementation does not throw NoSuchElementException
JAVA0278 0.00JAVA0278 Unnecessary use of Boolean constructor
JAVA0279 0.00JAVA0279 Serialization method readObject or readObjectNoData calls an overridable method
JAVA0280 0.00JAVA0280 IllegalMonitorStateException caught
JAVA0281 0.00JAVA0281 Iterator.next() not called in loop
JAVA0282 0.00JAVA0282 Call to Iterator.next() in loop which does not test Iterator.hasNext()
JAVA0283 0.00JAVA0283 Control variable not updated in loop body
JAVA0284 0.00JAVA0284 Explicit garbage collection
JAVA0285 0.00JAVA0285 Dereference of potentially null variable
JAVA0286 0.00JAVA0286 Dereference of null variable
JAVA0287 0.00JAVA0287 Unnecessary null check
JAVA0288 0.00JAVA0288 Inconsistent null check
LINES882.00Number of lines in the source file
LINE_COMMENT 1.00Number of line comments
LOC111.00Lines of code
LOGICAL_LINES96.00Number of statements
LOOPS 0.00Number of loops
NEST_DEPTH 0.00Maximum nesting depth
OPERANDS376.00Number of operands
OPERATORS520.00Number of operators
PARAMS86.00Number of formal parameter declarations
PROGRAM_LENGTH896.00Halstead program length
PROGRAM_VOCAB231.00Halstead program vocabulary
PROGRAM_VOLUME 0.00Halstead program volume
RETURNS 0.00Number of return points from functions
SIZE35383.00Size of the file in bytes
UNIQUE_OPERANDS211.00Number of unique operands
UNIQUE_OPERATORS20.00Number of unique operators
WHITESPACE30.00Number of whitespace lines