当前位置: 首页>>代码示例>>Java>>正文


Java MimeType类代码示例

本文整理汇总了Java中org.eclipse.che.ide.MimeType的典型用法代码示例。如果您正苦于以下问题:Java MimeType类的具体用法?Java MimeType怎么用?Java MimeType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MimeType类属于org.eclipse.che.ide包,在下文中一共展示了MimeType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findFactory

import org.eclipse.che.ide.MimeType; //导入依赖的package包/类
@Override
public Promise<List<FactoryDto>> findFactory(
    @Nullable Integer skipCount,
    @Nullable Integer maxItems,
    @Nullable List<Pair<String, String>> params) {
  final List<Pair<String, String>> allParams = new LinkedList<>();
  if (params != null) {
    allParams.addAll(params);
  }
  if (maxItems != null) {
    allParams.add(Pair.of("maxItems", maxItems.toString()));
  }
  if (skipCount != null) {
    allParams.add(Pair.of("skipCount", skipCount.toString()));
  }
  return asyncRequestFactory
      .createGetRequest(API_FACTORY_BASE_URL + "find" + queryString(allParams))
      .header(HTTPHeader.ACCEPT, MimeType.APPLICATION_JSON)
      .header(HTTPHeader.CONTENT_TYPE, MimeType.APPLICATION_JSON)
      .loader(loaderFactory.newLoader("Searching factory..."))
      .send(unmarshallerFactory.newListUnmarshaller(FactoryDto.class));
}
 
开发者ID:eclipse,项目名称:che,代码行数:23,代码来源:FactoryServiceClientImpl.java

示例2: getMethodParametersHints

import org.eclipse.che.ide.MimeType; //导入依赖的package包/类
@Override
public Promise<List<MethodParameters>> getMethodParametersHints(
    String projectPath, String fqn, int offset, int lineStartOffset) {
  String url =
      appContext.getWsAgentServerApiEndpoint()
          + "/java/navigation/parameters"
          + "?projectpath="
          + projectPath
          + "&fqn="
          + fqn
          + "&offset="
          + offset
          + "&lineStart="
          + lineStartOffset;

  return requestFactory
      .createGetRequest(url)
      .header(ACCEPT, MimeType.APPLICATION_JSON)
      .loader(loaderFactory.newLoader("Getting parameters..."))
      .send(unmarshallerFactory.newListUnmarshaller(MethodParameters.class));
}
 
开发者ID:eclipse,项目名称:che,代码行数:22,代码来源:JavaNavigationServiceImpl.java

示例3: applyChosenImports

import org.eclipse.che.ide.MimeType; //导入依赖的package包/类
/**
 * Organizes the imports of a compilation unit.
 *
 * @param projectPath path to the project
 * @param fqn fully qualified name of the java file
 */
public Promise<List<Change>> applyChosenImports(
    String projectPath, String fqn, ConflictImportDTO chosen) {
  String url =
      appContext.getWsAgentServerApiEndpoint()
          + CODE_ASSIST_URL_PREFIX
          + "/apply-imports?projectpath="
          + projectPath
          + "&fqn="
          + fqn;
  return asyncRequestFactory
      .createPostRequest(url, chosen)
      .loader(loader)
      .header(CONTENT_TYPE, MimeType.APPLICATION_JSON)
      .send(unmarshallerFactory.newListUnmarshaller(Change.class));
}
 
开发者ID:eclipse,项目名称:che,代码行数:22,代码来源:JavaCodeAssistClient.java

示例4: doCreateRequest

import org.eclipse.che.ide.MimeType; //导入依赖的package包/类
@Override
protected AsyncRequest doCreateRequest(
    RequestBuilder.Method method, String url, Object dtoBody, boolean async) {
  AsyncRequest request = super.doCreateRequest(method, url, dtoBody, async);
  if (!isWsAgentRequest(url) && !keycloakProvider.isKeycloakDisabled()) {
    AsyncRequest asyncRequest = new KeycloakAsyncRequest(keycloakProvider, method, url, async);
    if (dtoBody != null) {
      if (dtoBody instanceof List<?>) {
        asyncRequest.data(dtoFactory.toJson((List<?>) dtoBody));
      } else if (dtoBody instanceof String) {
        asyncRequest.data((String) dtoBody);
      } else {
        asyncRequest.data(dtoFactory.toJson(dtoBody));
      }
      asyncRequest.header(HTTPHeader.CONTENT_TYPE, MimeType.APPLICATION_JSON);
    } else if (method.equals(RequestBuilder.POST) || method.equals(RequestBuilder.PUT)) {

      /*
        Here we need to setup wildcard mime type in content-type header, because CORS filter
        responses with 403 error in case if user makes POST/PUT request with null body and without
        content-type header. Setting content-type header with wildcard mime type solves this problem.
        Note, this issue need to be investigated, because the problem may be occurred as a bug in
        CORS filter.
      */

      asyncRequest.header(HTTPHeader.CONTENT_TYPE, MimeType.WILDCARD);
    }
    return asyncRequest;
  }
  return request;
}
 
开发者ID:eclipse,项目名称:che,代码行数:32,代码来源:KeycloakAsyncRequestFactory.java

示例5: doCreateRequest

import org.eclipse.che.ide.MimeType; //导入依赖的package包/类
/**
 * Creates new HTTP request to the specified {@code url}.
 *
 * @param method request method
 * @param url request URL
 * @param dtoBody the DTO to send as body of the request. Must implement {@link JsonSerializable}
 *     interface or contain objects that implement it. May be {@code null}.
 * @param async if <b>true</b> - request will be sent in asynchronous mode
 * @return new {@link AsyncRequest} instance to send POST request
 * @throws NullPointerException in case if request {@code method} is {@code null}, reason
 *     includes:
 *     <ul>
 *       <li>Request method should not be a null
 *     </ul>
 */
protected AsyncRequest doCreateRequest(
    RequestBuilder.Method method, String url, Object dtoBody, boolean async) {
  Preconditions.checkNotNull(method, "Request method should not be a null");

  AsyncRequest asyncRequest = newAsyncRequest(method, url, async);
  if (dtoBody != null) {
    if (dtoBody instanceof List) {
      asyncRequest.data(dtoFactory.toJson((List) dtoBody));
    } else if (dtoBody instanceof String) {
      asyncRequest.data((String) dtoBody);
    } else {
      asyncRequest.data(dtoFactory.toJson(dtoBody));
    }
    asyncRequest.header(HTTPHeader.CONTENT_TYPE, DTO_CONTENT_TYPE);
  } else if (method.equals(RequestBuilder.POST) || method.equals(RequestBuilder.PUT)) {

    /*
      Here we need to setup wildcard mime type in content-type header, because CORS filter
      responses with 403 error in case if user makes POST/PUT request with null body and without
      content-type header. Setting content-type header with wildcard mime type solves this problem.

      Note, this issue need to be investigated, because the problem may be occurred as a bug in
      CORS filter.
    */

    asyncRequest.header(HTTPHeader.CONTENT_TYPE, MimeType.WILDCARD);
  }
  return asyncRequest;
}
 
开发者ID:eclipse,项目名称:che,代码行数:45,代码来源:AsyncRequestFactory.java

示例6: ClipboardButtonBuilderImpl

import org.eclipse.che.ide.MimeType; //导入依赖的package包/类
@Inject
public ClipboardButtonBuilderImpl(ZeroClipboardResources res, ZeroClipboardConstant locale) {
  this.res = res;
  promptReadyToCopy = locale.promptReadyToCopy();
  promptAfterCopy = locale.promptAfterCopy();
  promptCopyError = locale.promptCopyError();
  promptReadyToSelect = locale.promptReadyToSelect();
  mimeType = MimeType.TEXT_PLAIN;
}
 
开发者ID:eclipse,项目名称:che,代码行数:10,代码来源:ClipboardButtonBuilderImpl.java

示例7: getProjects

import org.eclipse.che.ide.MimeType; //导入依赖的package包/类
/**
 * Returns the projects list. If there is no projects were found on server, empty list is
 * returned.
 *
 * @return {@link Promise} with list of project configuration
 * @see ProjectConfigDto
 * @since 4.4.0
 */
public Promise<List<ProjectConfigDto>> getProjects() {
  final String url = getBaseUrl();

  return reqFactory
      .createGetRequest(url)
      .header(ACCEPT, MimeType.APPLICATION_JSON)
      .send(unmarshaller.newListUnmarshaller(ProjectConfigDto.class));
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:ProjectServiceClient.java

示例8: fetchProjectImporters

import org.eclipse.che.ide.MimeType; //导入依赖的package包/类
/** Fetch project importers from the server. */
private void fetchProjectImporters(AsyncRequestCallback<ProjectImporterData> callback) {
  asyncRequestFactory
      .createGetRequest(appContext.getWsAgentServerApiEndpoint() + "/project-importers")
      .header(HTTPHeader.CONTENT_TYPE, MimeType.APPLICATION_JSON)
      .send(callback);
}
 
开发者ID:eclipse,项目名称:che,代码行数:8,代码来源:MainPagePresenter.java

示例9: getFactory

import org.eclipse.che.ide.MimeType; //导入依赖的package包/类
/**
 * Get valid JSON factory object based on input factory ID
 *
 * @param factoryId factory ID to retrieve
 * @param validate indicates whether or not factory should be validated by accept validator
 * @return Factory through a Promise
 */
@Override
public Promise<FactoryDto> getFactory(@NotNull String factoryId, boolean validate) {
  StringBuilder url = new StringBuilder(API_FACTORY_BASE_URL).append(factoryId);
  if (validate) {
    url.append("?").append("validate=true");
  }
  return asyncRequestFactory
      .createGetRequest(url.toString())
      .header(HTTPHeader.ACCEPT, MimeType.APPLICATION_JSON)
      .send(unmarshallerFactory.newUnmarshaller(FactoryDto.class));
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:FactoryServiceClientImpl.java

示例10: getFactoryJson

import org.eclipse.che.ide.MimeType; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void getFactoryJson(
    String workspaceId, String path, AsyncRequestCallback<FactoryDto> callback) {
  final StringBuilder url =
      new StringBuilder(API_FACTORY_BASE_URL + "workspace/").append(workspaceId);
  if (path != null) {
    url.append("?path=").append(path);
  }
  asyncRequestFactory
      .createGetRequest(url.toString())
      .header(HTTPHeader.ACCEPT, MimeType.APPLICATION_JSON)
      .loader(loaderFactory.newLoader("Getting info about factory..."))
      .send(callback);
}
 
开发者ID:eclipse,项目名称:che,代码行数:16,代码来源:FactoryServiceClientImpl.java

示例11: saveFactory

import org.eclipse.che.ide.MimeType; //导入依赖的package包/类
@Override
public Promise<FactoryDto> saveFactory(@NotNull FactoryDto factory) {
  return asyncRequestFactory
      .createPostRequest(API_FACTORY_BASE_URL, factory)
      .header(HTTPHeader.ACCEPT, MimeType.APPLICATION_JSON)
      .header(HTTPHeader.CONTENT_TYPE, MimeType.APPLICATION_JSON)
      .loader(loaderFactory.newLoader("Creating factory..."))
      .send(unmarshallerFactory.newUnmarshaller(FactoryDto.class));
}
 
开发者ID:eclipse,项目名称:che,代码行数:10,代码来源:FactoryServiceClientImpl.java

示例12: updateFactory

import org.eclipse.che.ide.MimeType; //导入依赖的package包/类
@Override
public Promise<FactoryDto> updateFactory(String id, FactoryDto factory) {
  return asyncRequestFactory
      .createRequest(RequestBuilder.PUT, API_FACTORY_BASE_URL + id, factory, false)
      .header(HTTPHeader.CONTENT_TYPE, MimeType.APPLICATION_JSON)
      .loader(loaderFactory.newLoader("Updating factory..."))
      .send(unmarshallerFactory.newUnmarshaller(FactoryDto.class));
}
 
开发者ID:eclipse,项目名称:che,代码行数:9,代码来源:FactoryServiceClientImpl.java

示例13: getPair

import org.eclipse.che.ide.MimeType; //导入依赖的package包/类
/**
 * Gets ssh pair of given service and specific name
 *
 * @param service the service name
 * @param name the identifier of one the pair
 */
@Override
public Promise<SshPairDto> getPair(String service, String name) {
  return asyncRequestFactory
      .createGetRequest(sshApi + "/" + service + FIND + "?name=" + name)
      .header(HTTPHeader.ACCEPT, MimeType.APPLICATION_JSON)
      .send(unmarshallerFactory.newUnmarshaller(SshPairDto.class));
}
 
开发者ID:eclipse,项目名称:che,代码行数:14,代码来源:SshServiceClientImpl.java

示例14: getPairs

import org.eclipse.che.ide.MimeType; //导入依赖的package包/类
@Override
public Promise<List<SshPairDto>> getPairs(String service) {
  return asyncRequestFactory
      .createGetRequest(sshApi + "/" + service)
      .header(HTTPHeader.ACCEPT, MimeType.APPLICATION_JSON)
      .send(unmarshallerFactory.newListUnmarshaller(SshPairDto.class));
}
 
开发者ID:eclipse,项目名称:che,代码行数:8,代码来源:SshServiceClientImpl.java

示例15: generatePair

import org.eclipse.che.ide.MimeType; //导入依赖的package包/类
@Override
public Promise<SshPairDto> generatePair(String service, String name) {
  return asyncRequestFactory
      .createPostRequest(
          sshApi + "/generate",
          dtoFactory.createDto(GenerateSshPairRequest.class).withService(service).withName(name))
      .header(HTTPHeader.ACCEPT, MimeType.APPLICATION_JSON)
      .send(unmarshallerFactory.newUnmarshaller(SshPairDto.class));
}
 
开发者ID:eclipse,项目名称:che,代码行数:10,代码来源:SshServiceClientImpl.java


注:本文中的org.eclipse.che.ide.MimeType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。