Package com.esri.gpt.server.assertion.components

Examples of com.esri.gpt.server.assertion.components.AsnResponse


   
    // initialize
    AsnContext context = this.getAssertionContext();
    AsnFactory factory = context.getAssertionFactory();
    AsnRequestOptions rOptions = context.getRequestOptions();
    AsnResponse opResponse = context.getOperationResponse();
    ParseHelper pHelper = new ParseHelper();
    String[] parsed;
   
    // parse the HTTP request
    if (request != null) {
   
      // set the IP address
      rOptions.setIPAddress(request.getRemoteAddr());
     
      // parse an operations request
      boolean isOperationsRequest = false;
      if (request.getRequestURI() != null) {
        isOperationsRequest = request.getRequestURI().toLowerCase().endsWith("/operations");
      }
      if (isOperationsRequest) {
        rOptions.setSubject(AsnConstants.APP_URN_PREFIX);
        rOptions.setPredicate(AsnConstants.APP_URN_PREFIX+":assertion:operations");
       
      // parse a non-operations request
      } else {
 
        // subject
        parsed = pHelper.getParameterValues(request,"s");
        if ((parsed == null) || (parsed.length) == 0) {
          parsed = pHelper.getParameterValues(request,"subject");
        }
        if ((parsed != null) && (parsed.length) > 0) {
          rOptions.setSubject(parsed[0]);
        }
       
        // predicate
        parsed = pHelper.getParameterValues(request,"p");
        if ((parsed == null) || (parsed.length) == 0) {
          parsed = pHelper.getParameterValues(request,"predicate");
        }
        if ((parsed != null) && (parsed.length) > 0) {
          rOptions.setPredicate(parsed[0]);
        }
       
        // value
        parsed = pHelper.getParameterValues(request,"v");
        if ((parsed == null) || (parsed.length) == 0) {
          parsed = pHelper.getParameterValues(request,"value");
        }
        if ((parsed != null) && (parsed.length) > 0) {
          rOptions.setValue(parsed[0]);
        }
       
        // output format
        parsed = pHelper.getParameterValues(request,"f");
        if ((parsed == null) || (parsed.length) == 0) {
          parsed = pHelper.getParameterValues(request,"format");
        }
        if ((parsed != null) && (parsed.length) > 0) {
          opResponse.setOutputFormat(parsed[0]);
        }
       
        // start and max records start=&max=
        parsed = pHelper.getParameterValues(request,"start");
        if ((parsed == null) || (parsed.length) == 0) {
View Full Code Here


    // initialize
    String mimeType = "text/plain";
    String sResponse = "";
    AsnFactory asnFactory = null;
    AsnRequestHandler asnHandler = null;
    AsnResponse asnResponse = null;
   
    // execute the assertion operation
    try {
      asnFactory = AsnFactory.newFactory(context);
      asnHandler = asnFactory.makeRequestHandler(request,context);
      asnResponse = asnHandler.getAssertionContext().getOperationResponse();
      asnHandler.handleRequest(request,response);
      sResponse = Val.chkStr(asnResponse.getResponseString());
      mimeType = asnResponse.getMimeType();
    } catch (NotAuthorizedException e) {
      throw e;
    } catch (Exception e) {
      if (asnResponse != null) {
        asnResponse.exceptionToResponse(asnHandler.getAssertionContext(),e);
        sResponse = Val.chkStr(asnResponse.getResponseString());
      } else {
        throw e;
      }
    }
   
View Full Code Here

TOP

Related Classes of com.esri.gpt.server.assertion.components.AsnResponse

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.