All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.yawp.tools.Tool Maven / Gradle / Ivy

There is a newer version: 2.08alpha
Show newest version
package io.yawp.tools;

import io.yawp.repository.Feature;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;

public abstract class Tool extends Feature {

    private static final String NS_PARAM = "ns";

    protected Map params;

    protected PrintWriter pw;

    public abstract void execute();

    public void prepareAndExecute() throws IOException {
        init();
        setNamespace();
        execute();
    }

    private void init() throws IOException {
        this.params = requestContext.getParams();
        this.pw = requestContext.resp().getWriter();
    }

    private void setNamespace() {
        String ns = params.get(NS_PARAM);
        if (ns != null) {
            yawp.namespace(ns);
        }
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy