本文整理匯總了Java中org.grain.httpserver.HttpPacket類的典型用法代碼示例。如果您正苦於以下問題:Java HttpPacket類的具體用法?Java HttpPacket怎麽用?Java HttpPacket使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
HttpPacket類屬於org.grain.httpserver包,在下文中一共展示了HttpPacket類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createOrderRecordHandle
import org.grain.httpserver.HttpPacket; //導入依賴的package包/類
public HttpPacket createOrderRecordHandle(HttpPacket httpPacket) {
CreateOrderRecordC message = (CreateOrderRecordC) httpPacket.getData();
String appId = message.getAppId();
App app = AppAction.getAppById(appId);
if (app == null) {
return null;
}
OrderRecordExt orderRecord = OrderRecordAction.createOrderRecord(appId, message.getOrderRecordOrderId(), message.getOrderRecordTotalPrice(), message.getOrderRecordUserId(), message.getOrderRecordOrderDetail(), message.getOrderRecordUserName(), message.getOrderRecordReturnUrl(), message.getOrderRecordNotifyUrl(), message.getOrderGoodsArrayList());
if (orderRecord == null) {
return null;
}
CreateOrderRecordS.Builder builder = CreateOrderRecordS.newBuilder();
builder.setHOpCode(httpPacket.hSession.headParam.hOpCode);
builder.setOrderRecordData(OrderRecordAction.getOrderRecordBuilder(orderRecord));
HttpPacket packet = new HttpPacket(httpPacket.hSession.headParam.hOpCode, builder.build());
return packet;
}
示例2: updateOrderRecordHandle
import org.grain.httpserver.HttpPacket; //導入依賴的package包/類
public HttpPacket updateOrderRecordHandle(HttpPacket httpPacket) {
UpdateOrderRecordC message = (UpdateOrderRecordC) httpPacket.getData();
OrderRecordExt orderRecord = OrderRecordAction.updateOrderRecord(message.getOrderRecordId(), message.getOrderRecordPayStatus(), message.getOrderRecordStatus(), message.getOrderRecordPayChannel(), message.getOrderRecordNotifyResult(), message.getOrderRecordNotifyTime());
if (orderRecord == null) {
return null;
}
List<OrderGoods> orderGoodsList = OrderRecordAction.getOrderGoodsListByOrderRecordId(orderRecord.getOrderRecordId());
if (orderGoodsList == null) {
return null;
}
orderRecord.orderGoodsArray = orderGoodsList;
UpdateOrderRecordS.Builder builder = UpdateOrderRecordS.newBuilder();
builder.setHOpCode(httpPacket.hSession.headParam.hOpCode);
builder.setOrderRecordData(OrderRecordAction.getOrderRecordBuilder(orderRecord));
HttpPacket packet = new HttpPacket(httpPacket.hSession.headParam.hOpCode, builder.build());
return packet;
}
示例3: getOrderRecordListHandle
import org.grain.httpserver.HttpPacket; //導入依賴的package包/類
public HttpPacket getOrderRecordListHandle(HttpPacket httpPacket) {
GetOrderRecordListC message = (GetOrderRecordListC) httpPacket.getData();
long count = OrderRecordAction.getOrderRecordListCount(message.getAppId(), message.getOrderRecordOrderId(), message.getOrderRecordCreateTimeGreaterThan(), message.getOrderRecordCreateTimeLessThan(), message.getOrderRecordPayStatus(), message.getOrderRecordStatus(), message.getOrderRecordUserId(), message.getOrderRecordPayChannel(), message.getOrderRecordOrderDetail(), message.getOrderRecordNotifyResult());
if (count == -1) {
return null;
}
PageObj pageObj = PageFormat.getStartAndEnd(message.getCurrentPage(), message.getPageSize(), (int) count);
List<OrderRecordExt> orderRecordList = OrderRecordAction.getOrderRecordList(message.getAppId(), message.getOrderRecordOrderId(), message.getOrderRecordCreateTimeGreaterThan(), message.getOrderRecordCreateTimeLessThan(), message.getOrderRecordPayStatus(), message.getOrderRecordStatus(), message.getOrderRecordUserId(), message.getOrderRecordPayChannel(), message.getOrderRecordOrderDetail(), message.getOrderRecordNotifyResult(), pageObj.start, pageObj.pageSize);
if (orderRecordList == null) {
return null;
}
GetOrderRecordListS.Builder builder = GetOrderRecordListS.newBuilder();
builder.setHOpCode(httpPacket.hSession.headParam.hOpCode);
for (int i = 0; i < orderRecordList.size(); i++) {
OrderRecordExt orderRecord = orderRecordList.get(i);
List<OrderGoods> orderGoodsList = OrderRecordAction.getOrderGoodsListByOrderRecordId(orderRecord.getOrderRecordId());
orderRecord.orderGoodsArray = orderGoodsList;
builder.addOrderRecordList(OrderRecordAction.getOrderRecordBuilder(orderRecord));
}
builder.setCurrentPage(pageObj.currentPage);
builder.setAllNum(pageObj.allNum);
builder.setPageSize(pageObj.pageSize);
builder.setTotalPage(pageObj.totalPage);
HttpPacket packet = new HttpPacket(httpPacket.hSession.headParam.hOpCode, builder.build());
return packet;
}
示例4: getAppListHandle
import org.grain.httpserver.HttpPacket; //導入依賴的package包/類
public HttpPacket getAppListHandle(HttpPacket httpPacket) {
GetAppListC message = (GetAppListC) httpPacket.getData();
long count = AppAction.getAppListCount(message.getAppName(), message.getAppCreateTimeGreaterThan(), message.getAppCreateTimeLessThan(), message.getAppState());
if (count == -1) {
return null;
}
PageObj pageObj = PageFormat.getStartAndEnd(message.getCurrentPage(), message.getPageSize(), (int) count);
List<App> appList = AppAction.getAppList(message.getAppName(), message.getAppCreateTimeGreaterThan(), message.getAppCreateTimeLessThan(), message.getAppState(), pageObj.start, pageObj.pageSize);
if (appList == null) {
return null;
}
GetAppListS.Builder builder = GetAppListS.newBuilder();
builder.setHOpCode(httpPacket.hSession.headParam.hOpCode);
for (int i = 0; i < appList.size(); i++) {
App app = appList.get(i);
builder.addAppList(AppAction.getAppBuilder(app));
}
builder.setCurrentPage(pageObj.currentPage);
builder.setAllNum(pageObj.allNum);
builder.setPageSize(pageObj.pageSize);
builder.setTotalPage(pageObj.totalPage);
HttpPacket packet = new HttpPacket(httpPacket.hSession.headParam.hOpCode, builder.build());
return packet;
}
示例5: updateTokenHandle
import org.grain.httpserver.HttpPacket; //導入依賴的package包/類
public HttpPacket updateTokenHandle(HttpPacket httpPacket) throws HttpException {
Token token = TokenAction.updateToken(httpPacket.hSession.headParam.token);
if (token == null) {
UCError errorPack = UCErrorPack.create(UCErrorCode.ERROR_CODE_8, httpPacket.hSession.headParam.hOpCode);
throw new HttpException(HOpCodeUCenter.UC_ERROR, errorPack);
}
User user = (User) httpPacket.hSession.otherData;
UpdateTokenS.Builder builder = UpdateTokenS.newBuilder();
builder.setHOpCode(httpPacket.hSession.headParam.hOpCode);
builder.setTokenId(token.getTokenId());
builder.setTokenExpireTime(TimeUtils.dateToString(token.getTokenExpireTime()));
builder.setUser(UserAction.getUserDataBuilder(user, token.getTokenId()));
HttpPacket packet = new HttpPacket(httpPacket.hSession.headParam.hOpCode, builder.build());
return packet;
}
示例6: getUserGroupListHandle
import org.grain.httpserver.HttpPacket; //導入依賴的package包/類
public HttpPacket getUserGroupListHandle(HttpPacket httpPacket) throws HttpException {
GetUserGroupListC message = (GetUserGroupListC) httpPacket.getData();
List<UserGroup> userGroupList = UserGroupAction.getUserGroupList(message.getUserGroupParentId(), message.getIsUserGroupParentIsNull(), message.getIsRecursion(), message.getUserGroupTopId(), message.getUserGroupState(), message.getUserGroupCreateTimeGreaterThan(), message.getUserGroupCreateTimeLessThan(), message.getUserGroupUpdateTimeGreaterThan(), message.getUserGroupUpdateTimeLessThan());
int currentPage = message.getCurrentPage();
int pageSize = message.getPageSize();
PageObj pageObj = PageFormat.getStartAndEnd(currentPage, pageSize, userGroupList.size());
GetUserGroupListS.Builder builder = GetUserGroupListS.newBuilder();
builder.setHOpCode(httpPacket.hSession.headParam.hOpCode);
builder.setCurrentPage(pageObj.currentPage);
builder.setPageSize(pageObj.pageSize);
builder.setTotalPage(pageObj.totalPage);
builder.setAllNum(pageObj.allNum);
if (userGroupList != null) {
for (int i = pageObj.start; i < pageObj.end; i++) {
UserGroup userGroup = userGroupList.get(i);
builder.addUserGroup(UserGroupAction.getUserGroupDataBuilder(userGroup));
}
}
HttpPacket packet = new HttpPacket(httpPacket.hSession.headParam.hOpCode, builder.build());
return packet;
}
示例7: getUserHandle
import org.grain.httpserver.HttpPacket; //導入依賴的package包/類
public HttpPacket getUserHandle(HttpPacket httpPacket) throws HttpException {
GetUserC message = (GetUserC) httpPacket.getData();
User user;
if (StringUtil.stringIsNull(message.getUserId())) {
user = (User) httpPacket.hSession.otherData;
} else {
user = UserAction.getUserById(message.getUserId());
}
if (user == null) {
UCError errorPack = UCErrorPack.create(UCErrorCode.ERROR_CODE_4, httpPacket.hSession.headParam.hOpCode);
throw new HttpException(HOpCodeUCenter.UC_ERROR, errorPack);
}
GetUserS.Builder builder = GetUserS.newBuilder();
builder.setHOpCode(httpPacket.hSession.headParam.hOpCode);
builder.setUser(UserAction.getUserDataBuilder(user, httpPacket.hSession.headParam.token));
HttpPacket packet = new HttpPacket(httpPacket.hSession.headParam.hOpCode, builder.build());
return packet;
}
示例8: getUserListHandle
import org.grain.httpserver.HttpPacket; //導入依賴的package包/類
public HttpPacket getUserListHandle(HttpPacket httpPacket) {
GetUserListC message = (GetUserListC) httpPacket.getData();
List<User> userList = UserAction.getUserList(message.getUserGroupId(), message.getIsRecursion(), message.getIsUserGroupIsNull(), message.getUserState(), message.getUserSex(), message.getUserRole(), message.getUserGroupTopId(), message.getUserName(), message.getUserCreateTimeGreaterThan(), message.getUserCreateTimeLessThan(), message.getUserUpdateTimeGreaterThan(), message.getUserUpdateTimeLessThan());
int currentPage = message.getCurrentPage();
int pageSize = message.getPageSize();
PageObj pageObj = PageFormat.getStartAndEnd(currentPage, pageSize, userList.size());
GetUserListS.Builder builder = GetUserListS.newBuilder();
builder.setHOpCode(httpPacket.hSession.headParam.hOpCode);
builder.setCurrentPage(pageObj.currentPage);
builder.setPageSize(pageObj.pageSize);
builder.setTotalPage(pageObj.totalPage);
builder.setAllNum(pageObj.allNum);
if (userList != null) {
for (int i = pageObj.start; i < pageObj.end; i++) {
User user = userList.get(i);
builder.addUser(UserAction.getUserDataBuilder(user, httpPacket.hSession.headParam.token));
}
}
HttpPacket packet = new HttpPacket(httpPacket.hSession.headParam.hOpCode, builder.build());
return packet;
}
示例9: getUserImgHandle
import org.grain.httpserver.HttpPacket; //導入依賴的package包/類
public ReplyImage getUserImgHandle(HttpPacket httpPacket) {
GetUserImgC message = (GetUserImgC) httpPacket.getData();
User user;
if (StringUtil.stringIsNull(message.getUserId())) {
user = (User) httpPacket.hSession.otherData;
} else {
user = UserAction.getUserById(message.getUserId());
}
if (user == null) {
return null;
}
File file = UserAction.getUserImg(user.getUserImg());
ReplyImage replyImage = new ReplyImage(file);
return replyImage;
}
示例10: loginHandle
import org.grain.httpserver.HttpPacket; //導入依賴的package包/類
public HttpPacket loginHandle(HttpPacket httpPacket) throws HttpException {
LoginC message = (LoginC) httpPacket.getData();
UserData userData = IdentityAction.getUser(message.getToken());
if (userData == null) {
PCError errorPack = PCErrorPack.create(PCErrorCode.ERROR_CODE_4, httpPacket.hSession.headParam.hOpCode);
throw new HttpException(HOpCode.PC_ERROR, errorPack);
}
LoginS.Builder builder = LoginS.newBuilder();
builder.setHOpCode(httpPacket.hSession.headParam.hOpCode);
HttpPacket packet = new HttpPacket(httpPacket.hSession.headParam.hOpCode, builder.build());
return packet;
}
示例11: createAppHandle
import org.grain.httpserver.HttpPacket; //導入依賴的package包/類
public HttpPacket createAppHandle(HttpPacket httpPacket) {
CreateAppC message = (CreateAppC) httpPacket.getData();
App app = AppAction.createApp(message.getAppName(), message.getAppReturnUrl(), message.getAppNotifyUrl());
if (app == null) {
return null;
}
CreateAppS.Builder builder = CreateAppS.newBuilder();
builder.setHOpCode(httpPacket.hSession.headParam.hOpCode);
builder.setApp(AppAction.getAppBuilder(app));
HttpPacket packet = new HttpPacket(httpPacket.hSession.headParam.hOpCode, builder.build());
return packet;
}
示例12: updateAppHandle
import org.grain.httpserver.HttpPacket; //導入依賴的package包/類
public HttpPacket updateAppHandle(HttpPacket httpPacket) {
UpdateAppC message = (UpdateAppC) httpPacket.getData();
App app = AppAction.updateApp(message.getAppId(), message.getAppName(), message.getUpdateAppKey(), message.getAppState(), message.getAppReturnUrl(), message.getAppNotifyUrl());
if (app == null) {
return null;
}
UpdateAppS.Builder builder = UpdateAppS.newBuilder();
builder.setHOpCode(httpPacket.hSession.headParam.hOpCode);
builder.setApp(AppAction.getAppBuilder(app));
HttpPacket packet = new HttpPacket(httpPacket.hSession.headParam.hOpCode, builder.build());
return packet;
}
示例13: getAppHandle
import org.grain.httpserver.HttpPacket; //導入依賴的package包/類
public HttpPacket getAppHandle(HttpPacket httpPacket) {
GetAppC message = (GetAppC) httpPacket.getData();
App app = AppAction.getAppById(message.getAppId());
if (app == null) {
return null;
}
GetAppS.Builder builder = GetAppS.newBuilder();
builder.setHOpCode(httpPacket.hSession.headParam.hOpCode);
builder.setApp(AppAction.getAppBuilder(app));
HttpPacket packet = new HttpPacket(httpPacket.hSession.headParam.hOpCode, builder.build());
return packet;
}
示例14: deleteTokenHandle
import org.grain.httpserver.HttpPacket; //導入依賴的package包/類
public HttpPacket deleteTokenHandle(HttpPacket httpPacket) throws HttpException {
boolean result = TokenAction.deleteToken(httpPacket.hSession.headParam.token);
if (!result) {
UCError errorPack = UCErrorPack.create(UCErrorCode.ERROR_CODE_9, httpPacket.hSession.headParam.hOpCode);
throw new HttpException(HOpCodeUCenter.UC_ERROR, errorPack);
}
DeleteTokenS.Builder builder = DeleteTokenS.newBuilder();
builder.setHOpCode(httpPacket.hSession.headParam.hOpCode);
HttpPacket packet = new HttpPacket(httpPacket.hSession.headParam.hOpCode, builder.build());
return packet;
}
示例15: createUserGroupHandle
import org.grain.httpserver.HttpPacket; //導入依賴的package包/類
public HttpPacket createUserGroupHandle(HttpPacket httpPacket) throws HttpException {
CreateUserGroupC message = (CreateUserGroupC) httpPacket.getData();
UserGroup userGroup = UserGroupAction.createUserGroup(message.getUserGroupName(), message.getUserGroupParentId());
if (userGroup == null) {
UCError errorPack = UCErrorPack.create(UCErrorCode.ERROR_CODE_10, httpPacket.hSession.headParam.hOpCode);
throw new HttpException(HOpCodeUCenter.UC_ERROR, errorPack);
}
CreateUserGroupS.Builder builder = CreateUserGroupS.newBuilder();
builder.setHOpCode(httpPacket.hSession.headParam.hOpCode);
builder.setUserGroup(UserGroupAction.getUserGroupDataBuilder(userGroup));
HttpPacket packet = new HttpPacket(httpPacket.hSession.headParam.hOpCode, builder.build());
return packet;
}