This is version . It is not the current version, and thus it cannot be edited.
[Back to current version]   [Restore this version]

Compilation#

Save the source code shown at the bottom of this page into a file called ###.java. Then invoke the Java compiler as follows

  javac ###.java
(or similar - depending on the development environment you are using)

Installation#

Create a JAR archive containing the Java class file for the plugin. You may use the command

  jar cvf ###.jar ###.class
for that purpose.

Then move that file into any directory within your wiki's class path - preferrably into the WEB-INF/lib/ folder within your web server's web application directory for the JSPWiki.

Finally restart the Wiki for the plugin to be recognized.

Usage#

Within wiki markup, invoke the plugin as follows

  [{###}]
As the class resides in the default directory, there is no need neither to prefix the plugin name with a package path nor to modify the plugin search path within the JSPWiki configuration file.

Source Code#

import java.util.*;                  // Java utility classes and data structures

import com.ecyrd.jspwiki.*;
import com.ecyrd.jspwiki.plugin.*;

public class showParameters implements WikiPlugin {
  public String execute (WikiContext Context, Map ParameterMap) throws PluginException {
    String Result = "<h4>showParameters - lists the given plugin parameters</h4>\n";

  /**** take care of a missing ParameterMap (may that ever happen?) ****/

    if (ParameterMap == null) {
      return Result + "(no parameters given)";
    };

  /**** otherwise retrieve (and show) any given parameters ****/

    Iterator ParameterInterator = ParameterMap.keySet().iterator();
    if (!ParameterInterator.hasNext()) {                  // this looks probable
      return Result + "(no parameters given)";
    };

    Result += "<dl>";
      while (ParameterInterator.hasNext()) {
        Object Key = ParameterInterator.next();
        Result += "<dt>" + Key + (Key != null ? " (" + Key.getClass().getName() + ")" : "") + "\n";

        Object Value = (Key == null ? null : ParameterMap.get(Key));
        if (Value == null) {
          Result += "<dd>(null)";
        } else {
          if (Value instanceof String) {
            Result += "<dd>\"" + Value + "\"";
          } else {
            Result += "<dd>(" + Value.getClass().getName() + ") " + Value + "\n";
          };
        };
      };
    return Result + "</dl>";
  };
};

Andreas Rozek (EMail: Andreas.Rozek@GMX.De)

Add new attachment

Only authorized users are allowed to upload new attachments.
« This particular version was published on 09-Apr-2003 15:55 by 129.69.13.219.