Example usage for org.apache.wicket.util.encoding UrlDecoder QUERY_INSTANCE

List of usage examples for org.apache.wicket.util.encoding UrlDecoder QUERY_INSTANCE

Introduction

In this page you can find the example usage for org.apache.wicket.util.encoding UrlDecoder QUERY_INSTANCE.

Prototype

UrlDecoder QUERY_INSTANCE

To view the source code for org.apache.wicket.util.encoding UrlDecoder QUERY_INSTANCE.

Click Source Link

Document

Encoder used to decode name or value components of a query string.<br/> <br/> For example: http://org.acme/notthis/northis/oreventhis?buthis=isokay&asis=thispart

Usage

From source file:com.gitblit.wicket.SessionlessForm.java

License:Apache License

/**
 * Take URL-encoded query string value, unencode it and return HTML-escaped version
 *
 * @param s//from  w ww.  ja  va 2 s .  com
 *            value to reencode
 * @return reencoded value
 */
private String recode(String s) {
    String un = UrlDecoder.QUERY_INSTANCE.decode(s, Constants.ENCODING);
    return Strings.escapeMarkup(un).toString();
}

From source file:org.hippoecm.frontend.plugins.richtext.view.PreviewLinksBehavior.java

License:Apache License

@Override
protected void respond(AjaxRequestTarget target) {
    Request request = RequestCycle.get().getRequest();
    final StringValue linkValue = request.getRequestParameters().getParameterValue("link");
    if (linkValue != null) {
        String link = linkValue.toString();
        link = UrlDecoder.QUERY_INSTANCE.decode(link, request.getCharset());
        if (browser != null) {
            Node node = model.getObject();
            try {
                if (node.hasNode(link)) {
                    node = node.getNode(link);
                    if (node.isNodeType(NT_FACETSELECT)) {
                        final String uuid = node.getProperty(HIPPO_DOCBASE).getString();
                        final Session jcrSession = UserSession.get().getJcrSession();
                        node = jcrSession.getNodeByIdentifier(uuid);
                        browser.browse(new JcrNodeModel(node));
                    }//from   w  ww.  ja v a  2 s. c  o m
                }
            } catch (ItemNotFoundException ex) {
                log.info("Could not resolve link", ex);
            } catch (RepositoryException e) {
                log.error("Error while browing to link", e);
            }
        }
    }
}