Example usage for java.net URI toASCIIString

List of usage examples for java.net URI toASCIIString

Introduction

In this page you can find the example usage for java.net URI toASCIIString.

Prototype

public String toASCIIString() 

Source Link

Document

Returns the content of this URI as a US-ASCII string.

Usage

From source file:eu.abc4trust.smartcard.HardwareSmartcard.java

@Override
public SmartcardStatusCode storeCredential(int pin, URI credentialId, Credential cred,
        CredentialSerializer serializer) {
    //this.detectMaxBlobSize(pin);
    byte[] credBytes = serializer.serializeCredential(cred);
    System.out.println("CredBytes length: " + credBytes.length);
    int nextCredBlobUri = 1;
    SmartcardStatusCode returnCode = SmartcardStatusCode.OK;

    int bytesLeft = credBytes.length;
    int i = 0;//from  ww w  . jav a  2  s  .  c  om
    boolean done = false;
    while (!done) {
        SmartcardBlob blob = new SmartcardBlob();
        if (bytesLeft > MAX_BLOB_BYTES) {
            blob.blob = new byte[MAX_BLOB_BYTES];
            bytesLeft -= MAX_BLOB_BYTES;
            System.arraycopy(credBytes, i * MAX_BLOB_BYTES, blob.blob, 0, MAX_BLOB_BYTES);
        } else {
            blob.blob = new byte[bytesLeft];
            System.arraycopy(credBytes, i * MAX_BLOB_BYTES, blob.blob, 0, bytesLeft);
            done = true; //We know we are done as we put the last bytes in the blob.
        }
        URI credUri = URI.create(credentialId.toASCIIString() + "_" + nextCredBlobUri++);
        System.out.println(
                "storing a blob of size: " + blob.blob.length + " with uri: " + credUri.toASCIIString());
        returnCode = storeBlob(pin, credUri, blob);
        if (returnCode != SmartcardStatusCode.OK) {
            return returnCode;
        }
        i++;
    }
    return returnCode;
}

From source file:eu.abc4trust.smartcard.HardwareSmartcard.java

@Override
public SmartcardStatusCode storePseudonym(int pin, URI pseudonymId, PseudonymWithMetadata pseudo,
        PseudonymSerializer serializer) {
    //this.detectMaxBlobSize(pin);
    byte[] pseudoBytes = serializer.serializePseudonym(pseudo);
    System.out.println("PseudoBytes length: " + pseudoBytes.length);
    int nextPseudoBlobUri = 1;
    SmartcardStatusCode returnCode = SmartcardStatusCode.OK;

    int bytesLeft = pseudoBytes.length;
    int i = 0;/* w w w . ja va2  s .  co  m*/
    boolean done = false;
    while (!done) {
        SmartcardBlob blob = new SmartcardBlob();
        if (bytesLeft > MAX_BLOB_BYTES) {
            blob.blob = new byte[MAX_BLOB_BYTES];
            bytesLeft -= MAX_BLOB_BYTES;
            System.arraycopy(pseudoBytes, i * MAX_BLOB_BYTES, blob.blob, 0, MAX_BLOB_BYTES);
        } else {
            blob.blob = new byte[bytesLeft];
            System.arraycopy(pseudoBytes, i * MAX_BLOB_BYTES, blob.blob, 0, bytesLeft);
            done = true; //We know we are done as we put the last bytes in the blob.
        }
        URI credUri = URI.create(pseudonymId.toASCIIString() + "_" + nextPseudoBlobUri++);
        System.out.println(
                "storing a blob of size: " + blob.blob.length + " with uri: " + credUri.toASCIIString());
        returnCode = storeBlob(pin, credUri, blob);
        if (returnCode != SmartcardStatusCode.OK) {
            return returnCode;
        }
        i++;
    }
    return returnCode;
}

From source file:com.squid.kraken.v4.api.core.analytics.AnalyticsServiceBaseImpl.java

private Response createHTMLPageView(Space space, ViewQuery view, Info info, ViewReply reply) {
    String title = getPageTitle(space);
    StringBuilder html = createHTMLHeader("View: " + title);
    if (getPublicBaseUriBuilder().build().getScheme().equalsIgnoreCase("https")) {
        html.append(//from   ww w .  j  a  v  a 2  s  .  c o  m
                "<script src=\"https://d3js.org/d3.v3.min.js\" charset=\"utf-8\"></script>\r\n<script src=\"https://vega.github.io/vega/vega.js\" charset=\"utf-8\"></script>\r\n<script src=\"https://vega.github.io/vega-lite/vega-lite.js\" charset=\"utf-8\"></script>\r\n<script src=\"https://vega.github.io/vega-editor/vendor/vega-embed.js\" charset=\"utf-8\"></script>\r\n\r\n");
    } else {
        html.append(
                "<script src=\"http://d3js.org/d3.v3.min.js\" charset=\"utf-8\"></script>\r\n<script src=\"http://vega.github.io/vega/vega.js\" charset=\"utf-8\"></script>\r\n<script src=\"http://vega.github.io/vega-lite/vega-lite.js\" charset=\"utf-8\"></script>\r\n<script src=\"http://vega.github.io/vega-editor/vendor/vega-embed.js\" charset=\"utf-8\"></script>\r\n\r\n");
    }
    html.append("<body>");
    createHTMLtitle(html, title, view.getBBID(), getParentLink(space));
    createHTMLproblems(html, reply.getQuery().getProblems());
    html.append(
            "<div id=\"vis\"></div>\r\n\r\n<script>\r\nvar embedSpec = {\r\n  mode: \"vega-lite\", renderer:\"svg\",  spec:");
    html.append(writeVegalightSpecs(reply.getResult()));
    Encoding channels = reply.getResult().encoding;
    html.append(
            "}\r\nvg.embed(\"#vis\", embedSpec, function(error, result) {\r\n  // Callback receiving the View instance and parsed Vega spec\r\n  // result.view is the View, which resides under the '#vis' element\r\n});\r\n</script>\r\n");
    createHTMLpagination(html, view, info);
    // data-link
    URI dataLink = buildAnalyticsQueryURI(userContext, reply.getQuery(), "RECORDS", "ALL", Style.HTML, null);
    html.append("<p><a href=\"" + StringEscapeUtils.escapeHtml4(dataLink.toASCIIString())
            + "\">view query data</a></p>");
    //
    html.append("<form>");
    createHTMLfilters(html, reply.getQuery());
    html.append("<table>" + "<tr><td>x</td><td><input type=\"text\" size=30 name=\"x\" value=\""
            + getFieldValue(view.getX()) + "\"></td><td>"
            + (channels.x != null ? "as <b>" + channels.x.field + "</b>" : "") + "</td></tr>"
            + "<tr><td>y</td><td><input type=\"text\" size=30 name=\"y\" value=\"" + getFieldValue(view.getY())
            + "\"></td><td>" + (channels.y != null ? "as <b>" + channels.y.field + "</b>" : "") + "</td></tr>"
            + "<tr><td>color</td><td><input type=\"text\" size=30 name=\"color\" value=\""
            + getFieldValue(view.getColor()) + "\"></td><td>"
            + (channels.color != null ? "as <b>" + channels.color.field + "</b>" : "") + "</td></tr>"
            + "<tr><td>size</td><td><input type=\"text\" size=30 name=\"size\" value=\""
            + getFieldValue(view.getSize()) + "\"></td><td>"
            + (channels.size != null ? "as <b>" + channels.size.field + "</b>" : "") + "</td></tr>"
            + "<tr><td>column</td><td><input type=\"text\" size=30 name=\"column\" value=\""
            + getFieldValue(view.getColumn()) + "\"></td><td>"
            + (channels.column != null ? "as <b>" + channels.column.field + "</b>" : "") + "</td></tr>"
            + "<tr><td>row</td><td><input type=\"text\" size=30 name=\"row\" value=\""
            + getFieldValue(view.getRow()) + "\"></td><td>"
            + (channels.row != null ? "as <b>" + channels.row.field + "</b>" : "") + "</td></tr>");
    // metrics -- display the actual metrics
    html.append("<tr><td valign='top'>metrics</td><td>");
    createHTMLinputArray(html, "text", "metrics", reply.getQuery().getMetrics());
    html.append(
            "</td><td>Use the metrics parameters if you want to view multiple metrics on the same graph. Then you can use the <b>__VALUE</b> expression in channel to reference the metrics' value, and the <b>__METRICS</b> to get the metrics' name as a series.<br>If you need only a single metrics, you can directly define it in a channel, e.g. <code>y=count()</code>.");
    html.append("</td></tr>");
    // limits, maxResults, startIndex
    html.append("<tr><td>limit</td><td>");
    html.append("<input type=\"text\" name=\"limit\" value=\"" + getFieldValue(view.getLimit(), -1) + "\">");
    html.append("</td></tr>");
    html.append("<tr><td>maxResults</td><td>");
    html.append("<input type=\"text\" name=\"maxResults\" value=\"" + getFieldValue(view.getMaxResults(), -1)
            + "\">");
    html.append("</td></tr>");
    html.append("<tr><td>startIndex</td><td>");
    html.append("<input type=\"text\" name=\"startIndex\" value=\"" + getFieldValue(view.getStartIndex(), 0)
            + "\"></td><td><i>index is zero-based, so use the #count of the last row to view the next page</i>");
    html.append("</td></tr>");
    html.append("</table>" + "<input type=\"hidden\" name=\"style\" value=\"HTML\">"
            + "<input type=\"hidden\" name=\"access_token\" value=\""
            + space.getUniverse().getContext().getToken().getOid() + "\">"
            + "<input type=\"submit\" value=\"Refresh\">" + "</form>");
    createHTMLscope(html, space, reply.getQuery());
    createHTMLAPIpanel(html, "viewAnalysis");
    html.append("</body>\r\n</html>");
    return Response.ok(html.toString(), "text/html; charset=UTF-8").build();
}

From source file:org.exist.xquery.xproc.XProcRunner.java

protected static boolean run(URI staticBaseURI, InputStream defaultIn, ByteArrayOutputStream byteStream,
        UserArgs userArgs, XProcConfiguration config)
        throws SaxonApiException, IOException, URISyntaxException {
    XProcRuntime runtime = new XProcRuntime(config);

    if (staticBaseURI != null) {
        runtime.setURIResolver(new ExternalResolver(staticBaseURI.toString()));
        //            runtime.setStaticBaseURI(staticBaseURI);
        //            runtime.setBaseURI(staticBaseURI);
    }/*from   w ww .  j  av  a 2 s . c  om*/

    boolean debug = config.debug;

    XPipeline pipeline = null;

    if (userArgs.getPipeline() != null) {
        pipeline = runtime.load(userArgs.getPipeline());
    } else if (userArgs.hasImplicitPipeline()) {
        XdmNode implicitPipeline = userArgs.getImplicitPipeline(runtime);

        if (debug) {
            System.err.println("Implicit pipeline:");

            Serializer serializer = new Serializer();

            serializer.setOutputProperty(Serializer.Property.INDENT, "yes");
            serializer.setOutputProperty(Serializer.Property.METHOD, "xml");

            serializer.setOutputStream(System.err);

            S9apiUtils.serialize(runtime, implicitPipeline, serializer);
        }

        pipeline = runtime.use(implicitPipeline);
    } else if (config.pipeline != null) {
        XdmNode doc = config.pipeline.read();
        pipeline = runtime.use(doc);
    } else {
        throw new UnsupportedOperationException("Either a pipeline or libraries and / or steps must be given");
    }

    // Process parameters from the configuration...
    for (String port : config.params.keySet()) {
        Map<QName, String> parameters = config.params.get(port);
        setParametersOnPipeline(pipeline, port, parameters);
    }

    // Now process parameters from the command line...
    for (String port : userArgs.getParameterPorts()) {
        Map<QName, String> parameters = userArgs.getParameters(port);
        setParametersOnPipeline(pipeline, port, parameters);
    }

    Set<String> ports = pipeline.getInputs();
    Set<String> userArgsInputPorts = userArgs.getInputPorts();
    Set<String> cfgInputPorts = config.inputs.keySet();
    Set<String> allPorts = new HashSet<String>();
    allPorts.addAll(userArgsInputPorts);
    allPorts.addAll(cfgInputPorts);

    // map a given input without port specification to the primary non-parameter input implicitly
    for (String port : ports) {
        if (!allPorts.contains(port) && allPorts.contains(null)
                && pipeline.getDeclareStep().getInput(port).getPrimary()
                && !pipeline.getDeclareStep().getInput(port).getParameterInput()) {

            if (userArgsInputPorts.contains(null)) {
                userArgs.setDefaultInputPort(port);
                allPorts.remove(null);
                allPorts.add(port);
            }
            break;
        }
    }

    for (String port : allPorts) {
        if (!ports.contains(port)) {
            throw new XProcException(
                    "There is a binding for the port '" + port + "' but the pipeline declares no such port.");
        }

        pipeline.clearInputs(port);

        if (userArgsInputPorts.contains(port)) {
            XdmNode doc = null;
            for (Input input : userArgs.getInputs(port)) {
                switch (input.getType()) {
                case XML:
                    switch (input.getKind()) {
                    case URI:
                        String uri = input.getUri();
                        if ("-".equals(uri)) {
                            throw new IOException("unsupported '-'");
                            //                                        doc = runtime.parse(new InputSource(System.in));
                        } else {
                            doc = runtime.parse(uri, staticBaseURI.toASCIIString());
                        }
                        break;

                    case INPUT_STREAM:
                        InputStream inputStream = input.getInputStream();
                        doc = runtime.parse(new InputSource(inputStream));
                        inputStream.close();
                        break;

                    default:
                        throw new UnsupportedOperationException(
                                format("Unsupported input kind '%s'", input.getKind()));
                    }
                    break;

                case DATA:
                    ReadableData rd;
                    switch (input.getKind()) {
                    case URI:
                        rd = new ReadableData(runtime, c_data, input.getUri(), input.getContentType());
                        doc = rd.read();
                        break;

                    case INPUT_STREAM:
                        InputStream inputStream = input.getInputStream();
                        rd = new ReadableData(runtime, c_data, inputStream, input.getContentType());
                        doc = rd.read();
                        inputStream.close();
                        break;

                    default:
                        throw new UnsupportedOperationException(
                                format("Unsupported input kind '%s'", input.getKind()));
                    }
                    break;

                default:
                    throw new UnsupportedOperationException(
                            format("Unsupported input type '%s'", input.getType()));
                }

                pipeline.writeTo(port, doc);
            }
        } else {
            for (ReadablePipe pipe : config.inputs.get(port)) {
                XdmNode doc = pipe.read();
                pipeline.writeTo(port, doc);
            }
        }
    }

    // Implicit binding for stdin?
    String implicitPort = null;
    for (String port : ports) {
        if (!allPorts.contains(port)) {
            if (pipeline.getDeclareStep().getInput(port).getPrimary()
                    && !pipeline.getDeclareStep().getInput(port).getParameterInput()) {
                implicitPort = port;
            }
        }
    }

    if (implicitPort != null && !pipeline.hasReadablePipes(implicitPort) && defaultIn != null) {
        //            throw new XProcException("no implicitPort or it is not readable.");
        XdmNode doc = runtime.parse(new InputSource(defaultIn));
        pipeline.writeTo(implicitPort, doc);
    }

    Map<String, Output> portOutputs = new HashMap<String, Output>();

    Map<String, Output> userArgsOutputs = userArgs.getOutputs();
    for (String port : pipeline.getOutputs()) {
        // Bind to "-" implicitly
        Output output = null;

        if (userArgsOutputs.containsKey(port)) {
            output = userArgsOutputs.get(port);
        } else if (config.outputs.containsKey(port)) {
            output = new Output(config.outputs.get(port));
        } else if (userArgsOutputs.containsKey(null)
                && pipeline.getDeclareStep().getOutput(port).getPrimary()) {
            // Bind unnamed port to primary output port
            output = userArgsOutputs.get(null);
        }

        // Look for explicit binding to "-"
        if ((output != null) && (output.getKind() == Kind.URI) && "-".equals(output.getUri())) {
            output = null;
        }

        portOutputs.put(port, output);
    }

    for (QName optname : config.options.keySet()) {
        RuntimeValue value = new RuntimeValue(config.options.get(optname), null, null);
        pipeline.passOption(optname, value);
    }

    for (QName optname : userArgs.getOptionNames()) {
        RuntimeValue value = new RuntimeValue(userArgs.getOption(optname), null, null);
        pipeline.passOption(optname, value);
    }

    pipeline.run();

    for (String port : pipeline.getOutputs()) {
        Output output;
        if (portOutputs.containsKey(port)) {
            output = portOutputs.get(port);
        } else {
            // You didn't bind it, and it isn't going to stdout, so it's going into the bit bucket.
            continue;
        }

        if ((output == null)
                || ((output.getKind() == OUTPUT_STREAM) && System.out.equals(output.getOutputStream()))) {
            finest(logger, null, "Copy output from " + port + " to stdout");
        } else {
            switch (output.getKind()) {
            case URI:
                finest(logger, null, "Copy output from " + port + " to " + output.getUri());
                break;

            case OUTPUT_STREAM:
                String outputStreamClassName = output.getOutputStream().getClass().getName();
                finest(logger, null, "Copy output from " + port + " to " + outputStreamClassName + " stream");
                break;

            default:
                throw new UnsupportedOperationException(
                        format("Unsupported output kind '%s'", output.getKind()));
            }
        }

        Serialization serial = pipeline.getSerialization(port);

        if (serial == null) {
            // Use the configuration options
            // FIXME: should each of these be considered separately?
            // FIXME: should there be command-line options to override these settings?
            serial = new Serialization(runtime, pipeline.getNode()); // The node's a hack
            for (String name : config.serializationOptions.keySet()) {
                String value = config.serializationOptions.get(name);

                if ("byte-order-mark".equals(name))
                    serial.setByteOrderMark("true".equals(value));
                if ("escape-uri-attributes".equals(name))
                    serial.setEscapeURIAttributes("true".equals(value));
                if ("include-content-type".equals(name))
                    serial.setIncludeContentType("true".equals(value));
                if ("indent".equals(name))
                    serial.setIndent("true".equals(value));
                if ("omit-xml-declaration".equals(name))
                    serial.setOmitXMLDeclaration("true".equals(value));
                if ("undeclare-prefixes".equals(name))
                    serial.setUndeclarePrefixes("true".equals(value));
                if ("method".equals(name))
                    serial.setMethod(new QName("", value));

                // FIXME: if ("cdata-section-elements".equals(name)) serial.setCdataSectionElements();
                if ("doctype-public".equals(name))
                    serial.setDoctypePublic(value);
                if ("doctype-system".equals(name))
                    serial.setDoctypeSystem(value);
                if ("encoding".equals(name))
                    serial.setEncoding(value);
                if ("media-type".equals(name))
                    serial.setMediaType(value);
                if ("normalization-form".equals(name))
                    serial.setNormalizationForm(value);
                if ("standalone".equals(name))
                    serial.setStandalone(value);
                if ("version".equals(name))
                    serial.setVersion(value);
            }
        }

        // I wonder if there's a better way...
        WritableDocument wd = null;
        if (output == null) {
            //wd = new EXistDocument(runtime, null, serial);
            wd = new WritableDocument(runtime, null, serial, byteStream);
        } else {
            switch (output.getKind()) {
            case URI:
                URI uri = new URI(output.getUri());

                String filename = uri.getPath();

                Resource resource = new Resource(filename);
                OutputStream outfile = resource.getOutputStream();

                //                        URI furi = new URI(output.getUri());
                //                        String filename = furi.getPath();
                //                        FileOutputStream outfile = new FileOutputStream(filename);

                wd = new WritableDocument(runtime, filename, serial, outfile);
                break;

            case OUTPUT_STREAM:
                OutputStream outputStream = output.getOutputStream();
                wd = new WritableDocument(runtime, null, serial, outputStream);
                break;

            default:
                throw new UnsupportedOperationException(
                        format("Unsupported output kind '%s'", output.getKind()));
            }
        }

        ReadablePipe rpipe = pipeline.readFrom(port);
        while (rpipe.moreDocuments()) {
            wd.write(rpipe.read());
        }

        if (output != null) {
            wd.close();
        }
    }

    return portOutputs.containsValue(null);
}

From source file:com.squid.kraken.v4.api.core.analytics.AnalyticsServiceBaseImpl.java

private void createHTMLscope(StringBuilder html, Space space, AnalyticsQuery query) {
    html.append(/*from  www.  j  a va  2s  . c  o m*/
            "<fieldset><legend>Query scope: <i>this is the list of objects you can combine to build expressions in the query</i></legend>");
    html.append("<table>");
    html.append("<tr><td></td><td>You can Drag & Drop expression into input fields</td></tr>");
    html.append("<tr><td>GroupBy:</td><td>");
    for (Axis axis : space.A(true)) {// only print the visible scope
        try {
            IDomain image = axis.getDefinitionSafe().getImageDomain();
            if (!image.isInstanceOf(IDomain.OBJECT)) {
                DimensionIndex index = axis.getIndex();
                html.append("<span draggable='true' style='" + axis_style + "'");
                ExpressionAST expr = axis.getDefinitionSafe();
                html.append("title='" + getExpressionValueType(expr).toString() + ": ");
                if (axis.getDescription() != null) {
                    html.append(axis.getDescription());
                }
                if (index.getErrorMessage() != null) {
                    html.append("\nError:" + index.getErrorMessage());
                }
                html.append("'");
                html.append(" ondragstart='drag(event,\"" + index.getDimensionName() + "\")'>");
                if (index.getErrorMessage() == null) {
                    html.append("&nbsp;" + index.getDimensionName() + "&nbsp;");
                } else {
                    html.append("&nbsp;<del>" + index.getDimensionName() + "</del>&nbsp;");
                }
                html.append("</span>");
            }
        } catch (Exception e) {
            // ignore
        }
    }
    html.append("</td></tr>");
    html.append("<tr><td>Metrics:</td><td>");
    for (Measure m : space.M()) {
        if (m.getMetric() != null && !m.getMetric().isDynamic()) {
            html.append("<span draggable='true'  style='" + metric_style + "'");
            ExpressionAST expr = m.getDefinitionSafe();
            html.append("title='" + getExpressionValueType(expr).toString() + ": ");
            if (m.getDescription() != null) {
                html.append(m.getDescription());
            }
            html.append("'");
            html.append(" ondragstart='drag(event,\"" + m.getName() + "\")'");
            html.append(">&nbsp;" + m.getName() + "&nbsp;</span>");
        }
    }
    html.append("</td></tr></table>");
    URI scopeLink = getPublicBaseUriBuilder().path("/analytics/{reference}/scope")
            .queryParam("style", Style.HTML).queryParam("access_token", userContext.getToken().getOid())
            .build(query.getBBID());
    html.append(
            "<a href=\"" + StringEscapeUtils.escapeHtml4(scopeLink.toASCIIString()) + "\">View the scope</a>");
    html.append("</fieldset>");
}

From source file:com.squid.kraken.v4.api.core.analytics.AnalyticsServiceBaseImpl.java

/**
 * @param space//from   w w  w  .  j  a va  2 s. co m
 * @param suggestions
 * @param values 
 * @param types 
 * @param expression 
 * @return
 */
private Response createHTMLPageScope(Space space, ExpressionSuggestion suggestions, String BBID, String value,
        ObjectType[] types, ValueType[] values) {
    String title = getPageTitle(space);
    StringBuilder html = createHTMLHeader("Scope: " + title);
    createHTMLtitle(html, title, BBID, getParentLink(space));
    if (value != null && value.length() > 0 && suggestions.getValidateMessage() != null
            && suggestions.getValidateMessage().length() > 0) {
        createHTMLproblems(html, Collections
                .singletonList(new Problem(Severity.WARNING, value, suggestions.getValidateMessage())));
    }
    html.append("<form>");
    html.append("<p>Expression:<input type='text' name='value' size=100 value='" + getFieldValue(value)
            + "' placeholder='type expression to validate it or to filter the suggestion list'></p>");
    html.append("<fieldset><legend>Filter by expression type</legend>");
    html.append(
            "<input type='checkbox' name='types' value='" + ObjectType.DIMENSION + "'>" + ObjectType.DIMENSION);
    html.append("<input type='checkbox' name='types' value='" + ObjectType.COLUMN + "'>" + ObjectType.COLUMN);
    html.append(
            "<input type='checkbox' name='types' value='" + ObjectType.RELATION + "'>" + ObjectType.RELATION);
    html.append("<input type='checkbox' name='types' value='" + ObjectType.METRIC + "'>" + ObjectType.METRIC);
    html.append(
            "<input type='checkbox' name='types' value='" + ObjectType.FUNCTION + "'>" + ObjectType.FUNCTION);
    html.append("</fieldset>");
    html.append("<fieldset><legend>Filter by expression value</legend>");
    html.append("<input type='checkbox' name='values' value='" + ValueType.DATE + "'>" + ValueType.DATE);
    html.append("<input type='checkbox' name='values' value='" + ValueType.STRING + "'>" + ValueType.STRING);
    html.append(
            "<input type='checkbox' name='values' value='" + ValueType.CONDITION + "'>" + ValueType.CONDITION);
    html.append("<input type='checkbox' name='values' value='" + ValueType.NUMERIC + "'>" + ValueType.NUMERIC);
    html.append(
            "<input type='checkbox' name='values' value='" + ValueType.AGGREGATE + "'>" + ValueType.AGGREGATE);
    html.append("</fieldset>");
    html.append("<input type=\"hidden\" name=\"style\" value=\"HTML\">"
            + "<input type=\"hidden\" name=\"access_token\" value=\""
            + space.getUniverse().getContext().getToken().getOid() + "\">"
            + "<input type=\"submit\" value=\"Refresh\">");
    html.append("</form>");
    html.append(
            "<p><i> This is the list of all available expressions and function in this scope. Relation expression can be composed in order to navigate the data model.</i></p>");
    html.append("<table>");
    for (ExpressionSuggestionItem item : suggestions.getSuggestions()) {
        html.append("<tr><td>");
        html.append(item.getObjectType() + "</td><td>");
        html.append(item.getValueType() + "</td><td>");
        String style = other_style;
        if (item.getObjectType() == ObjectType.DIMENSION)
            style = axis_style;
        if (item.getObjectType() == ObjectType.METRIC)
            style = metric_style;
        if (item.getObjectType() == ObjectType.FUNCTION)
            style = func_style;
        html.append("<span style='" + style + "'>&nbsp;" + item.getDisplay() + "&nbsp;</span>");
        if (item.getSuggestion() != null) {
            URI link = getPublicBaseUriBuilder().path("/analytics/{reference}/scope")
                    .queryParam("value", value + item.getSuggestion()).queryParam("style", Style.HTML)
                    .queryParam("access_token", userContext.getToken().getOid()).build(BBID);
            html.append(
                    "&nbsp;[<a href=\"" + StringEscapeUtils.escapeHtml4(link.toASCIIString()) + "\">+</a>]");
        }
        if (item.getExpression() != null && item.getExpression() instanceof AxisExpression) {
            AxisExpression ref = (AxisExpression) item.getExpression();
            Axis axis = ref.getAxis();
            if (axis.getDimensionType() == Type.CATEGORICAL) {
                URI link = getPublicBaseUriBuilder().path("/analytics/{reference}/facets/{facetId}")
                        .queryParam("style", Style.HTML)
                        .queryParam("access_token", userContext.getToken().getOid())
                        .build(BBID, item.getSuggestion());
                html.append("&nbsp;[<a href=\"" + StringEscapeUtils.escapeHtml4(link.toASCIIString())
                        + "\">Indexed</a>]");
            } else if (axis.getDimensionType() == Type.CONTINUOUS) {
                URI link = getPublicBaseUriBuilder().path("/analytics/{reference}/facets/{facetId}")
                        .queryParam("style", Style.HTML)
                        .queryParam("access_token", userContext.getToken().getOid())
                        .build(BBID, item.getSuggestion());
                html.append("&nbsp;[<a href=\"" + StringEscapeUtils.escapeHtml4(link.toASCIIString())
                        + "\">Period</a>]");
            }
        }
        if (item.getDescription() != null && item.getDescription().length() > 0) {
            html.append("<br><i>" + item.getDescription() + "</i>");
        }
        html.append("</td></tr>");
    }
    html.append("</table>");
    createHTMLAPIpanel(html, "scopeAnalysis");
    html.append("</body></html>");
    return Response.ok(html.toString(), "text/html").build();
}