Fixed ByteBuffer memory leak
This commit is contained in:
@@ -110,32 +110,36 @@ public class AdminRequestHandler extends LotroServerRequestHandler implements Ur
|
||||
validateAdmin(request);
|
||||
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
String login = getFormParameterSafely(postDecoder, "login");
|
||||
try {
|
||||
String login = getFormParameterSafely(postDecoder, "login");
|
||||
|
||||
List<Player> similarPlayers = _playerDAO.findSimilarAccounts(login);
|
||||
if (similarPlayers == null)
|
||||
throw new HttpProcessingException(404);
|
||||
List<Player> similarPlayers = _playerDAO.findSimilarAccounts(login);
|
||||
if (similarPlayers == null)
|
||||
throw new HttpProcessingException(404);
|
||||
|
||||
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
|
||||
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
|
||||
|
||||
Document doc = documentBuilder.newDocument();
|
||||
Element players = doc.createElement("players");
|
||||
Document doc = documentBuilder.newDocument();
|
||||
Element players = doc.createElement("players");
|
||||
|
||||
for (Player similarPlayer : similarPlayers) {
|
||||
Element playerElem = doc.createElement("player");
|
||||
playerElem.setAttribute("id", String.valueOf(similarPlayer.getId()));
|
||||
playerElem.setAttribute("name", similarPlayer.getName());
|
||||
playerElem.setAttribute("password", similarPlayer.getPassword());
|
||||
playerElem.setAttribute("status", getStatus(similarPlayer));
|
||||
playerElem.setAttribute("createIp", similarPlayer.getCreateIp());
|
||||
playerElem.setAttribute("loginIp", similarPlayer.getLastIp());
|
||||
players.appendChild(playerElem);
|
||||
for (Player similarPlayer : similarPlayers) {
|
||||
Element playerElem = doc.createElement("player");
|
||||
playerElem.setAttribute("id", String.valueOf(similarPlayer.getId()));
|
||||
playerElem.setAttribute("name", similarPlayer.getName());
|
||||
playerElem.setAttribute("password", similarPlayer.getPassword());
|
||||
playerElem.setAttribute("status", getStatus(similarPlayer));
|
||||
playerElem.setAttribute("createIp", similarPlayer.getCreateIp());
|
||||
playerElem.setAttribute("loginIp", similarPlayer.getLastIp());
|
||||
players.appendChild(playerElem);
|
||||
}
|
||||
|
||||
doc.appendChild(players);
|
||||
|
||||
responseWriter.writeXmlResponse(doc);
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
|
||||
doc.appendChild(players);
|
||||
|
||||
responseWriter.writeXmlResponse(doc);
|
||||
}
|
||||
|
||||
private String getStatus(Player similarPlayer) {
|
||||
@@ -154,6 +158,7 @@ public class AdminRequestHandler extends LotroServerRequestHandler implements Ur
|
||||
validateAdmin(request);
|
||||
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
String login = getFormParameterSafely(postDecoder, "login");
|
||||
|
||||
if (login==null)
|
||||
@@ -163,12 +168,16 @@ public class AdminRequestHandler extends LotroServerRequestHandler implements Ur
|
||||
throw new HttpProcessingException(404);
|
||||
|
||||
responseWriter.writeHtmlResponse("OK");
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private void banMultiple(HttpRequest request, ResponseWriter responseWriter) throws Exception {
|
||||
validateAdmin(request);
|
||||
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
List<String> logins = getFormParametersSafely(postDecoder, "login");
|
||||
if (logins == null)
|
||||
throw new HttpProcessingException(404);
|
||||
@@ -179,12 +188,16 @@ public class AdminRequestHandler extends LotroServerRequestHandler implements Ur
|
||||
}
|
||||
|
||||
responseWriter.writeHtmlResponse("OK");
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private void banUserTemp(HttpRequest request, ResponseWriter responseWriter) throws Exception {
|
||||
validateAdmin(request);
|
||||
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
String login = getFormParameterSafely(postDecoder, "login");
|
||||
int duration = Integer.parseInt(getFormParameterSafely(postDecoder, "duration"));
|
||||
|
||||
@@ -192,24 +205,32 @@ public class AdminRequestHandler extends LotroServerRequestHandler implements Ur
|
||||
throw new HttpProcessingException(404);
|
||||
|
||||
responseWriter.writeHtmlResponse("OK");
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private void unBanUser(HttpRequest request, ResponseWriter responseWriter) throws Exception {
|
||||
validateAdmin(request);
|
||||
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
String login = getFormParameterSafely(postDecoder, "login");
|
||||
|
||||
if (!_adminService.unBanUser(login))
|
||||
throw new HttpProcessingException(404);
|
||||
|
||||
responseWriter.writeHtmlResponse("OK");
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private void addItemsToCollection(HttpRequest request, ResponseWriter responseWriter) throws Exception {
|
||||
validateAdmin(request);
|
||||
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
String reason = getFormParameterSafely(postDecoder, "reason");
|
||||
String product = getFormParameterSafely(postDecoder, "product");
|
||||
String collectionType = getFormParameterSafely(postDecoder, "collectionType");
|
||||
@@ -222,12 +243,16 @@ public class AdminRequestHandler extends LotroServerRequestHandler implements Ur
|
||||
_collectionManager.addItemsToPlayerCollection(true, reason, playerCollection.getKey(), createCollectionType(collectionType), productItems);
|
||||
|
||||
responseWriter.writeHtmlResponse("OK");
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private void addItems(HttpRequest request, ResponseWriter responseWriter) throws HttpProcessingException, Exception {
|
||||
validateAdmin(request);
|
||||
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
String players = getFormParameterSafely(postDecoder, "players");
|
||||
String product = getFormParameterSafely(postDecoder, "product");
|
||||
String collectionType = getFormParameterSafely(postDecoder, "collectionType");
|
||||
@@ -243,6 +268,9 @@ public class AdminRequestHandler extends LotroServerRequestHandler implements Ur
|
||||
}
|
||||
|
||||
responseWriter.writeHtmlResponse("OK");
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> getItems(String values) {
|
||||
@@ -281,6 +309,7 @@ public class AdminRequestHandler extends LotroServerRequestHandler implements Ur
|
||||
validateLeagueAdmin(request);
|
||||
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
String start = getFormParameterSafely(postDecoder, "start");
|
||||
String collectionType = getFormParameterSafely(postDecoder, "collectionType");
|
||||
String prizeMultiplier = getFormParameterSafely(postDecoder, "prizeMultiplier");
|
||||
@@ -308,12 +337,16 @@ public class AdminRequestHandler extends LotroServerRequestHandler implements Ur
|
||||
_leagueService.clearCache();
|
||||
|
||||
responseWriter.writeHtmlResponse("OK");
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private void previewConstructedLeague(HttpRequest request, ResponseWriter responseWriter) throws Exception {
|
||||
validateLeagueAdmin(request);
|
||||
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
String start = getFormParameterSafely(postDecoder, "start");
|
||||
String collectionType = getFormParameterSafely(postDecoder, "collectionType");
|
||||
String prizeMultiplier = getFormParameterSafely(postDecoder, "prizeMultiplier");
|
||||
@@ -363,12 +396,16 @@ public class AdminRequestHandler extends LotroServerRequestHandler implements Ur
|
||||
doc.appendChild(leagueElem);
|
||||
|
||||
responseWriter.writeXmlResponse(doc);
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private void addSoloDraftLeague(HttpRequest request, ResponseWriter responseWriter) throws Exception {
|
||||
validateLeagueAdmin(request);
|
||||
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
String format = getFormParameterSafely(postDecoder, "format");
|
||||
String start = getFormParameterSafely(postDecoder, "start");
|
||||
String serieDuration = getFormParameterSafely(postDecoder, "serieDuration");
|
||||
@@ -392,12 +429,16 @@ public class AdminRequestHandler extends LotroServerRequestHandler implements Ur
|
||||
_leagueService.clearCache();
|
||||
|
||||
responseWriter.writeHtmlResponse("OK");
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private void previewSoloDraftLeague(HttpRequest request, ResponseWriter responseWriter) throws Exception {
|
||||
validateLeagueAdmin(request);
|
||||
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
String format = getFormParameterSafely(postDecoder, "format");
|
||||
String start = getFormParameterSafely(postDecoder, "start");
|
||||
String serieDuration = getFormParameterSafely(postDecoder, "serieDuration");
|
||||
@@ -445,12 +486,16 @@ public class AdminRequestHandler extends LotroServerRequestHandler implements Ur
|
||||
doc.appendChild(leagueElem);
|
||||
|
||||
responseWriter.writeXmlResponse(doc);
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private void addSealedLeague(HttpRequest request, ResponseWriter responseWriter) throws Exception {
|
||||
validateLeagueAdmin(request);
|
||||
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
String format = getFormParameterSafely(postDecoder, "format");
|
||||
String start = getFormParameterSafely(postDecoder, "start");
|
||||
String serieDuration = getFormParameterSafely(postDecoder, "serieDuration");
|
||||
@@ -471,12 +516,16 @@ public class AdminRequestHandler extends LotroServerRequestHandler implements Ur
|
||||
_leagueService.clearCache();
|
||||
|
||||
responseWriter.writeHtmlResponse("OK");
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private void previewSealedLeague(HttpRequest request, ResponseWriter responseWriter) throws Exception {
|
||||
validateLeagueAdmin(request);
|
||||
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
String format = getFormParameterSafely(postDecoder, "format");
|
||||
String start = getFormParameterSafely(postDecoder, "start");
|
||||
String serieDuration = getFormParameterSafely(postDecoder, "serieDuration");
|
||||
@@ -521,18 +570,24 @@ public class AdminRequestHandler extends LotroServerRequestHandler implements Ur
|
||||
doc.appendChild(leagueElem);
|
||||
|
||||
responseWriter.writeXmlResponse(doc);
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private void setMotd(HttpRequest request, ResponseWriter responseWriter) throws HttpProcessingException, Exception {
|
||||
validateAdmin(request);
|
||||
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
|
||||
try {
|
||||
String motd = getFormParameterSafely(postDecoder, "motd");
|
||||
|
||||
_hallServer.setMOTD(motd);
|
||||
|
||||
responseWriter.writeHtmlResponse("OK");
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private void shutdown(HttpRequest request, ResponseWriter responseWriter) throws HttpProcessingException {
|
||||
|
||||
@@ -49,31 +49,35 @@ public class ChatRequestHandler extends LotroServerRequestHandler implements Uri
|
||||
|
||||
private void postMessages(HttpRequest request, String room, ResponseWriter responseWriter) throws Exception {
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
String participantId = getFormParameterSafely(postDecoder, "participantId");
|
||||
String message = getFormParameterSafely(postDecoder, "message");
|
||||
|
||||
Player resourceOwner = getResourceOwnerSafely(request, participantId);
|
||||
|
||||
ChatRoomMediator chatRoom = _chatServer.getChatRoom(room);
|
||||
if (chatRoom == null)
|
||||
throw new HttpProcessingException(404);
|
||||
|
||||
try {
|
||||
final boolean admin = resourceOwner.getType().contains("a");
|
||||
if (message != null && message.trim().length() > 0) {
|
||||
chatRoom.sendMessage(resourceOwner.getName(), StringEscapeUtils.escapeHtml(message), admin);
|
||||
responseWriter.writeXmlResponse(null);
|
||||
} else {
|
||||
ChatCommunicationChannel pollableResource = chatRoom.getChatRoomListener(resourceOwner.getName());
|
||||
ChatUpdateLongPollingResource polledResource = new ChatUpdateLongPollingResource(chatRoom, room, resourceOwner.getName(), admin, responseWriter);
|
||||
longPollingSystem.processLongPollingResource(polledResource, pollableResource);
|
||||
String participantId = getFormParameterSafely(postDecoder, "participantId");
|
||||
String message = getFormParameterSafely(postDecoder, "message");
|
||||
|
||||
Player resourceOwner = getResourceOwnerSafely(request, participantId);
|
||||
|
||||
ChatRoomMediator chatRoom = _chatServer.getChatRoom(room);
|
||||
if (chatRoom == null)
|
||||
throw new HttpProcessingException(404);
|
||||
|
||||
try {
|
||||
final boolean admin = resourceOwner.getType().contains("a");
|
||||
if (message != null && message.trim().length() > 0) {
|
||||
chatRoom.sendMessage(resourceOwner.getName(), StringEscapeUtils.escapeHtml(message), admin);
|
||||
responseWriter.writeXmlResponse(null);
|
||||
} else {
|
||||
ChatCommunicationChannel pollableResource = chatRoom.getChatRoomListener(resourceOwner.getName());
|
||||
ChatUpdateLongPollingResource polledResource = new ChatUpdateLongPollingResource(chatRoom, room, resourceOwner.getName(), admin, responseWriter);
|
||||
longPollingSystem.processLongPollingResource(polledResource, pollableResource);
|
||||
}
|
||||
} catch (SubscriptionExpiredException exp) {
|
||||
throw new HttpProcessingException(410);
|
||||
} catch (PrivateInformationException exp) {
|
||||
throw new HttpProcessingException(403);
|
||||
} catch (ChatCommandErrorException exp) {
|
||||
throw new HttpProcessingException(400);
|
||||
}
|
||||
} catch (SubscriptionExpiredException exp) {
|
||||
throw new HttpProcessingException(410);
|
||||
} catch (PrivateInformationException exp) {
|
||||
throw new HttpProcessingException(403);
|
||||
} catch (ChatCommandErrorException exp) {
|
||||
throw new HttpProcessingException(400);
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -168,6 +168,7 @@ public class CollectionRequestHandler extends LotroServerRequestHandler implemen
|
||||
|
||||
private void openPack(HttpRequest request, String collectionType, ResponseWriter responseWriter) throws Exception {
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
String participantId = getFormParameterSafely(postDecoder, "participantId");
|
||||
String selection = getFormParameterSafely(postDecoder, "selection");
|
||||
String packId = getFormParameterSafely(postDecoder, "pack");
|
||||
@@ -205,6 +206,9 @@ public class CollectionRequestHandler extends LotroServerRequestHandler implemen
|
||||
}
|
||||
|
||||
responseWriter.writeXmlResponse(doc);
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private void getCollectionTypes(HttpRequest request, ResponseWriter responseWriter) throws Exception {
|
||||
|
||||
@@ -61,6 +61,7 @@ public class DeckRequestHandler extends LotroServerRequestHandler implements Uri
|
||||
|
||||
private void getDeckStats(HttpRequest request, ResponseWriter responseWriter) throws Exception {
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
String participantId = getFormParameterSafely(postDecoder, "participantId");
|
||||
String contents = getFormParameterSafely(postDecoder, "deckContents");
|
||||
|
||||
@@ -97,10 +98,14 @@ public class DeckRequestHandler extends LotroServerRequestHandler implements Uri
|
||||
sb.append(invalid);
|
||||
|
||||
responseWriter.writeHtmlResponse(sb.toString());
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteDeck(HttpRequest request, ResponseWriter responseWriter) throws Exception {
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
String participantId = getFormParameterSafely(postDecoder, "participantId");
|
||||
String deckName = getFormParameterSafely(postDecoder, "deckName");
|
||||
Player resourceOwner = getResourceOwnerSafely(request, participantId);
|
||||
@@ -108,10 +113,14 @@ public class DeckRequestHandler extends LotroServerRequestHandler implements Uri
|
||||
_deckDao.deleteDeckForPlayer(resourceOwner, deckName);
|
||||
|
||||
responseWriter.writeXmlResponse(null);
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private void renameDeck(HttpRequest request, ResponseWriter responseWriter) throws Exception {
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
String participantId = getFormParameterSafely(postDecoder, "participantId");
|
||||
String deckName = getFormParameterSafely(postDecoder, "deckName");
|
||||
String oldDeckName = getFormParameterSafely(postDecoder, "oldDeckName");
|
||||
@@ -123,10 +132,14 @@ public class DeckRequestHandler extends LotroServerRequestHandler implements Uri
|
||||
throw new HttpProcessingException(404);
|
||||
|
||||
responseWriter.writeXmlResponse(serializeDeck(deck));
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private void saveDeck(HttpRequest request, ResponseWriter responseWriter) throws Exception {
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
String participantId = getFormParameterSafely(postDecoder, "participantId");
|
||||
String deckName = getFormParameterSafely(postDecoder, "deckName");
|
||||
String contents = getFormParameterSafely(postDecoder, "deckContents");
|
||||
@@ -147,6 +160,9 @@ public class DeckRequestHandler extends LotroServerRequestHandler implements Uri
|
||||
doc.appendChild(deckElem);
|
||||
|
||||
responseWriter.writeXmlResponse(doc);
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private void getDeckInHtml(HttpRequest request, ResponseWriter responseWriter) throws Exception {
|
||||
|
||||
@@ -70,6 +70,7 @@ public class GameRequestHandler extends LotroServerRequestHandler implements Uri
|
||||
|
||||
private void updateGameState(HttpRequest request, String gameId, ResponseWriter responseWriter) throws Exception {
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
String participantId = getFormParameterSafely(postDecoder, "participantId");
|
||||
int channelNumber = Integer.parseInt(getFormParameterSafely(postDecoder, "channelNumber"));
|
||||
Integer decisionId = null;
|
||||
@@ -100,6 +101,9 @@ public class GameRequestHandler extends LotroServerRequestHandler implements Uri
|
||||
} catch (SubscriptionExpiredException e) {
|
||||
throw new HttpProcessingException(410);
|
||||
}
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private class GameUpdateLongPollingResource implements LongPollingResource {
|
||||
@@ -149,6 +153,7 @@ public class GameRequestHandler extends LotroServerRequestHandler implements Uri
|
||||
|
||||
private void cancel(HttpRequest request, String gameId, ResponseWriter responseWriter) throws Exception {
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
String participantId = getFormParameterSafely(postDecoder, "participantId");
|
||||
Player resourceOwner = getResourceOwnerSafely(request, participantId);
|
||||
|
||||
@@ -159,10 +164,14 @@ public class GameRequestHandler extends LotroServerRequestHandler implements Uri
|
||||
gameMediator.cancel(resourceOwner);
|
||||
|
||||
responseWriter.writeXmlResponse(null);
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private void concede(HttpRequest request, String gameId, ResponseWriter responseWriter) throws Exception {
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
String participantId = getFormParameterSafely(postDecoder, "participantId");
|
||||
|
||||
Player resourceOwner = getResourceOwnerSafely(request, participantId);
|
||||
@@ -174,6 +183,9 @@ public class GameRequestHandler extends LotroServerRequestHandler implements Uri
|
||||
gameMediator.concede(resourceOwner);
|
||||
|
||||
responseWriter.writeXmlResponse(null);
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private void getCardInfo(HttpRequest request, String gameId, ResponseWriter responseWriter) throws Exception {
|
||||
|
||||
@@ -85,6 +85,7 @@ public class HallRequestHandler extends LotroServerRequestHandler implements Uri
|
||||
|
||||
private void joinTable(HttpRequest request, String tableId, ResponseWriter responseWriter) throws Exception {
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
String participantId = getFormParameterSafely(postDecoder, "participantId");
|
||||
Player resourceOwner = getResourceOwnerSafely(request, participantId);
|
||||
|
||||
@@ -96,19 +97,27 @@ public class HallRequestHandler extends LotroServerRequestHandler implements Uri
|
||||
} catch (HallException e) {
|
||||
responseWriter.writeXmlResponse(marshalException(e));
|
||||
}
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private void leaveTable(HttpRequest request, String tableId, ResponseWriter responseWriter) throws Exception {
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
String participantId = getFormParameterSafely(postDecoder, "participantId");
|
||||
Player resourceOwner = getResourceOwnerSafely(request, participantId);
|
||||
|
||||
_hallServer.leaveAwaitingTable(resourceOwner, tableId);
|
||||
responseWriter.writeXmlResponse(null);
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private void createTable(HttpRequest request, ResponseWriter responseWriter) throws Exception {
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
String participantId = getFormParameterSafely(postDecoder, "participantId");
|
||||
String format = getFormParameterSafely(postDecoder, "format");
|
||||
String deckName = getFormParameterSafely(postDecoder, "deckName");
|
||||
@@ -122,20 +131,28 @@ public class HallRequestHandler extends LotroServerRequestHandler implements Uri
|
||||
} catch (HallException e) {
|
||||
responseWriter.writeXmlResponse(marshalException(e));
|
||||
}
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private void dropFromTournament(HttpRequest request, String tournamentId, ResponseWriter responseWriter) throws Exception {
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
String participantId = getFormParameterSafely(postDecoder, "participantId");
|
||||
Player resourceOwner = getResourceOwnerSafely(request, participantId);
|
||||
|
||||
_hallServer.dropFromTournament(tournamentId, resourceOwner);
|
||||
|
||||
responseWriter.writeXmlResponse(null);
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private void joinQueue(HttpRequest request, String queueId, ResponseWriter responseWriter) throws Exception {
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
String participantId = getFormParameterSafely(postDecoder, "participantId");
|
||||
String deckName = getFormParameterSafely(postDecoder, "deckName");
|
||||
|
||||
@@ -147,10 +164,14 @@ public class HallRequestHandler extends LotroServerRequestHandler implements Uri
|
||||
} catch (HallException e) {
|
||||
responseWriter.writeXmlResponse(marshalException(e));
|
||||
}
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private void leaveQueue(HttpRequest request, String queueId, ResponseWriter responseWriter) throws Exception {
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
String participantId = getFormParameterSafely(postDecoder, "participantId");
|
||||
|
||||
Player resourceOwner = getResourceOwnerSafely(request, participantId);
|
||||
@@ -158,6 +179,9 @@ public class HallRequestHandler extends LotroServerRequestHandler implements Uri
|
||||
_hallServer.leaveQueue(queueId, resourceOwner);
|
||||
|
||||
responseWriter.writeXmlResponse(null);
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private Document marshalException(HallException e) throws ParserConfigurationException {
|
||||
@@ -294,6 +318,7 @@ public class HallRequestHandler extends LotroServerRequestHandler implements Uri
|
||||
|
||||
private void updateHall(HttpRequest request, ResponseWriter responseWriter) throws Exception {
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
String participantId = getFormParameterSafely(postDecoder, "participantId");
|
||||
int channelNumber = Integer.parseInt(getFormParameterSafely(postDecoder, "channelNumber"));
|
||||
|
||||
@@ -309,6 +334,9 @@ public class HallRequestHandler extends LotroServerRequestHandler implements Uri
|
||||
} catch (SubscriptionConflictException exp) {
|
||||
responseWriter.writeError(409);
|
||||
}
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private class HallUpdateLongPollingResource implements LongPollingResource {
|
||||
|
||||
@@ -60,6 +60,7 @@ public class LeagueRequestHandler extends LotroServerRequestHandler implements U
|
||||
|
||||
private void joinLeague(HttpRequest request, String leagueType, ResponseWriter responseWriter, String remoteIp) throws Exception {
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
String participantId = getFormParameterSafely(postDecoder, "participantId");
|
||||
|
||||
Player resourceOwner = getResourceOwnerSafely(request, participantId);
|
||||
@@ -72,6 +73,9 @@ public class LeagueRequestHandler extends LotroServerRequestHandler implements U
|
||||
throw new HttpProcessingException(409);
|
||||
|
||||
responseWriter.writeXmlResponse(null);
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private void getLeagueInformation(HttpRequest request, String leagueType, ResponseWriter responseWriter) throws Exception {
|
||||
|
||||
@@ -20,6 +20,7 @@ public class LoginRequestHandler extends LotroServerRequestHandler implements Ur
|
||||
public void handleRequest(String uri, HttpRequest request, Map<Type, Object> context, ResponseWriter responseWriter, String remoteIp) throws Exception {
|
||||
if (uri.equals("") && request.method() == HttpMethod.POST) {
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
String login = getFormParameterSafely(postDecoder, "login");
|
||||
String password = getFormParameterSafely(postDecoder, "password");
|
||||
|
||||
@@ -37,6 +38,9 @@ public class LoginRequestHandler extends LotroServerRequestHandler implements Ur
|
||||
} else {
|
||||
throw new HttpProcessingException(401);
|
||||
}
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
} else {
|
||||
throw new HttpProcessingException(404);
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ public class MerchantRequestHandler extends LotroServerRequestHandler implements
|
||||
|
||||
private void tradeInFoil(HttpRequest request, ResponseWriter responseWriter) throws Exception {
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
String participantId = getFormParameterSafely(postDecoder, "participantId");
|
||||
String blueprintId = getFormParameterSafely(postDecoder, "blueprintId");
|
||||
|
||||
@@ -70,10 +71,14 @@ public class MerchantRequestHandler extends LotroServerRequestHandler implements
|
||||
} catch (MerchantException exp) {
|
||||
responseWriter.writeXmlResponse(marshalException(exp));
|
||||
}
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private void sell(HttpRequest request, ResponseWriter responseWriter) throws Exception {
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
String participantId = getFormParameterSafely(postDecoder, "participantId");
|
||||
String blueprintId = getFormParameterSafely(postDecoder, "blueprintId");
|
||||
int price = Integer.parseInt(getFormParameterSafely(postDecoder, "price"));
|
||||
@@ -85,10 +90,14 @@ public class MerchantRequestHandler extends LotroServerRequestHandler implements
|
||||
} catch (MerchantException exp) {
|
||||
responseWriter.writeXmlResponse(marshalException(exp));
|
||||
}
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private void buy(HttpRequest request, ResponseWriter responseWriter) throws Exception {
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
String participantId = getFormParameterSafely(postDecoder, "participantId");
|
||||
String blueprintId = getFormParameterSafely(postDecoder, "blueprintId");
|
||||
int price = Integer.parseInt(getFormParameterSafely(postDecoder, "price"));
|
||||
@@ -100,6 +109,9 @@ public class MerchantRequestHandler extends LotroServerRequestHandler implements
|
||||
} catch (MerchantException exp) {
|
||||
responseWriter.writeXmlResponse(marshalException(exp));
|
||||
}
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private void getMerchantOffers(HttpRequest request, ResponseWriter responseWriter) throws Exception {
|
||||
|
||||
@@ -20,6 +20,7 @@ public class RegisterRequestHandler extends LotroServerRequestHandler implements
|
||||
public void handleRequest(String uri, HttpRequest request, Map<Type, Object> context, ResponseWriter responseWriter, String remoteIp) throws Exception {
|
||||
if (uri.equals("") && request.getMethod() == HttpMethod.POST) {
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
String login = getFormParameterSafely(postDecoder, "login");
|
||||
String password = getFormParameterSafely(postDecoder, "password");
|
||||
try {
|
||||
@@ -31,7 +32,9 @@ public class RegisterRequestHandler extends LotroServerRequestHandler implements
|
||||
} catch (LoginInvalidException exp) {
|
||||
throw new HttpProcessingException(400);
|
||||
}
|
||||
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
} else {
|
||||
throw new HttpProcessingException(404);
|
||||
}
|
||||
|
||||
@@ -115,6 +115,7 @@ public class SoloDraftRequestHandler extends LotroServerRequestHandler implement
|
||||
|
||||
private void makePick(HttpRequest request, String leagueType, ResponseWriter responseWriter) throws Exception {
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
String participantId = getFormParameterSafely(postDecoder, "participantId");
|
||||
String selectedChoiceId = getFormParameterSafely(postDecoder, "choiceId");
|
||||
|
||||
@@ -197,6 +198,9 @@ public class SoloDraftRequestHandler extends LotroServerRequestHandler implement
|
||||
}
|
||||
|
||||
responseWriter.writeXmlResponse(doc);
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private void appendAvailablePics(Document doc, Element rootElem, Iterable<SoloDraft.DraftChoice> availablePics) {
|
||||
|
||||
Reference in New Issue
Block a user