Package org.apache.sling.api.request

Examples of org.apache.sling.api.request.RequestParameterMap


     * @param defaultNodeNameGenerator a default generator
     * @return a nice node name
     */
    public String getNodeName(SlingHttpServletRequest request, String basePath,
            boolean requirePrefix, NodeNameGenerator defaultNodeNameGenerator) {
        RequestParameterMap parameters = request.getRequestParameterMap();
        String valueToUse = null;
        boolean doFilter = true;

        // find the first request parameter that matches one of
        // our parameterNames, in order, and has a value
        if (parameters!=null) {
            // we first check for the special sling parameters
            RequestParameter specialParam = parameters.getValue(SlingPostConstants.RP_NODE_NAME);
            if ( specialParam != null ) {
                if ( specialParam.getString() != null && specialParam.getString().length() > 0 ) {
                    valueToUse = specialParam.getString();
                    doFilter = false;
                }
            }
            if ( valueToUse == null ) {
                specialParam = parameters.getValue(SlingPostConstants.RP_NODE_NAME_HINT);
                if ( specialParam != null ) {
                    if ( specialParam.getString() != null && specialParam.getString().length() > 0 ) {
                        valueToUse = specialParam.getString();
                    }
                }
            }

            if (valueToUse == null) {
                for (String param : parameterNames) {
                    if (valueToUse != null) {
                        break;
                    }
                    if (requirePrefix) {
                        param = SlingPostConstants.ITEM_PREFIX_RELATIVE_CURRENT.concat(param);
                    }
                    final RequestParameter[] pp = parameters.get(param);
                    if (pp != null) {
                        for (RequestParameter p : pp) {
                            valueToUse = p.getString();
                            if (valueToUse != null && valueToUse.length() > 0) {
                                break;
View Full Code Here


                one(set).iterator();
                will(returnValue(params.iterator()));
            }
        });

        final RequestParameterMap map = context.mock(RequestParameterMap.class);
        context.checking(new Expectations() {
            {
                one(map).entrySet();
                will(returnValue(set));
View Full Code Here

    // SLING-1091: If a :name parameter is supplied, the (first) value of this parameter is used unmodified as the name
    //    for the new node. If the name is illegally formed with respect to JCR name requirements, an exception will be
    //    thrown when trying to create the node. The assumption with the :name parameter is, that the caller knows what
    //    he (or she) is supplying and should get the exact result if possible.
    RequestParameterMap parameters = request.getRequestParameterMap();
    RequestParameter specialParam = parameters.getValue(SlingPostConstants.RP_NODE_NAME);
    if ( specialParam != null ) {
        if ( specialParam.getString() != null && specialParam.getString().length() > 0 ) {
            // If the path ends with a *, create a node under its parent, with
            // a generated node name
            basePath = basePath += "/" + specialParam.getString();
View Full Code Here

    protected final Form getPostForm(final String formName,
                               final SlingHttpServletRequest request) {
        final Map<String, String> map = new HashMap<String, String>();


        final RequestParameterMap requestMap = request.getRequestParameterMap();

        for (final String key : requestMap.keySet()) {
            // POST LookupKey formName param does not matter
            if (StringUtils.equals(key, this.getPostLookupKey(null))) {
                continue;
            }

            final RequestParameter[] values = requestMap.getValues(key);

            if (values == null || values.length == 0) {
                log.debug("Value did not exist for key: {}", key);
            } else if (values.length == 1) {
                log.debug("Adding to form data: {} ~> {}", key, values[0].toString());
View Full Code Here

        // these two size properties seem to be necessary to get the size correct
        // in a component dialog
        //widget.put("width", WIDGET_WIDTH);
        //widget.put("height", WIDGET_HEIGHT);

        RequestParameterMap map = request.getRequestParameterMap();
        for (Map.Entry<String, RequestParameter[]> entry : map.entrySet()) {
            String key = entry.getKey();
            RequestParameter[] params = entry.getValue();
            if (params != null) {
                if (params.length > 1) {
                    JSONArray arr = new JSONArray();
View Full Code Here

        // these two size properties seem to be necessary to get the size correct
        // in a component dialog
        widget.put("width", RTE_WIDTH);
        widget.put("height", RTE_HEIGHT);

        RequestParameterMap map = request.getRequestParameterMap();
        for (Map.Entry<String, RequestParameter[]> entry : map.entrySet()) {
            String key = entry.getKey();
            RequestParameter[] params = entry.getValue();
            if (params != null) {
                if (params.length > 1 || EXTERNAL_STYLESHEETS_PROPERTY.equals(key)) {
                    JSONArray arr = new JSONArray();
View Full Code Here

TOP

Related Classes of org.apache.sling.api.request.RequestParameterMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.