package vrampal.connectfour.webjsp;

import javax.servlet.http.HttpServletRequest;

import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor
public class ConnectFourRequest {

  /**
   * Type: String
   */
  public static final String MAIN_MESSAGE = "main_message";

  /**
   * Type: String
   */
  public static final String SUB_MESSAGE = "sub_message";

  /**
   * Type: String
   */
  public static final String GAME_ID = "game_id";

  private final HttpServletRequest req;

  public ConnectFourSession getSession() {
    // TODO should we have a cache ?
    return new ConnectFourSession(req.getSession());
  }

  public String getParameter(String name) {
    return req.getParameter(name);
  }

  public String getMainMessage() {
    return req.getParameter(MAIN_MESSAGE);
  }

  public void setMainMessage(String mainMessage) {
    req.setAttribute(MAIN_MESSAGE, mainMessage);
  }

  public String getSubMessage() {
    return req.getParameter(SUB_MESSAGE);
  }

  public void setSubMessage(String subMessage) {
    req.setAttribute(SUB_MESSAGE, subMessage);
  }

  public String getGameId() {
    return req.getParameter(GAME_ID);
  }

  public void setGameId(String gameId) {
    req.setAttribute(GAME_ID, gameId);
  }

}

@@ -501,24 +501,52 @@
 est req;%0D%0A%0D%0A
+  // ----- Session -----%0D%0A%0D%0A
   public Con
@@ -581,46 +581,8 @@
  %7B%0D%0A
-    // TODO should we have a cache ?%0D%0A
     
@@ -630,32 +630,71 @@
 ion());%0D%0A  %7D%0D%0A%0D%0A
+  // ----- Request parameters -----%0D%0A%0D%0A
   public String 
@@ -757,32 +757,71 @@
 (name);%0D%0A  %7D%0D%0A%0D%0A
+  // ----- Request attributes -----%0D%0A%0D%0A
   public String 
@@ -851,32 +851,41 @@
  return 
-req.getParame
+(String) req.getAttribu
 te
-r
 (MAIN_ME
@@ -1055,32 +1055,41 @@
  return 
-req.getParame
+(String) req.getAttribu
 te
-r
 (SUB_MES
@@ -1250,32 +1250,41 @@
  return 
-req.getParame
+(String) req.getAttribu
 te
-r
 (GAME_ID

Fix attributes and not parameters