create a targetMetaRequest instance.

@param containerWrapper
@param targetMetaDef
@param request
@return
962331
public void createTargetMetaRequest(TargetMetaDef targetMetaDef, ContextHolder holder) {
		ContainerWrapper containerWrapper = servletContainerFinder.findContainer(holder.getAppContextHolder());
		// get HttpSessionVisitorFactoryImp
		VisitorFactory visitorFactory = (VisitorFactory) containerWrapper.lookup(ComponentKeys.VISITOR_FACTORY);
		// ComponentVisitor is HttpSessionComponentVisitor
		ComponentVisitor cm = visitorFactory.createtVisitor(holder.getSessionHolder(), targetMetaDef);
		TargetMetaRequest targetMetaRequest = new TargetMetaRequest(targetMetaDef, cm);
		targetMetaRequestsHolder.setTargetMetaRequest(targetMetaRequest);
	}
264778
private WebTarget createWebTarget(String restPath, Map<String, String> queryParams) {
		WebTarget webTarget;
		try {
			URI u = new URI(this.baseURI + "/plugins/restapi/v1/" + restPath);
			Client client = createRestClient();

			webTarget = client.target(u);
			if (queryParams != null && !queryParams.isEmpty()) {
				for (Map.Entry<String, String> entry : queryParams.entrySet()) {
					if (entry.getKey() != null && entry.getValue() != null) {
						LOG.debug("PARAM: {} = {}", entry.getKey(), entry.getValue());
						webTarget = webTarget.queryParam(entry.getKey(), entry.getValue());
					}
				}
			}

		} catch (Exception e) {
			throw new IllegalArgumentException("Something went wrong by creating the client: " + e);
		}

		return webTarget;
	}
166243
static NeutronApi neutronApi( Map<String,String> targetProperties ) throws TargetException {

		validate( targetProperties );
		return ContextBuilder
				.newBuilder( PROVIDER_NEUTRON )
				.endpoint( targetProperties.get( API_URL ))
				.credentials( identity( targetProperties ), targetProperties.get( PASSWORD ))
				.buildApi( NeutronApi.class );
	}
1032573
protected void addPortletUrlData(
            final HttpServletRequest request,
            final UrlStringBuilder url,
            final UrlType urlType,
            final IPortletUrlBuilder portletUrlBuilder,
            final IPortletWindowId targetedPortletWindowId,
            final boolean statelessUrl) {

        final IPortletWindowId portletWindowId = portletUrlBuilder.getPortletWindowId();
        final boolean targeted = portletWindowId.equals(targetedPortletWindowId);

        IPortletWindow portletWindow = null;

        // The targeted portlet doesn't need namespaced parameters
        final String prefixedPortletWindowId;
        final String suffixedPortletWindowId;
        // Track whether or not we are adding parameters to the URL for non-targeted or delegate
        // portlets.
        boolean addedNonTargetedPortletParam = false;
        if (targeted) {
            prefixedPortletWindowId = "";
            suffixedPortletWindowId = "";
        } else {
            final String portletWindowIdStr = portletWindowId.toString();
            prefixedPortletWindowId = SEPARATOR + portletWindowIdStr;
            suffixedPortletWindowId = portletWindowIdStr + SEPARATOR;

            // targeted portlets can never be delegates (it is always the top most parent that is
            // targeted)
            portletWindow = this.portletWindowRegistry.getPortletWindow(request, portletWindowId);
            final IPortletWindowId delegationParentId = portletWindow.getDelegationParentId();
            if (delegationParentId != null) {
                url.addParameter(
                        PARAM_DELEGATE_PARENT + prefixedPortletWindowId,
                        delegationParentId.getStringId());
                addedNonTargetedPortletParam = true;
            }
        }

        switch (urlType) {
            case RESOURCE:
                {
                    final String cacheability = portletUrlBuilder.getCacheability();
                    if (cacheability != null) {
                        url.addParameter(
                                PARAM_CACHEABILITY + prefixedPortletWindowId, cacheability);
                        addedNonTargetedPortletParam =
                                !targeted ? true : addedNonTargetedPortletParam;
                    }

                    final String resourceId = portletUrlBuilder.getResourceId();
                    if (!targeted && resourceId != null) {
                        url.addParameter(PARAM_RESOURCE_ID + prefixedPortletWindowId, resourceId);
                        // We know we are !targeted, but kept the assignement consistent with the
                        // other similar
                        // assignments for clarity.
                        addedNonTargetedPortletParam =
                                !targeted ? true : addedNonTargetedPortletParam;
                    }

                    break;
                }
            default:
                {
                    // Add requested portlet mode
                    final PortletMode portletMode = portletUrlBuilder.getPortletMode();
                    if (portletMode != null) {
                        url.addParameter(
                                PARAM_PORTLET_MODE + prefixedPortletWindowId,
                                portletMode.toString());
                        addedNonTargetedPortletParam =
                                !targeted ? true : addedNonTargetedPortletParam;
                    } else if (targeted && statelessUrl) {
                        portletWindow =
                                portletWindow != null
                                        ? portletWindow
                                        : this.portletWindowRegistry.getPortletWindow(
                                                request, portletWindowId);
                        final PortletMode currentPortletMode = portletWindow.getPortletMode();
                        url.addParameter(
                                PARAM_PORTLET_MODE + prefixedPortletWindowId,
                                currentPortletMode.toString());
                        // We know we are targeted, but kept the assignement consistent with the
                        // other similar
                        // assignments for clarity. Will always be a nop.
                        addedNonTargetedPortletParam =
                                !targeted ? true : addedNonTargetedPortletParam;
                    }

                    // Add requested window state if it isn't included on the path
                    final WindowState windowState = portletUrlBuilder.getWindowState();
                    if (windowState != null
                            && (!targeted || !PATH_WINDOW_STATES.contains(windowState))) {
                        url.addParameter(
                                PARAM_WINDOW_STATE + prefixedPortletWindowId,
                                windowState.toString());
                        addedNonTargetedPortletParam =
                                !targeted ? true : addedNonTargetedPortletParam;
                    }

                    break;
                }
        }

        if (portletUrlBuilder.getCopyCurrentRenderParameters()) {
            url.addParameter(PARAM_COPY_PARAMETERS + suffixedPortletWindowId);
            addedNonTargetedPortletParam = !targeted ? true : addedNonTargetedPortletParam;
        }

        final Map<String, String[]> parameters = portletUrlBuilder.getParameters();
        if (!parameters.isEmpty()) {
            url.addParametersArray(PORTLET_PARAM_PREFIX + suffixedPortletWindowId, parameters);
            addedNonTargetedPortletParam = !targeted ? true : addedNonTargetedPortletParam;
        }

        // UP-4566 If we have added a portlet parameter for a non-targeted (or delegate) portlet add
        // in the
        // additional-portlet parameter to aid in URL parsing later on.  Among other things the
        // practical impact
        // of this is when we do a search which sends an event to all porlets the user has access to
        // which adds a
        // bunch of portletUrlBuilders to the request, we don't add a bunch of unnecessary &PCa
        // parameters to the
        // URL since there are no parameters actually being passed to the searched portlets.
        if (addedNonTargetedPortletParam) {
            url.addParameter(PARAM_ADDITIONAL_PORTLET, portletWindowId.toString());
        }
    }
896017
public GitlabMergeRequest createMergeRequest(Serializable projectId, String sourceBranch, String targetBranch,
                                                 Integer assigneeId, String title) throws IOException {

        Query query = new Query()
                .appendIf("target_branch", targetBranch)
                .appendIf("source_branch", sourceBranch)
                .appendIf("assignee_id", assigneeId)
                .appendIf("title", title);

        String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + GitlabMergeRequest.URL + query.toString();

        return dispatch().to(tailUrl, GitlabMergeRequest.class);
    }
1221187
private Collection<RequestMapperBean> initializeRequestMappers(final Request request)
	{
		final Set<RequestMapperBean> mapperBeans = new TreeSet<>(getComparator());
		for (final IRequestMapper requestMapper : this.requestMappers)
		{
			mapperBeans.add(
				new RequestMapperBean(requestMapper, requestMapper.getCompatibilityScore(request)));
		}
		return mapperBeans;
	}
1359660
public Nfs3SetAttrResponse wrapped_setAttr(NfsSetAttrRequest request) throws IOException {
        NfsResponseHandler<Nfs3SetAttrResponse> responseHandler = new NfsResponseHandler<Nfs3SetAttrResponse>() {

            /* (non-Javadoc)
             * @see com.emc.ecs.nfsclient.rpc.RpcResponseHandler#makeNewResponse()
             */
            protected Nfs3SetAttrResponse makeNewResponse() {
                return new Nfs3SetAttrResponse();
            }

        };
        _rpcWrapper.callRpcWrapped(request, responseHandler);
        return responseHandler.getResponse();
    }
1087378
@Override
	public void handleRequest(final Request request) {
		super.handleRequest(request);

		// Check if window in request
		boolean targeted = isPresent(request);
		setTargeted(targeted);

		if (getState() == ACTIVE_STATE && isTargeted()) {
			getComponentModel().wrappedContent.serviceRequest(request);
		}
	}
932333
public RequestTemplate target(String target) {
    /* target can be empty */
    if (Util.isBlank(target)) {
      return this;
    }

    /* verify that the target contains the scheme, host and port */
    if (!UriUtils.isAbsolute(target)) {
      throw new IllegalArgumentException("target values must be absolute.");
    }
    if (target.endsWith("/")) {
      target = target.substring(0, target.length() - 1);
    }
    try {
      /* parse the target */
      URI targetUri = URI.create(target);

      if (Util.isNotBlank(targetUri.getRawQuery())) {
        /*
         * target has a query string, we need to make sure that they are recorded as queries
         */
        this.extractQueryTemplates(targetUri.getRawQuery(), true);
      }

      /* strip the query string */
      this.target = targetUri.getScheme() + "://" + targetUri.getAuthority() + targetUri.getPath();
      if (targetUri.getFragment() != null) {
        this.fragment = "#" + targetUri.getFragment();
      }
    } catch (IllegalArgumentException iae) {
      /* the uri provided is not a valid one, we can't continue */
      throw new IllegalArgumentException("Target is not a valid URI.", iae);
    }
    return this;
  }
264535
protected HttpServletRequest processMultipart( HttpServletRequest request )
    {
        if ( ! "POST".equalsIgnoreCase( request.getMethod() ) ) return request;

        String contentType = request.getContentType();
        if ( contentType != null && contentType.startsWith( "multipart/form-data" ) )
        {
            PageFlowRequestWrapper pageFlowRequestWrapper = PageFlowRequestWrapper.get( request );

            //
            // We may have already gotten a multipart wrapper during process().  If so, use that.
            //
            MultipartRequestWrapper cachedWrapper = pageFlowRequestWrapper.getMultipartRequestWrapper();

            if ( cachedWrapper != null && cachedWrapper.getRequest() == request ) return cachedWrapper;

            try
            {
                //
                // First, pre-handle the multipart request.  This parses the stream and caches a single
                // MultipartRequestHandler in the outer request, so we can create new wrappers around it at will.
                //
                MultipartRequestUtils.preHandleMultipartRequest( request );
            }
            catch ( ServletException e )
            {
                LOG.error( "Could not parse multipart request.", e.getRootCause() );
                return request;
            }

            MultipartRequestWrapper ret = new RehydratedMultipartRequestWrapper( request );
            pageFlowRequestWrapper.setMultipartRequestWrapper( ret );
            return ret;
        }
        else
        {
            return request;
        }

    }
663403
public SetDomainCacheTTLResponse setDomainCacheTTL(SetDomainCacheTTLRequest request) {
        checkNotNull(request, "The parameter request should NOT be null.");
        InternalRequest internalRequest = createRequest(request, HttpMethodName.PUT, DOMAIN, request.getDomain(), "config");
        internalRequest.addParameter("cacheTTL","");
        this.attachRequestToBody(request, internalRequest);
        return invokeHttpClient(internalRequest, SetDomainCacheTTLResponse.class);
    }
252133
public static DockerClient createDockerClient( Map<String,String> targetProperties ) throws TargetException {

		// Validate what needs to be validated.
		Logger logger = Logger.getLogger( DockerHandler.class.getName());
		logger.fine( "Setting the target properties." );

		String edpt = targetProperties.get( DockerHandler.ENDPOINT );
		if( Utils.isEmptyOrWhitespaces( edpt ))
			edpt = DockerHandler.DEFAULT_ENDPOINT;

		// The configuration is straight-forward.
		Builder config =
				DefaultDockerClientConfig.createDefaultConfigBuilder()
				.withDockerHost( edpt )
				.withRegistryUsername( targetProperties.get( DockerHandler.USER ))
				.withRegistryPassword( targetProperties.get( DockerHandler.PASSWORD ))
				.withRegistryEmail( targetProperties.get( DockerHandler.EMAIL ))
				.withApiVersion( targetProperties.get( DockerHandler.VERSION ));

		// Build the client.
		DockerClientBuilder clientBuilder = DockerClientBuilder.getInstance( config.build());

		return clientBuilder.build();
	}
973204
public static Map<String, Object> getParametersMap(ContainerRequestContext requestContext,HttpServletRequest request)
			throws IOException {
		
		if(isMultipartContent(request)){
			return buildQueryParamsMap(request);
		}
		
		Map<String, Object> parameters = buildQueryParamsMap(request);
		
		if (RestConst.GET_METHOD.equals(request.getMethod())) {
			return parameters;
		}else if (RestConst.POST_METHOD.equals(request.getMethod())) {
			
			byte[] byteArray = IOUtils.toByteArray(requestContext.getEntityStream());
			//reset InputStream
			requestContext.setEntityStream(new ByteArrayInputStream(byteArray));
			
			if(byteArray == null || byteArray.length == 0)return parameters;
			String content = new String(byteArray);
			//JSON 
//			try {
//				return JsonUtils.toObject(content, Map.class);
//			} catch (Exception e) {}
			if(content.contains("{")){
				content = StringUtils.left(content, 2048).trim();
				if(!content.endsWith("}"))content = content + "...\n}";
				parameters.put("data", content);
				return parameters;
			}
			
			String[] split = content.split("\\&");
			for (String s : split) {
				String[] split2 = s.split("=");
				if (split2.length == 2 && StringUtils.isNotBlank(split2[1])) {
					parameters.put(split2[0], split2[1]);
				}
			}
			return parameters;
		
		}
		return null;
	}
157360
public void addMappingTarget(String mapping, RequestProcessor target) throws Exception {
        this.requestMapper.addMapping(mapping, target);
    }
591045
@Override
    public T addAsManifestResource(File resource, ArchivePath target) throws IllegalArgumentException {
        Validate.notNull(resource, "Resource should be specified");
        Validate.notNull(target, "Target should be specified");

        if (resource.isFile()) {
            return addAsManifestResource(new FileAsset(resource), target);
        }

        final File[] files = resource.listFiles();

        // SHRINKWRAP-275, resource URL coming in from a JAR
        if (files == null) {
            return this.addNestedJarFileResource(resource, target, this.getManifestPath());
        }

        if (files.length == 0) {
            return addAsManifestResource(new FileAsset(resource), target);
        }

        for (File file : resource.listFiles()) {
            ArchivePath child = ArchivePaths.create(file.getName());
            addAsManifestResource(file, new BasicPath(target, child));
        }
        return covarientReturn();
    }
1318430
@RequestMapping(
            headers = {"org.apereo.portal.url.UrlType=ACTION"},
            method = RequestMethod.POST)
    public void actionRequest(HttpServletRequest request, HttpServletResponse response)
            throws IOException {

        final IPortalRequestInfo portalRequestInfo =
                this.urlSyntaxProvider.getPortalRequestInfo(request);
        final IPortletRequestInfo portletRequestInfo =
                portalRequestInfo.getTargetedPortletRequestInfo();

        final IPortalUrlBuilder actionRedirectUrl;
        if (portletRequestInfo != null) {
            final IPortletWindowId targetWindowId = portletRequestInfo.getPortletWindowId();
            actionRedirectUrl =
                    this.portalUrlProvider.getPortalUrlBuilderByPortletWindow(
                            request, targetWindowId, UrlType.RENDER);
        } else {
            final String targetedLayoutNodeId = portalRequestInfo.getTargetedLayoutNodeId();

            if (targetedLayoutNodeId != null) {
                actionRedirectUrl =
                        this.portalUrlProvider.getPortalUrlBuilderByLayoutNode(
                                request, targetedLayoutNodeId, UrlType.RENDER);
            } else {
                actionRedirectUrl = this.portalUrlProvider.getDefaultUrl(request);
            }
        }

        // Stuff the action-redirect URL builder into the request so other code can use it during
        // request processing
        this.portalUrlProvider.convertToPortalActionUrlBuilder(request, actionRedirectUrl);

        if (portletRequestInfo != null) {
            final IPortletWindowId targetWindowId = portletRequestInfo.getPortletWindowId();

            try {
                this.portletExecutionManager.doPortletAction(targetWindowId, request, response);
            } catch (RuntimeException e) {
                this.logger.error(
                        "Exception thrown while executing portlet action for: "
                                + portletRequestInfo,
                        e);

                // TODO this should be a constant right?
                actionRedirectUrl.setParameter("portletActionError", targetWindowId.toString());
            }
        }

        sendRedirect(actionRedirectUrl, response);
    }
802329
private void setSessionContext(Object targetObject, TargetMetaRequest targetMetaRequest) {
		if (isSessionContextAcceptables.contains(targetMetaRequest.getTargetMetaDef().getName())) {
			SessionContextAcceptable myResult = (SessionContextAcceptable) targetObject;
			SessionContext sessionContext = targetMetaRequest.getSessionContext();
			myResult.setSessionContext(sessionContext);
		} else if (isSessionContextAcceptablesAnnotations.containsKey(targetMetaRequest.getTargetMetaDef().getName())) {
			Method method = isSessionContextAcceptablesAnnotations.get(targetMetaRequest.getTargetMetaDef().getName());
			try {
				Object[] sessionContexts = new SessionContext[1];
				sessionContexts[0] = targetMetaRequest.getSessionContext();
				method.invoke(targetObject, sessionContexts);
			} catch (Exception e) {
				Debug.logError("[JdonFramework]the target must has method setSessionContext(SessionContext sessionContext) : " + e, module);
			}

		}
	}