package de.tblsoft.search.response;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * Created by tbl on 19.11.17.
 */
public class Request {

    public Request(HttpServletRequest httpServletRequest) {
        this.path = httpServletRequest.getPathInfo();
        this.parameters = httpServletRequest.getParameterMap();
    }

    private String path = "";

    private Map<String, String[]> parameters;

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public Map<String, String[]> getParameters() {
        return parameters;
    }

    public void setParameters(Map<String, String[]> parameters) {
        this.parameters = parameters;
    }

    @Override
    public String toString() {
        return "Request{" +
                "path='" + path + '\'' +
                ", parameters=" + parameters +
                '}';
    }
}

@@ -30,16 +30,56 @@
 ponse;%0A%0A
+import com.google.common.base.Strings;%0A%0A
 import j
@@ -308,16 +308,18 @@
 .get
-PathInfo
+RequestURI
 ();%0A
@@ -386,523 +386,1221 @@
 ();%0A
-    %7D%0A%0A    private String path = %22%22;%0A%0A    private Map%3CString, String%5B%5D%3E parameters;%0A%0A    public String getPath() %7B%0A        return path;%0A    %7D%0A%0A    public void setPath(String path) %7B%0A        this.path = path;%0A    %7D%0A%0A    public Map%3CString, String%5B%5D%3E getParameters() %7B%0A        return parameters;%0A    %7D%0A%0A    public void setParameters(Map%3CString, String%5B%5D%3E parameters) %7B%0A        this.parameters = parameters;%0A    %7D%0A%0A    @Override%0A    public String toString() %7B%0A        return %22Request%7B%22 +%0A                %22path='%22 + path
+%0A        this.query = httpServletRequest.getQueryString();%0A        if(Strings.isNullOrEmpty(this.query)) %7B%0A            this.url = httpServletRequest.getRequestURL().toString();%0A        %7D else %7B%0A            this.url = httpServletRequest.getRequestURL().append(%22?%22).append(this.query).toString();%0A        %7D%0A    %7D%0A%0A    private String url;%0A%0A    private String path;%0A%0A    private String query;%0A%0A    private Map%3CString, String%5B%5D%3E parameters;%0A%0A    public String getPath() %7B%0A        return path;%0A    %7D%0A%0A    public void setPath(String path) %7B%0A        this.path = path;%0A    %7D%0A%0A    public Map%3CString, String%5B%5D%3E getParameters() %7B%0A        return parameters;%0A    %7D%0A%0A    public void setParameters(Map%3CString, String%5B%5D%3E parameters) %7B%0A        this.parameters = parameters;%0A    %7D%0A%0A    public String getUrl() %7B%0A        return url;%0A    %7D%0A%0A    public void setUrl(String url) %7B%0A        this.url = url;%0A    %7D%0A%0A    public String getQuery() %7B%0A        return query;%0A    %7D%0A%0A    public void setQuery(String query) %7B%0A        this.query = query;%0A    %7D%0A%0A    @Override%0A    public String toString() %7B%0A        return %22Request%7B%22 +%0A                %22url='%22 + url + '%5C'' +%0A                %22, path='%22 + path + '%5C'' +%0A                %22, query='%22 + query
  + '

add a search request object to the response - add path url and query