Package com.esri.gpt.framework.context

Examples of com.esri.gpt.framework.context.RequestContext


    }

    // document owner
    Publisher owner = null;
    if (getOwner().length()>0) {
      RequestContext context2 = null;
      try {
        if (context != null) {
          owner = new Publisher(context, getOwner());
        } else {
          context2 = RequestContext.extract(null);
          owner = new Publisher(context2, getOwner());
        }
      } catch (Exception ex) {
        LOGGER.log(Level.FINER, "Error creating publisher", ex);
      } finally {
        if (context2 != null) context2.onExecutionPhaseCompleted();
      }
    } else {
      if (publisher!=null && !publisher.getIsAdministrator()) {
        owner = publisher;
      }
View Full Code Here


    String cswBaseUrl = Val.chkStr(svcProps.getCswBaseURL());
    String cswSoapUrl = "";
   
    // check for https protocol
    if (httpContextPath.length() > 0) {
      RequestContext reqContext = context.getRequestContext();
      if ((reqContext != null) && (reqContext.getServletRequest() != null) &&
          (reqContext.getServletRequest() instanceof HttpServletRequest)) {
        HttpServletRequest httpReq = (HttpServletRequest)reqContext.getServletRequest();
        StringBuffer requestURL = httpReq.getRequestURL();
        String s = requestURL.toString().toLowerCase();
        if (s.startsWith("https://") && httpContextPath.toLowerCase().startsWith("http:")) {
          httpContextPath = "https"+httpContextPath.substring(4);
        }
View Full Code Here

      qryCrossedDateline = true;
    }
   
    // determine spatialRelevance parameters
    // (original defaults were queryPower=2.0, targetPower=0.5)
    RequestContext rc = this.getQueryAdapter().getIndexAdapter().getRequestContext();
    StringAttributeMap params = rc.getCatalogConfiguration().getParameters();
    double queryPower = Val.chkDbl(params.getValue("spatialRelevance.queryPower"),1.0);
    double targetPower = Val.chkDbl(params.getValue("spatialRelevance.targetPower"),1.0);
    String rankingOption = Val.chkStr(params.getValue("spatialRelevance.ranking.enabled"));
    int rankingMaxDoc = Val.chkInt(params.getValue("spatialRelevance.ranking.maxDoc"),50000);
    boolean bUseSpatialRanking = false;
View Full Code Here

   * Instantiates a new analyzer.
   * @param context the assertion operation context
   * @return the analyzer
   */
  public Analyzer newAnalyzer(AsnContext context) {
    RequestContext rc = null;
    try {
      LuceneIndexAdapter adapter = null;
      if ((context != null) && (context.getRequestContext() != null)) {
        adapter = new LuceneIndexAdapter(context.getRequestContext());
      } else {
        rc = RequestContext.extract(null);
        adapter = new LuceneIndexAdapter(rc);
      }
      return adapter.newAnalyzer();
    } finally {
      if (rc != null) rc.getConnectionBroker().closeAll();
    }
  }
View Full Code Here

* Selects records.
* @return records
* @throws SQLException if accessing database failed
*/
private HrRecords selectRecords() throws SQLException {
  RequestContext context = RequestContext.extract(null);
  try {
    // get all harveting records
    HrSelectRequest selectRequest = new HrSelectRequest(context);
    selectRequest.execute();
    return selectRequest.getQueryResult().getRecords();
  } finally {
    context.onExecutionPhaseCompleted();
  }
}
View Full Code Here

  /**
   * Determine if collections are in use.
   * @return <code>true</code> if collections are in use
   */
  public boolean getUseCollections() {
    RequestContext context = this.getRequestContext();
    StringAttributeMap params = context.getCatalogConfiguration().getParameters();
    String s = Val.chkStr(params.getValue("catalog.useCollections"));
    return s.equalsIgnoreCase("true");
  }
View Full Code Here

    }
   
    // check the resource URL
    if ((resourceUrl != null) && (resourceUrl.length() > 0)) {
      LOGGER.finer("Checking resource URL: "+resourceUrl);
      RequestContext rc = null;
      String samlToken = null;
      try {
        rc = RequestContext.extract(request);
        User user = rc.getUser();
        IntegrationResponse resp = null;
        IntegrationContextFactory icf = new IntegrationContextFactory();
        if (icf.isIntegrationEnabled()) {
          IntegrationContext ic = icf.newIntegrationContext();
          if (ic != null) {
            resp = ic.checkUrl(resourceUrl,user,null,null,null);
         
            if ((resp != null) && resp.isLicensed()) {
              if ((user != null) && (user.getProfile() != null)) {
                if (user.getProfile().containsKey(SDI_SECURITY_TOKEN)) {
                  samlToken = ic.getBase64EncodedToken(user);
                }
              }
            }
           
          }
        }
       
        // handle a licensed URL
        if ((resp != null) && resp.isLicensed()) {
          String wssUrl = resp.getUrl();
          String licenseSelectionUrl = resp.getLicenseSelectionClientUrl();
          if ((licenseSelectionUrl != null) && (licenseSelectionUrl.length() > 0) &&
              (wssUrl != null) && (wssUrl.length() > 0)) {
           
            // save resource URL parameters
            String wssUrlParams = null;
            int idx = wssUrl.indexOf("?");
            if (idx != -1) {
              wssUrlParams = wssUrl.substring(idx+1).trim();
              wssUrl = wssUrl.substring(0,idx);
            }
           
            // make the callback URL
            String callbackUrl = RequestContext.resolveBaseContextPath(request)+"/link";
            callbackUrl += "?lcb="+URLEncoder.encode("true","UTF-8");
            callbackUrl += "&act="+URLEncoder.encode(act,"UTF-8");
            callbackUrl += "&fwd="+URLEncoder.encode(fwd,"UTF-8");
            if ((wssUrlParams != null) && (wssUrlParams.length() > 0)) {
              callbackUrl += "&rqs="+URLEncoder.encode(wssUrlParams,"UTF-8");
            }
            if ((addToMapHint != null) && (addToMapHint.length() > 0)) {
              callbackUrl += "&atmh="+URLEncoder.encode(addToMapHint,"UTF-8");
            }

            // make the full license selection URL (can set &embedded=true)
            licenseSelectionUrl += "?WSS="+URLEncoder.encode(wssUrl,"UTF-8");
            licenseSelectionUrl += "&returnURL="+URLEncoder.encode(callbackUrl,"UTF-8");
           
            // if user is logged in,
            //   return an HTML response that immediately posts the SAML token to the license selection URL
            // else
            //   forward to the licenseSelectionUrl           
            if ((samlToken != null) && (samlToken.length() > 0)) {
              LOGGER.finer("Sending POST redirect with token to: " + licenseSelectionUrl);
              fwd = null;
              String title = "License redirect SSO page";
              StringBuilder sbHtml = new StringBuilder();
              sbHtml.append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");
              sbHtml.append("\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">");
              sbHtml.append("\r\n<head>");
              sbHtml.append("\r\n<title>").append(Val.escapeXmlForBrowser(title)).append("</title>");
              sbHtml.append("\r\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\"/>");
              sbHtml.append("\r\n<meta http-equiv=\"Expires\" content=\"Mon, 01 Jan 1990 00:00:01 GMT\"/>");
              sbHtml.append("\r\n<meta http-equiv=\"pragma\" content=\"no-cache\"/>");
              sbHtml.append("\r\n<meta http-equiv=\"cache-control\" content=\"no-cache\"/>");
              sbHtml.append("\r\n<meta name=\"robots\" content=\"noindex\"/>");
              sbHtml.append("\r\n</head>");
              sbHtml.append("\r\n<body onload=\"document.forms[0].submit();\">");
              sbHtml.append("\r\n<form method=\"post\" action=\"").append(Val.escapeXmlForBrowser(licenseSelectionUrl)).append("\">");
              sbHtml.append("\r\n<input type=\"hidden\" name=\"ticket\" value=\"").append(Val.escapeXmlForBrowser(samlToken)).append("\"/>");
              sbHtml.append("\r\n</form>");
              sbHtml.append("\r\n</body>");
              sbHtml.append("\r\n</html>");
              this.writeCharacterResponse(response,sbHtml.toString(),"UTF-8","text/html; charset=UTF-8");
            } else {
              fwd = licenseSelectionUrl;
            }

          } else {
            String msg = "IntegrationResponse isLicensed() was true, but getLicenseSelectionClientUrl() was empty.";
            LOGGER.warning(msg);
          }
         
        // handle a secured URL
        } else if ((resp != null) && resp.isSecured()) {
          String securedUrl = resp.getUrl();
          if ((securedUrl != null) && !securedUrl.equals(resourceUrl)) {
            if (act.equals("open")) {
              fwd = securedUrl;
            } else if (act.equals("preview")) {
              fwd = this.replaceParam(fwd,"url",securedUrl);
            } else if (act.equals("addToMap")) {
              if ((addToMapHint != null) && (addToMapHint.length() > 0)) {
                securedUrl = addToMapHint+":"+securedUrl;
              }
              fwd = this.replaceParam(fwd,"resource",securedUrl);
            } else {
              fwd = securedUrl;
            }
          }
        }
       
      } catch (NotAuthorizedException e) {
        String msg = "Error checking resource URL";
        LOGGER.log(Level.SEVERE,msg,e);
        this.writeError(request,response,msg+": "+e.toString(),null);
        return;
      } catch (Exception e) {
        String msg = "Error checking resource URL";
        LOGGER.log(Level.SEVERE,msg,e);
        this.writeError(request,response,msg+": "+e.toString(),null);
        return;
      } finally {
        if (rc != null) rc.onExecutionPhaseCompleted();
      }
    }

    // send the redirect
    if ((fwd != null) && (fwd.length() > 0)) {
View Full Code Here

  public void handleListRepositories(ActionEvent event)
          throws AbortProcessingException {

    try {
      // start execution phase
      RequestContext context = onExecutionPhaseStarted();

      // check authorization
      authorizeAction(context);

      // check for a page cursor navigation event
View Full Code Here

   */
  public void handleCreateRepository(ActionEvent event)
          throws AbortProcessingException {
    try {
      // start execution phase
      RequestContext context = onExecutionPhaseStarted();

      // check authorization
      authorizeAction(context);

      HrCriteria hc = getHarvestContext().getHarvestCriteria();
View Full Code Here

   */
  public void handleIncSynchronization(ActionEvent event)
          throws AbortProcessingException {

    // start execution phase
    RequestContext context = onExecutionPhaseStarted();

    try {
      submitIncSynchronization(context);
      createEditor(context, true);
    } catch (Throwable t) {
View Full Code Here

TOP

Related Classes of com.esri.gpt.framework.context.RequestContext

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.