Ejemplo n.º 1
0
		/// <summary>
		/// 获取列表,有分页的
		/// </summary>
		/// <param name="confListForm">
		/// 
		/// @return </param>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @RequestMapping(value = "/list", method = org.springframework.web.bind.annotation.RequestMethod.GET) @ResponseBody public com.baidu.dsp.common.vo.JsonObjectBase getConfigList(@Valid com.baidu.disconf.web.service.config.form.ConfListForm confListForm)
		public virtual JsonObjectBase getConfigList(ConfListForm confListForm)
		{

			LOG.info(confListForm.ToString());

			// 设置排序方式
			confListForm.Page.OrderBy = Columns.NAME;
			confListForm.Page.Order = PageOrderValidator.ASC;

			DaoPageResult<ConfListVo> configs = configMgr.getConfigList(confListForm, true, false);

			return buildListSuccess(configs);
		}
Ejemplo n.º 2
0
		/// <summary>
		/// 批量下载配置文件
		/// </summary>
		/// <param name="confListForm">
		/// 
		/// @return </param>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @RequestMapping(value = "/downloadfilebatch", method = org.springframework.web.bind.annotation.RequestMethod.GET) public org.springframework.http.HttpEntity<byte[]> download2(@Valid com.baidu.disconf.web.service.config.form.ConfListForm confListForm)
		public virtual HttpEntity<sbyte[]> download2(ConfListForm confListForm)
		{

			LOG.info(confListForm.ToString());

			//
			// get files
			//
			IList<File> fileList = configMgr.getDisconfFileList(confListForm);

			//
			// prefix
			//
			string prefixString = "APP" + confListForm.AppId + "_" + "ENV" + confListForm.EnvId + "_" + "VERSION" + confListForm.Version;

			HttpHeaders header = new HttpHeaders();

			string targetFileString = "";
			File targetFile = null;
			sbyte[] res = null;
			try
			{
				targetFileString = TarUtils.tarFiles("tmp", prefixString, fileList);
				targetFile = new File(targetFileString);
				res = IOUtils.toByteArray(new System.IO.FileStream(targetFile, System.IO.FileMode.Open, System.IO.FileAccess.Read));
			}
			catch (Exception)
			{
				throw new DocumentNotFoundException("");
			}

			header.set("Content-Disposition", "attachment; filename=" + targetFile.Name);
			header.ContentLength = res.Length;
			return new HttpEntity<sbyte[]>(res, header);
		}