當前位置: 首頁>>代碼示例>>Java>>正文


Java StatusType類代碼示例

本文整理匯總了Java中com.google.visualization.datasource.base.StatusType的典型用法代碼示例。如果您正苦於以下問題:Java StatusType類的具體用法?Java StatusType怎麽用?Java StatusType使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


StatusType類屬於com.google.visualization.datasource.base包,在下文中一共展示了StatusType類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doGet

import com.google.visualization.datasource.base.StatusType; //導入依賴的package包/類
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
    throws IOException {
  DataTable data = generateMyDataTable();
  DataSourceRequest dsRequest = null;

  try {
    // Extract the datasource request parameters.
    dsRequest = new DataSourceRequest(req);

    // NOTE: If you want to work in restricted mode, which means that only
    // requests from the same domain can access the data source, uncomment the following call.
    //
    // DataSourceHelper.verifyAccessApproved(dsRequest);

    // Apply the query to the data table.
    DataTable newData = DataSourceHelper.applyQuery(dsRequest.getQuery(), data,
        dsRequest.getUserLocale());

    // Set the response.
    DataSourceHelper.setServletResponse(newData, dsRequest, resp);
  } catch (RuntimeException rte) {
    log.error("A runtime exception has occured", rte);
    ResponseStatus status = new ResponseStatus(StatusType.ERROR, ReasonType.INTERNAL_ERROR,
        rte.getMessage());
    if (dsRequest == null) {
      dsRequest = DataSourceRequest.getDefaultDataSourceRequest(req);
    }
    DataSourceHelper.setServletErrorResponse(status, dsRequest, resp);
  } catch (DataSourceException e) {
    if (dsRequest != null) {
      DataSourceHelper.setServletErrorResponse(e, dsRequest, resp);
    } else {
      DataSourceHelper.setServletErrorResponse(e, req, resp);
    }
  }
}
 
開發者ID:dzxdzx1987,項目名稱:GoogleCharts,代碼行數:38,代碼來源:SimpleExampleServlet2.java

示例2: retrieveFeed

import com.google.visualization.datasource.base.StatusType; //導入依賴的package包/類
@Override
public Feed retrieveFeed(RequestContext request) throws FeedServerAdapterException {
  String tq = null;
  String tqh = null;
  String tqx = null;
  String out = null;

  if (request != null) {
    out = request.getParameter(PARAMETER_OUTPUT);
    tq = request.getParameter(PARAMETER_TQ);
    tqh = request.getParameter(PARAMETER_TQH);
    tqx = request.getParameter(PARAMETER_TQX);
  }

  if (!"gviz".equalsIgnoreCase(out)) {
    return super.retrieveFeed(request);
  }
  
  FeedInfo feedInfo = getFeedInfo(request);
  if (feedInfo == null) {
    throw new FeedServerAdapterException(Reason.ADAPTER_CONFIGURATION_NOT_CORRECT,
    "Missing feed info in configuration");
  }
  Feed dataFeed = super.retrieveFeed(request);

  DataTable dataTable = null;
  DataSourceParameters dataSourceParameters = null;
  String response = null;
  try {
    dataTable = getDataTable(dataFeed, feedInfo);
    Query query = DataSourceHelper.parseQuery(tq);
    dataTable = DataSourceHelper.applyQuery(query, dataTable, ULocale.getDefault());
    dataSourceParameters = new DataSourceParameters(tqx);
    response = JsonRenderer.renderJsonResponse(
        dataSourceParameters,
        new ResponseStatus(StatusType.OK),
        dataTable,
        true).toString();
  } catch (DataSourceException e) {
    response = JsonRenderer.renderJsonResponse(dataSourceParameters,
        ResponseStatus.getModifiedResponseStatus(ResponseStatus.createResponseStatus(e)),
        null, true).toString();
  }
  return generateGVizOutput(response);       
}
 
開發者ID:jyang,項目名稱:google-feedserver,代碼行數:46,代碼來源:GVizWrapper.java

示例3: doGet

import com.google.visualization.datasource.base.StatusType; //導入依賴的package包/類
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
  DataSourceRequest dsRequest = null;

  try {
    // Extract the request parameters.
    dsRequest = new DataSourceRequest(req);

    // NOTE: If you want to work in restricted mode, which means that only
    // requests from the same domain can access the data source, you should
    // uncomment the following call.
    //
    // DataSourceHelper.verifyAccessApproved(dsRequest);

    // Split the query.
    QueryPair query = DataSourceHelper.splitQuery(dsRequest.getQuery(), Capabilities.SELECT);

    // Generate the data table.
    DataTable data = generateMyDataTable(query.getDataSourceQuery(), req);

    // Apply the completion query to the data table.
    DataTable newData = DataSourceHelper.applyQuery(query.getCompletionQuery(), data,
        dsRequest.getUserLocale());

    DataSourceHelper.setServletResponse(newData, dsRequest, resp);
  } catch (RuntimeException rte) {
    log.error("A runtime exception has occured", rte);
    ResponseStatus status = new ResponseStatus(StatusType.ERROR, ReasonType.INTERNAL_ERROR,
        rte.getMessage());
    if (dsRequest == null) {
      dsRequest = DataSourceRequest.getDefaultDataSourceRequest(req);
    }
    DataSourceHelper.setServletErrorResponse(status, dsRequest, resp);
  } catch (DataSourceException e) {
    if (dsRequest != null) {
      DataSourceHelper.setServletErrorResponse(e, dsRequest, resp);
    } else {
      DataSourceHelper.setServletErrorResponse(e, req, resp);
    }
  }
}
 
開發者ID:dzxdzx1987,項目名稱:GoogleCharts,代碼行數:42,代碼來源:AdvancedExampleServlet2.java


注:本文中的com.google.visualization.datasource.base.StatusType類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。