Example usage for org.apache.wicket.request Request getCharset

List of usage examples for org.apache.wicket.request Request getCharset

Introduction

In this page you can find the example usage for org.apache.wicket.request Request getCharset.

Prototype

public abstract Charset getCharset();

Source Link

Document

Gets charset of the request

Usage

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));
                    }// w ww.j  a v a2s  . c  o  m
                }
            } catch (ItemNotFoundException ex) {
                log.info("Could not resolve link", ex);
            } catch (RepositoryException e) {
                log.error("Error while browing to link", e);
            }
        }
    }
}