-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jbernal
committed
Sep 27, 2018
1 parent
31258b1
commit 53fdb0a
Showing
24 changed files
with
214 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package es.upm.miw.webpattern.http; | ||
|
||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
|
||
public class Client { | ||
|
||
private Server server; | ||
|
||
public Client(Server server) { | ||
this.server = server; | ||
} | ||
|
||
public HttpResponse submit(HttpRequest request) { | ||
Logger logger = LogManager.getLogger(this.getClass()); | ||
logger.info(request.toString()); | ||
HttpResponse response = this.server.submit(request); | ||
logger.info(response); | ||
logger.info("---------------------------------------ooo----------------------------------------"); | ||
if (response.getStatus().isError()) { | ||
throw new HttpException(response.getStatus(), response.getBody().toString()); | ||
} | ||
return response; | ||
} | ||
} |
26 changes: 0 additions & 26 deletions
26
src/main/java/es/upm/miw/webpattern/http/HttpClientService.java
This file was deleted.
Oops, something went wrong.
10 changes: 8 additions & 2 deletions
10
src/main/java/es/upm/miw/webpattern/http/HttpException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
package es.upm.miw.webpattern.http; | ||
|
||
public class HttpException extends RuntimeException { | ||
private static final long serialVersionUID = 7408093310374440283L; | ||
private static final long serialVersionUID = 7271728903247259709L; | ||
|
||
public HttpException(String msg) { | ||
private HttpStatus httpStatus; | ||
|
||
public HttpException(HttpStatus httpStatus, String msg) { | ||
super(msg); | ||
this.httpStatus = httpStatus; | ||
} | ||
|
||
public HttpStatus getHttpStatus() { | ||
return httpStatus; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.