Skip to content

Commit

Permalink
improving the API and the documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
laminba2003 committed Oct 25, 2020
1 parent ad14686 commit c85a513
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/gservlet/ContextWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class ContextWrapper implements ServletContext {
*
* Constructs a ContextWrapper for the given ServletContext
*
* @param context the servlet context
* @param context the ServletContext object
*
*/
public ContextWrapper(ServletContext context) {
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/gservlet/GServletApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
package org.gservlet;

import static org.gservlet.Constants.APP_CONFIG_FILE;

import java.io.File;
import java.io.FileReader;
import java.io.IOException;
Expand Down
17 changes: 12 additions & 5 deletions src/main/java/org/gservlet/RequestWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class RequestWrapper extends HttpServletRequestWrapper {
*
* Constructs a RequestWrapper for the given HttpServletRequest
*
* @param request the request object
* @param request the HttpServletRequest object
*
*/
public RequestWrapper(HttpServletRequest request) {
Expand All @@ -59,17 +59,24 @@ public void propertyMissing(String name, Object value) {

/**
*
* Gets an attribute or a parameter value
* Gets a parameter or an attribute value
*
* <p>
* if the name is equals to body and the request content-type is application/json,
* this method parses the JSON request payload and returns a Groovy object.
* </p>
*
* @param name the parameter or attribute name
* @return the parameter or attribute value
*
* @param name the attribute or parameter name
* @return the attribute or parameter value
* @throws IOException the IOException
*/
public Object propertyMissing(String name) throws IOException {
if (name != null && name.equals("body") && getContentType().equalsIgnoreCase("application/json")) {
return new JsonSlurper().parse(getInputStream());
}
Object value = getParameter(name);
value = value != null ? value : getParameterValues(name);
return value != null ? value : getAttribute(name);
}

Expand All @@ -78,7 +85,7 @@ public Object propertyMissing(String name) throws IOException {
* Returns the file name of a part that was received within a multipart/form-data POST request
*
* @param part the part that was received within a multipart/form-data POST request.
* @return the file name or null if it cannot be found
* @return the file name or null if it cannot be decoded
*
*/
public String getFileName(Part part) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/gservlet/SessionWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class SessionWrapper implements HttpSession, Serializable {
*
* Constructs a SessionWrapper for the given HttpSession
*
* @param session the session object
* @param session the HttpSession object
*
*/
public SessionWrapper(HttpSession session) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/gservlet/StartupListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

/**
*
* Bootstraps the application
* Bootstraps the GServlet application
*
* @author Mamadou Lamine Ba
*
Expand Down

0 comments on commit c85a513

Please sign in to comment.