Package javax.ws.rs.core

Examples of javax.ws.rs.core.MultivaluedMap


    public void addWorkflowInstanceNode(String workflowInstance,
                                        String nodeId) {
        webResource = getProvenanceRegistryBaseResource().path(
                ResourcePathConstants.ProvenanceResourcePathConstants.ADD_WORKFLOWINSTANCENODE);
        MultivaluedMap formParams = new MultivaluedMapImpl();
        formParams.add("workflowInstanceId", workflowInstance);
        formParams.add("nodeId", nodeId);
        builder = BasicAuthHeaderUtil.getBuilder(
                webResource, null, userName, null, cookie, gateway);

        ClientResponse response = builder.accept(
                MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
View Full Code Here


      // TODO: punt on redirects, for now.
      // if (httpMethod instanceof GetMethod && request.followRedirects())
      // httpMethod.setFollowRedirects(true);
      // else httpMethod.setFollowRedirects(false);

      MultivaluedMap headers = mockHttpRequest.getHttpHeaders().getRequestHeaders();
      headers.putAll(request.getHeaders());
      if (request.getBody() != null && !request.getFormParameters().isEmpty())
         throw new RuntimeException("You cannot send both form parameters and an entity body");

      for (Map.Entry<String, List<String>> formParam : request.getFormParameters().entrySet())
      {
View Full Code Here

      ByteArrayOutputStream baos = new ByteArrayOutputStream();

      MediaType bodyContentType = request.getBodyContentType();
      request.getHeaders().add(HttpHeaders.CONTENT_TYPE, bodyContentType.toString());
      MultivaluedMap mockHeaders = (MultivaluedMap) mockHttpRequest.getHttpHeaders().getRequestHeaders();
      request.writeRequestBody(mockHeaders, baos);

      mockHttpRequest.content(baos.toByteArray());
      mockHttpRequest.contentType(bodyContentType);
   }
View Full Code Here

         if (connection.getRequestProperty(CONTENT_TYPE) == null)
         {
            String type = request.getBodyContentType().toString();
            connection.addRequestProperty(CONTENT_TYPE, type);
         }
         MultivaluedMap headers = new URLConnectionHeaderWrapper(
                 connection, request.getProviderFactory());
         try
         {
            OutputStream os = connection.getOutputStream();
            request.writeRequestBody(headers, os);
View Full Code Here

    @SuppressWarnings("unchecked")
    @Test
    public void testJAXBMarshallingWithMap() throws WebApplicationException, IOException {
        assertTrue(jaxbProviderWriter.isWriteable(AddNumbers.class, null, null, MediaType.TEXT_XML_TYPE));
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        MultivaluedMap map = new CaseInsensitiveMultivaluedMap<Object>();
        jaxbProviderWriter.writeTo(new AddNumbers(), AddNumbers.class, null, null, MediaType.TEXT_XML_TYPE, map, baos);
        assertEquals(expectedXml, baos.toString());
    }
View Full Code Here

    protected RuleChain getChain(String networkId, String accountUuid,
                               String routerName, RuleChainCode chainCode){
        String chainName = getChainName(networkId, routerName, chainCode);

        MultivaluedMap findChain = new MultivaluedMapImpl();
        findChain.add("tenant_id", accountUuid);

        ResourceCollection<RuleChain> ruleChains = api.getChains(findChain);

        for(RuleChain chain : ruleChains){
            if(chain.getName().equals(chainName)){
View Full Code Here

        return netBridge;
    }

    private Bridge getNetworkBridge(long networkID, String accountUuid){

        MultivaluedMap qNetBridge = new MultivaluedMapImpl();
        String networkUUIDStr = String.valueOf(networkID);
        qNetBridge.add("tenant_id", accountUuid);

        for (Bridge b : this. api.getBridges(qNetBridge)) {
            if(b.getName().equals(networkUUIDStr)){
                return b;
            }
View Full Code Here

        return tenantRouter;
    }

    private Router getGuestNetworkRouter(long id, String accountUuid, boolean isVpc){

        MultivaluedMap qNetRouter = new MultivaluedMapImpl();
        String routerName = getRouterName(isVpc, id);

        qNetRouter.add("tenant_id", accountUuid);

        for (Router router : api.getRouters(qNetRouter)) {
            if(router.getName().equals(routerName)){
                return router;
            }
View Full Code Here

            /*
            * grab the tenant id and the network id from the Broadcast URI.
            * We need to pluck the values out of the String. The string
            * should look like "mido://[tenant_id].[bridge_name]"
            */
            MultivaluedMap qNet = new MultivaluedMapImpl();
            String nicAuthority= nic.getBroadcastUri().getAuthority();
            String tenantId = nicAuthority.split("\\.")[0];
            qNet.add("tenant_id", tenantId);
            String url = nicAuthority.split("\\.")[1];
            String netName = url.split(":")[0];

            MidonetApi api = new MidonetApi(_midoApiLocation);
            api.enableLogging();
View Full Code Here

  @SuppressWarnings("unchecked")
  public void noUser() {
    MDC.remove("user");
    HttpRequestContext request = Mockito.mock(HttpRequestContext.class);
    Mockito.when(request.getUserPrincipal()).thenReturn(null);
    MultivaluedMap map = Mockito.mock(MultivaluedMap.class);
    Mockito.when(map.getFirst(UserProvider.USER_NAME_PARAM)).thenReturn(null);
    Mockito.when(request.getQueryParameters()).thenReturn(map);
    HttpContext context = Mockito.mock(HttpContext.class);
    Mockito.when(context.getRequest()).thenReturn(request);
    UserProvider up = new UserProvider();
    assertNull(up.getValue(context));
View Full Code Here

TOP

Related Classes of javax.ws.rs.core.MultivaluedMap

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.