表格识别结果接口
获取表格文字识别结果

@param requestId - 发送表格文字识别请求时返回的request id
@param options - 可选参数对象，key: value都为string类型
options - options列表:
result_type 期望获取结果的类型，取值为“excel”时返回xls文件的地址，取值为“json”时返回json格式的字符串,默认为”excel”
@return JSONObject
485654
public JSONObject tableResultGet(String requestId, HashMap<String, String> options) {
        AipRequest request = new AipRequest();
        preOperation(request);
        
        request.addBody("request_id", requestId);
        if (options != null) {
            request.addBody(options);
        }
        request.setUri(OcrConsts.TABLE_RESULT_GET);
        postOperation(request);
        return requestServer(request);
    }
943288
protected int getRequestTypeFromString(String requestType) {
        if ("GET".equals(requestType)) {
            return REQUEST_TYPE_GET;
        }
        if ("POST".equals(requestType)) {
            return REQUEST_TYPE_POST;
        }
        if ("PUT".equals(requestType)) {
            return REQUEST_TYPE_PUT;
        }
        if ("DELETE".equals(requestType)) {
            return REQUEST_TYPE_DELETE;
        }
        return REQUEST_TYPE_ALL;
    }
980360
public String resource_to_string(base_resource resrc, String id, options option,Boolean warning, String onerror) 
	{
		String result = "{ ";
			if (option != null || (warning!=null && warning==true) || (!onerror.equals(""))) { 
				result = result + "\"params\":{";
				if(option != null)
				{
					if (option.get_action() != null) {
						result = result + "\"action\":\"" + option.get_action() + "\",";
					}					
				}
				if(warning != null && warning==true)
				{
					result = result + "\"warning\":\"yes\",";
				}
				if((!onerror.equals("")))
				{			
					result = result +"\"onerror\":\"" + onerror +"\"";			
				}		
				result  = result + "},";
			}
		
		if (id != null)
			result = result + "\"sessionid\":\"" + id + "\",";
		
		result = result + "\"" + resrc.get_object_type() + "\":" + this.resource_to_string(resrc) + "}";
		return result;
	}
428712
public JSONObject imageCensorUserDefined(String image, EImgType type, HashMap<String, String> options) {
        if (type == EImgType.FILE) {
            try {
                byte[] imgData = Util.readFileByBytes(image);
                return imageCensorUserDefined(imgData, options);
            } catch (IOException e) {
                return AipError.IMAGE_READ_ERROR.toJsonResult();
            }
        }

        // url
        AipRequest request = new AipRequest();

        request.addBody("imgUrl", image);

        return imageCensorUserDefinedHelper(request, options);
    }
1028850
function RequestOptions(opts) {
        if (opts === void 0) { opts = {}; }
        var method = opts.method, headers = opts.headers, body = opts.body, url = opts.url, search = opts.search, params = opts.params, withCredentials = opts.withCredentials, responseType = opts.responseType;
        this.method = method != null ? normalizeMethodName(method) : null;
        this.headers = headers != null ? headers : null;
        this.body = body != null ? body : null;
        this.url = url != null ? url : null;
        this.params = this._mergeSearchParams(params || search);
        this.withCredentials = withCredentials != null ? withCredentials : null;
        this.responseType = responseType != null ? responseType : null;
    }
30936
function (options) {
        _.isString(options) && (options = { mode: 'raw', raw: options });
        if (!options.mode) { return; } // need a valid mode @todo raise error?

        var mode = RequestBody.MODES[options.mode.toString().toLowerCase()] || RequestBody.MODES.raw,
            urlencoded = options.urlencoded,
            formdata = options.formdata,
            graphql = options.graphql,
            file = options.file,
            raw = options.raw;

        // Handle URL Encoded data
        if (options.urlencoded) {
            _.isString(options.urlencoded) && (urlencoded = QueryParam.parse(options.urlencoded));
            // @todo: The fallback in the ternary expression will never be hit, as urlencoded points to
            // @todo: options.urlencoded
            urlencoded = urlencoded ? new PropertyList(QueryParam, this, urlencoded) :
                new PropertyList(QueryParam, this, []);
        }

        // Handle Form data
        if (options.formdata) {
            // @todo: The fallback in the ternary expression will never be hit, as formdata points to
            // @todo: options.formdata
            formdata = formdata ? new PropertyList(FormParam, this, options.formdata) :
                new PropertyList(FormParam, this, []);
        }

        // Handle GraphQL data
        if (options.graphql) {
            graphql = {
                query: graphql.query,
                operationName: graphql.operationName,
                variables: graphql.variables
            };
        }

        _.isString(options.file) && (file = { src: file });

        // If mode is raw but options does not give raw content, set it to empty string
        (mode === RequestBody.MODES.raw && !raw) && (raw = '');

        // If mode is urlencoded but options does not provide any content, set it to an empty property list
        (mode === RequestBody.MODES.urlencoded && !urlencoded) && (urlencoded = new PropertyList(QueryParam, this, []));

        // If mode is formdata but options does not provide any content, set it to an empty property list
        (mode === RequestBody.MODES.formdata && !formdata) && (formdata = new PropertyList(FormParam, this, []));

        // If mode is graphql but options does not provide any content, set empty query
        (mode === RequestBody.MODES.graphql && !graphql) && (graphql = {});

        _.assign(this, /** @lends RequestBody.prototype */ {

            /**
             * Indicates the type of request data to use.
             *
             * @type {String}
             */
            mode: mode,

            /**
             * If the request has raw body data associated with it, the data is held in this field.
             *
             * @type {String}
             */
            raw: raw,

            /**
             * Any URL encoded body params go here.
             *
             * @type {PropertyList<QueryParam>}
             */
            urlencoded: urlencoded,

            /**
             * Form data parameters for this request are held in this field.
             *
             * @type {PropertyList<FormParam>}
             */
            formdata: formdata,

            /**
             * Holds a reference to a file which should be read as the RequestBody. It can be a file path (when used
             * with Node) or a unique ID (when used with the browser).
             *
             * @note The reference stored here should be resolved by a resolver function (which should be provided to
             * the Postman Runtime).
             */
            file: file,

            /**
             * If the request has raw graphql data associated with it, the data is held in this field.
             *
             * @type {Object}
             */
            graphql: graphql,

            /**
             * Indicates whether to include body in request or not.
             *
             * @type {Boolean}
             */
            disabled: options.disabled
        });
    }
259830
private base_resource post_requestEx(nitro_service service, options option)  throws Exception
	{
		String sessionid = service.get_sessionid();
		String request = resource_to_string(service, sessionid, option);
		return post_dataEx(service, request);
	}
277015
function serializeData(options) {
    if (options.processData && options.data && $.type(options.data) != "string")
      options.data = $.param(options.data, options.traditional)
    if (options.data && (!options.type || options.type.toUpperCase() == 'GET'))
      options.url = appendQuery(options.url, options.data)
  }
1312298
@Override
    public Object convertRequest(ServiceRequestContext ctx, AggregatedHttpMessage request,
                                 Class<?> expectedResultType) throws Exception {
        final String path = getPath(ctx);
        final Optional<Iterable<String>> jsonPaths = getJsonPaths(ctx);
        if (jsonPaths.isPresent()) {
            return Optional.of(Query.ofJsonPath(path, jsonPaths.get()));
        }

        if (isValidFilePath(path)) {
            return Optional.of(Query.of(QueryType.IDENTITY, path));
        }
        return Optional.empty();
    }
906774
public static Point getPointWithWickedChartsId(final Options options, final int wickedChartsId) {
        for (Series<?> series : options.getSeries()) {
            for (Object object : series.getData()) {
                if (!(object instanceof Point)) {
                    break;
                } else {
                    Point point = (Point) object;
                    if (point.getWickedChartsId() == wickedChartsId) {
                        return point;
                    }
                }
            }
        }
        return null;
    }
365103
@Override
    @Path("/{requestId}")
    @ApiOperation(value="Retrieve a request or a page of requests according to specified filters",
        notes="If requestId is not present, returns all matching requests.",
        response=Request.class, responseContainer="List")
    public JSONObject get(String path, Map<String,String> headers)
    throws ServiceException, JSONException {
        RequestServices requestServices = ServiceLocator.getRequestServices();
        try {
            Query query = getQuery(path, headers);
            String segOne = getSegment(path, 1);
            if (segOne != null) {
                if (segOne.equals("tops")) {
                    return getTops(query).getJson();
                }
                else if (segOne.equals("breakdown")) {
                    return getBreakdown(query).getJson();
                }
                else if (segOne.equals("paths")) {
                    return getPaths(query).getJson();
                }
                else if (segOne.equals("insights")) {
                    JsonList<Insight> jsonList = getInsights(query);
                    JSONObject json = jsonList.getJson();
                    String trend = query.getFilter("trend");
                    if ("completionTime".equals(trend)) {
                        List<Timepoint> timepoints = requestServices.getRequestTrend(query);
                        json.put("trend", new JsonList<>(timepoints, "trend").getJson().getJSONArray("trend"));
                    }
                    return json;
                }
                else {
                    try {
                        if (query.getBooleanFilter("master")) {
                            String masterRequestId = segOne;
                            if (query.getBooleanFilter("response")) {
                                Request masterRequest = requestServices.getMasterRequestResponse(masterRequestId);
                                if (masterRequest == null)
                                    throw new ServiceException(ServiceException.NOT_FOUND, "Master request not found: " + masterRequestId);
                                return masterRequest.getJson();
                            }
                            else {
                                Request masterRequest = requestServices.getMasterRequest(masterRequestId);
                                if (masterRequest == null)
                                    throw new ServiceException(ServiceException.NOT_FOUND, "Master request not found: " + masterRequestId);
                                return masterRequest.getJson();
                            }
                        }
                        else {
                            Long requestId = Long.valueOf(segOne);
                            if (query.getBooleanFilter("request") && query.getBooleanFilter("response")) {
                                Request request = requestServices.getRequestAndResponse(requestId);
                                if (request == null)
                                    throw new ServiceException(ServiceException.NOT_FOUND, "Request not found: " + requestId);
                                return request.getJson();
                            }
                            else if (query.getBooleanFilter("response")) {
                                Request request = requestServices.getRequestResponse(requestId);
                                if (request == null)
                                    throw new ServiceException(ServiceException.NOT_FOUND, "Request not found: " + requestId);
                                return request.getJson();
                            }
                            else {
                                Request request = requestServices.getRequest(requestId);
                                if (request == null)
                                    throw new ServiceException(ServiceException.NOT_FOUND, "Request not found: " + requestId);
                                return request.getJson();
                            }
                        }
                    }
                    catch (NumberFormatException ex) {
                        throw new ServiceException(ServiceException.BAD_REQUEST, "Bad requestId: " + segOne);
                    }
                }
            }
            else {
                if (query.getLongFilter("ownerId") >= 0L) {
                    RequestList reqList = requestServices.getRequests(query);
                    if (!reqList.getItems().isEmpty())
                        return requestServices.getRequestAndResponse(reqList.getItems().get(0).getId()).getJson();
                    else
                        throw new ServiceException(ServiceException.NOT_FOUND, "Request not found for ownerId: " + query.getLongFilter("ownerId"));
                }
                else
                    return requestServices.getRequests(query).getJson();
            }
        }
        catch (ServiceException ex) {
            throw ex;
        }
        catch (Exception ex) {
            throw new ServiceException(ServiceException.INTERNAL_ERROR, ex.getMessage(), ex);
        }
    }
664312
public Long getRequestId() throws ActivityException {

        if (requestId != null)
            return requestId;

        String requestIdVarName = getAttribute("requestIdVariable", "requestId");

        Variable requestIdVar = getProcessDefinition().getVariable(requestIdVarName);
        if (requestIdVar == null && !"GET".equals(getHttpMethod()))
            throw new ActivityException("Request ID variable not defined: " + requestIdVarName);

        Object requestIdObj = getVariableValue(requestIdVarName);
        if (requestIdObj == null)
            return null;

        if (requestIdObj instanceof Long) {
            return (Long) requestIdObj;
        }
        else {
            try {
                return Long.valueOf(requestIdObj.toString());
            }
            catch (NumberFormatException ex) {
                throw new ActivityException(
                        "Invalid value for " + requestIdVarName + ": " + requestIdObj);
            }
        }
    }
350151
public JSONObject animalDetect(byte[] image, HashMap<String, String> options) {
        AipRequest request = new AipRequest();
        preOperation(request);
        
        String base64Content = Base64Util.encode(image);
        request.addBody("image", base64Content);
        if (options != null) {
            request.addBody(options);
        }
        request.setUri(ImageClassifyConsts.ANIMAL_DETECT);
        postOperation(request);
        return requestServer(request);
    }
648768
public static SystemInputDef getRequestInputModel( OpenAPI api, ModelOptions options)
    {
    RequestInputModeller inputModeller = new RequestInputModeller( options);
    return inputModeller.getRequestInputModel( api);
    }
424458
private  base_resource[] get_request(nitro_service service,options option) throws Exception  
	{
		StringBuilder responseStr = new StringBuilder();
		HttpURLConnection httpURLConnection = null;
		try
		{
			String urlstr;
			String ipaddress = service.get_ipaddress();
			String version = service.get_version();
			String sessionid = service.get_sessionid();
			String objtype = get_object_type();
			String protocol = service.get_protocol();

			// build URL
			urlstr = protocol + "://" + ipaddress + "/nitro/" + version + "/config/" + objtype;

			String name = this.get_object_name();
			if (name != null && name.length() > 0)
			{
				urlstr = urlstr+"/"+nitro_util.encode(nitro_util.encode(name));
			}

			if (option != null || (service.get_warning()!=null && service.get_warning()) )
			{
				String optionstr=null;
				if (option != null)
				{
					optionstr = option.to_string();
					if (optionstr.length() > 0)
					{
						urlstr = urlstr+"?";
						urlstr = urlstr+optionstr;
					}
				}	
				if (service.get_warning()!=null && service.get_warning())
				{					
					if (option != null && optionstr.length() > 0)
					{
						urlstr = urlstr+"&";
					}
					else
					{
						urlstr = urlstr+"?";
					}
					urlstr = urlstr+"warning=yes";
				}
			}
			
			
			URL url = new URL(urlstr);
			httpURLConnection = (HttpURLConnection) url.openConnection();

			httpURLConnection.setRequestMethod("GET");

			httpURLConnection.setRequestProperty("Cookie", "sessionid=" + nitro_util.encode(sessionid));
			if ((option != null) && (option.get_compression()))
				httpURLConnection.setRequestProperty("Accept-Encoding", "gzip, deflate");

			if (httpURLConnection instanceof HttpsURLConnection)
			{
				if (service.get_certvalidation()) {
					SocketFactory sslSocketFactory = SSLSocketFactory.getDefault();
					HttpsURLConnection secured = (HttpsURLConnection) httpURLConnection;
					secured.setSSLSocketFactory((SSLSocketFactory)sslSocketFactory);	
					if (!service.get_hostnameverification()) {
						/*
						 * override defualt hostNameverifier's verify method
						 * with EmptyHostnameVerifier's verify method to ignore hostname verification check.
						 */
						secured.setHostnameVerifier(new EmptyHostnameVerifier());
					}
				} else {
					SSLContext sslContext = SSLContext.getInstance("SSL");
					//we are using an empty trust manager, because NetScaler currently presents
					//a test certificate not issued by any signing authority, so we need to bypass
					//the credentials check
					sslContext.init(null, new TrustManager[]{new EmptyTrustManager()}, null);
					SocketFactory sslSocketFactory = sslContext.getSocketFactory();
					
					HttpsURLConnection secured = (HttpsURLConnection) httpURLConnection;
					secured.setSSLSocketFactory((SSLSocketFactory)sslSocketFactory);
					if (!service.get_hostnameverification()) {
						/*
						 * overriding defualt hostNameverifier's verify method
						 * with EmptyHostnameVerifier's verify method to bypass hostname check.
						 */
						secured.setHostnameVerifier(new EmptyHostnameVerifier());
					}
				}
			}
			
			InputStream input;
			try {
				input = httpURLConnection.getInputStream();
			}
			catch (Exception e) {
				input = httpURLConnection.getErrorStream();	
			}
			String contentEncoding = httpURLConnection.getContentEncoding();
			//	get correct input stream for compressed data:
			if (contentEncoding != null)
			{
				if(contentEncoding.equalsIgnoreCase("gzip"))
					input = new GZIPInputStream(input); //reads 2 bytes to determine GZIP stream!
				else if(contentEncoding.equalsIgnoreCase("deflate"))
					input = new InflaterInputStream(input);
			}

			int numOfTotalBytesRead;
			byte [] buffer = new byte[1024];
			while ((numOfTotalBytesRead = input.read(buffer, 0, buffer.length)) != -1)
			{
				responseStr.append(new String(buffer, 0, numOfTotalBytesRead));
			}

			httpURLConnection.disconnect();
			input.close();
		}
		catch (MalformedURLException mue)
		{
			throw mue;
		}
		catch (IOException ioe)
		{
			throw ioe;
			
		}
		catch(Exception e)
		{
			throw e;
		}
		base_resource[] result = get_nitro_response(service, responseStr.toString());
		return result;
	}
1330316
public Object requestGet(final String id, Class type) throws SDKException {
    String url = this.pathUrl;
    if (id != null) {
      url += "/" + id;
      return requestGetWithStatus(url, null, type);
    } else {
      return requestGetAll(url, type, null);
    }
  }
1117546
private base_response post_request(nitro_service service, options option)  throws Exception
	{
		String sessionid = service.get_sessionid();
		String request = resource_to_string(service, sessionid, option);
		return post_data(service,request);
	}