| | |
| | | |
| | | import com.lf.server.entity.ctrl.FmeReqEntity; |
| | | import com.lf.server.entity.ctrl.NameValueEntity; |
| | | import com.lf.server.entity.ctrl.RegisterEntity; |
| | | import com.lf.server.entity.data.MetaFileEntity; |
| | | import com.lf.server.entity.data.PublishEntity; |
| | | import com.lf.server.helper.RestHelper; |
| | | import com.lf.server.helper.StringHelper; |
| | | import com.lf.server.helper.WebHelper; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.ArrayList; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 15.服务注册 |
| | | */ |
| | | public String serverRegister(String name, String serverUri, String type, HttpServletRequest req) { |
| | | String url = getUrl("resource/res/item", req); |
| | | |
| | | RegisterEntity entity = new RegisterEntity(name, serverUri, type); |
| | | |
| | | return RestHelper.postForRest(url, entity); |
| | | } |
| | | |
| | | /** |
| | | * 16.服务申请 |
| | | */ |
| | | public String serverApply(String id, Integer pubid, HttpServletRequest req) { |
| | | String url = getUrl("resource/res/request", req) + "&resourceid=" + id; |
| | | |
| | | List<NameValueEntity> list = new ArrayList<>(); |
| | | list.add(new NameValueEntity("reason", "注册")); |
| | | list.add(new NameValueEntity("serialnum", pubid.toString())); |
| | | |
| | | return RestHelper.postForRest(url, list); |
| | | } |
| | | |
| | | /** |
| | | * 17.删除资源 |
| | | */ |
| | | public void deleteRes(String id, HttpServletRequest req) { |
| | | String url = getUrl("resource/res/hashid", req) + "&hashid=" + id; |
| | | |
| | | RestHelper.deleteForRest(url); |
| | | } |
| | | |
| | | /** |
| | | * 获取Url |
| | | */ |
| | | public String getUrl(String subUrl, HttpServletRequest req) { |