Package com.esri.gpt.catalog.discovery.rest

Examples of com.esri.gpt.catalog.discovery.rest.RestQuery


    super.execute(request, response, context);
  }
 
  @Override
  protected RestQuery parseRequest(HttpServletRequest request, RequestContext context) {
    RestQuery query = new RestQuery();
    RestQueryParser parser = new ErosQueryParser(request,context,query,defaultParameters);
  
    parser.parseResponseFormat("f");
    String requestURI = Val.chkStr(request.getRequestURI());
    if (requestURI.toLowerCase().endsWith("/sitemap")) {
      String tmp = Val.chkStr(query.getResponseFormat());
      if (tmp.length() == 0) {
        query.setResponseFormat("sitemap");
      }
    }
   
    parser.parseRepositoryId("rid");
    parser.parseResponseFormat("f");
View Full Code Here


 
  RequestContext rc = null;
  try {
      // rc = RequestContext.extract(this.getSearchContext().getHttpRequest());
    rc = this.getSearchContext().getRequestContext();
    RestQuery query = this.getSearchContext().getRestQuery();

    SearchStatus status = this.getSearchStatus();
    status.setStartTimestamp(new Timestamp(System.currentTimeMillis()));
  
    if (this.isTimeUp()) {
View Full Code Here

public class CustomRestQueryServlet extends RestQueryServlet {
private static String REST_PARAM_KEY1 = "hierarchy";
//Relate the rest queryable to the CSW queryables
protected RestQuery parseRequest(HttpServletRequest request, RequestContext context) {
Logger LOG = Logger.getLogger(RestQuery.class.getCanonicalName());
  RestQuery query = super.parseRequest(request, context);
RestQueryParser parser = new RestQueryParser(request,context,query);
// "hierarchy" will be the name of the rest queryable
parser.parsePropertyIsLike(REST_PARAM_KEY1, "apiso.Type");
/** The below is shown as an example
parser.parseRepositoryId("rid");
View Full Code Here

  MessageBroker msgBroker = new FacesContextBroker(request, response)
      .extractMessageBroker();

  // parse the query
  RestQuery query = null;
  PrintWriter printWriter = null;

 
  try {
  
    query = parseRequest(request, context);
    if (query == null)
      query = new RestQuery();
    this.executeQuery(request, response, context, msgBroker, query);
     
  } catch (Exception e) {
    LOG.log(Level.SEVERE, "Error executing query.", e);
    String msg = Val.chkStr(e.getMessage());
View Full Code Here

        extraMap.put(PARAM_KEY_SHOW_THUMBNAIL, "false");
      }
    }

    // parse the query
    RestQuery query = null;
    try {
      query = parseRequest(request, context);
    } catch (Throwable t) {
      getLogger().log(Level.SEVERE, "Error parsing request.", t);
    }
    if (query == null) {
      query = new RestQuery();
    }


    // establish the response content type, print writer and feed writer
    RestQueryServlet.ResponseFormat format = getResponseFormat(request, query);
    String sFormat = getRequestParameter(request, "f");
    FeedWriter2 feedWriter2 = WriterFactory.createWriter(
            sFormat, msgBroker, query, request, response, context);
    FeedWriter feedWriter = null;
    PrintWriter printWriter = null;
    if (feedWriter2 != null) {
      feedWriter = (FeedWriter) feedWriter2;
    } else {
      this.setResponseContentType(request, response, query);
      printWriter = response.getWriter();
      feedWriter = makeFeedWriter(request, context, printWriter, msgBroker, query);
    }
    // execute the query, write the response
    try {
      if (format == RestQueryServlet.ResponseFormat.xjson) {
        String callback = request.getParameter("callback");
        if (callback != null) {
          printWriter.print(callback + "(");
        }

        // init query
        query.setReturnables(new CoreQueryables(context).getFull());
        toSearchCriteria(request, context, query);
       
       
        feedWriter.write(JsonSearchEngine.createInstance().search(request, response, context, query));

        if (callback != null) {
          printWriter.print(")");
        }

      }else if (format == RestQueryServlet.ResponseFormat.dcat) {
       
        String callback = request.getParameter("callback");
        if (callback != null) {
          printWriter.print(callback + "(");
        }
       
        // The following part of the code has been disabled since DCAT content
        // is being cached.
        query.setReturnables(new CoreQueryables(context).getFull());
        toSearchCriteria(request, context, query);
        feedWriter.write(DcatJsonSearchEngine.createInstance().search(request, response, context, query));

        if (callback != null) {
          printWriter.print(")");
View Full Code Here

   * @param request the HTTP request
   * @param context the request context
   * @return the populated rest query
   */
  protected RestQuery parseRequest(HttpServletRequest request, RequestContext context) {
    RestQuery query = new RestQuery();
    RestQueryParser parser = new RestQueryParser(request, context, query);

    parser.parseResponseFormat("f");
    String requestURI = Val.chkStr(request.getRequestURI());
    if (requestURI.toLowerCase().endsWith("/sitemap")) {
      String tmp = Val.chkStr(query.getResponseFormat());
      if (tmp.length() == 0) {
        query.setResponseFormat("sitemap");
      }
    }

    parser.parseRepositoryId("rid");
    parser.parseResponseFormat("f");
View Full Code Here

   * @return the search criteria object
   */
  protected SearchCriteria toSearchCriteria(HttpServletRequest request,
          RequestContext context, RestQuery query) {
    SearchCriteria criteria = new SearchCriteria();
    RestQueryParser parser = new RestQueryParser(request, context, new RestQuery());

    // keyword filter
    String sKeyword = Val.chkStr(parser.getRequestParameter("searchText"));
    if (sKeyword.length() > 0) {
      SearchFilterKeyword fKeyword = new SearchFilterKeyword();
View Full Code Here

   * Processes request.
   * @throws IOException if error processing request
   */
  private void process() throws IOException {
    LOGGER.info("Starting DCAT cache update process...");
    RestQuery query = new RestQuery();
    query.setResponseFormat("dcat");
    RequestContext context = RequestContext.extract(null);
    MessageBroker msgBroker = new MessageBroker();
    msgBroker.setBundleBaseName(MessageBroker.DEFAULT_BUNDLE_BASE_NAME);
   
    String baseContextPath = Val.chkStr(RequestContext.resolveBaseContextPath(null));
    if (baseContextPath.isEmpty()) {
      StringAttributeMap params = ApplicationContext.getInstance().getConfiguration().getCatalogConfiguration().getParameters();
      baseContextPath = Val.chkStr(params.getValue("reverseProxy.baseContextPath"));;
    }
   
    FeedLinkBuilder linkBuilder = new FeedLinkBuilder(context, baseContextPath, msgBroker);
   
    DcatCache cache = DcatCache.getInstance();
    OutputStream cacheStream = null;
    PrintWriter writer = null;
   
    try {
      cacheStream = cache.createOutputCacheStream();
      writer = new PrintWriter(new OutputStreamWriter(cacheStream, "UTF-8"));
     
      DcatJsonFeedWriter feedWriter = new DcatJsonFeedWriter(context, writer, query);
      feedWriter.setMessageBroker(msgBroker);
     
      query.setReturnables(new CoreQueryables(context).getFull());
     
      DcatJsonSearchEngine.DcatRecordsAdapter discoveredRecordsAdapter = new DcatJsonSearchEngine.DcatRecordsAdapter(msgBroker, linkBuilder, context, query);
     
      feedWriter.write(discoveredRecordsAdapter);
    } finally {
View Full Code Here

TOP

Related Classes of com.esri.gpt.catalog.discovery.rest.RestQuery

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.