Skip to content
Permalink
Browse files

Version 569. Replaced web server implementation.

  • Loading branch information
n-y-z-o committed Feb 7, 2020
1 parent c835d17 commit 5910a179350d2f6562a6bc4e2bcb8087d2f4db1d
@@ -2,7 +2,7 @@

public class Version {

private static final int version = 568;
private static final int version = 569;

public static int getVersion() {

@@ -4,17 +4,23 @@

public class EndpointRequest {

private Endpoint endpoint;
private Map<String, String> queryParameters;
private Map<String, String> postParameters;
private byte[] sourceIpAddress;

public EndpointRequest(Map<String, String> queryParameters, Map<String, String> postParameters,
public EndpointRequest(Endpoint endpoint, Map<String, String> queryParameters, Map<String, String> postParameters,
byte[] sourceIpAddress) {
this.endpoint = endpoint;
this.queryParameters = queryParameters;
this.postParameters = postParameters;
this.sourceIpAddress = sourceIpAddress;
}

public Endpoint getEndpoint() {
return endpoint;
}

public Map<String, String> getQueryParameters() {
return queryParameters;
}
@@ -16,17 +16,22 @@

public static final String contentTypeDefault = contentTypeHtml;


private byte[] content;
private Map<String, String> headers = new HashMap<>();
private HttpStatusCode statusCode;

public EndpointResponse(byte[] content) {
this(content, contentTypeDefault);
}

public EndpointResponse(byte[] content, String contentType) {
this(content, contentType, HttpStatusCode.Ok200);
}

public EndpointResponse(byte[] content, String contentType, HttpStatusCode statusCode) {
this.content = content;
headers.put("Content-type", contentType);
this.statusCode = statusCode;
}

public byte[] getContent() {
@@ -44,4 +49,8 @@ public String getHeader(String name) {
public void setHeader(String name, String value) {
headers.put(name, value);
}

public HttpStatusCode getStatusCode() {
return statusCode;
}
}
@@ -0,0 +1,25 @@
package co.nyzo.verifier.web;

public enum HttpStatusCode {

// This enumeration provides only a small subset of status codes that the WebListener currently uses.

Ok200(200, "OK"),
NotFound404(404, "Not Found");

private int code;
private String label;

HttpStatusCode(int code, String label) {
this.code = code;
this.label = label;
}

public int getCode() {
return code;
}

public String getLabel() {
return label;
}
}

0 comments on commit 5910a17

Please sign in to comment.
You can’t perform that action at this time.