Produced by Araxis Merge on 12/21/2017 6:15:12 PM Eastern Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | Genisis_2.0_v7_bld7.zip\TS\CLI\src\main\java\gov\va\genisis2 | HttpClient.java | Thu Dec 14 19:56:37 2017 UTC |
| 2 | Genisis_2.0_v7_bld7.zip\TS\CLI\src\main\java\gov\va\genisis2 | HttpClient.java | Thu Dec 21 21:02:54 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 138 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | package go v.va.genis is2; | |
| 2 | ||
| 3 | import jav a.io.Buffe redReader; | |
| 4 | import jav a.io.DataO utputStrea m; | |
| 5 | import jav a.io.IOExc eption; | |
| 6 | import jav a.io.Input StreamRead er; | |
| 7 | import jav a.net.Http URLConnect ion; | |
| 8 | import jav a.net.URL; | |
| 9 | ||
| 10 | import org .apache.lo g4j.Logger ; | |
| 11 | ||
| 12 | /** | |
| 13 | * Client to make HT TP request s | |
| 14 | * @author PII | |
| 15 | * | |
| 16 | */ | |
| 17 | public cla ss HttpCli ent { | |
| 18 | ||
| 19 | pr ivate stat ic final L ogger LOGG ER = Logge r.getLogge r(HttpClie nt.class); | |
| 20 | ||
| 21 | pu blic HttpC lient() { | |
| 22 | } | |
| 23 | ||
| 24 | pu blic void sendingUpd ate(String url, bool ean post, String pay load) { | |
| 25 | ||
| 26 | try { | |
| 27 | URL ob j = new UR L(url); | |
| 28 | HttpUR LConnectio n con = (H ttpURLConn ection) ob j.openConn ection(); | |
| 29 | ||
| 30 | // Set ting basic post requ est | |
| 31 | if (po st) | |
| 32 | con.setR equestMeth od("POST") ; | |
| 33 | else | |
| 34 | con.setR equestMeth od("DELETE "); | |
| 35 | ||
| 36 | con.se tRequestPr operty("Ac cept-Encod ing", "app lication/j son"); | |
| 37 | con.se tRequestPr operty("Co ntent-Type ", "applic ation/json "); | |
| 38 | ||
| 39 | con.se tDoOutput( true); | |
| 40 | DataOu tputStream wr = new DataOutput Stream(con .getOutput Stream()); | |
| 41 | wr.wri teBytes(pa yload); | |
| 42 | wr.flu sh(); | |
| 43 | wr.clo se(); | |
| 44 | ||
| 45 | int re sponseCode = con.get ResponseCo de(); | |
| 46 | System .out.print ln("nSendi ng 'POST' request to URL : " + url); | |
| 47 | LOGGER .debug("nS ending 'PO ST' reques t to URL : " + url); | |
| 48 | System .out.print ln("Post D ata : " + payload); | |
| 49 | LOGGER .debug("Po st Data : " + payloa d); | |
| 50 | System .out.print ln("Respon se Code : " + respon seCode); | |
| 51 | LOGGER .debug("Re sponse Cod e : " + re sponseCode ); | |
| 52 | ||
| 53 | Buffer edReader i n = new Bu fferedRead er(new Inp utStreamRe ader(con.g etInputStr eam())); | |
| 54 | String output; | |
| 55 | String Buffer res ponse = ne w StringBu ffer(); | |
| 56 | ||
| 57 | while ((output = in.readLi ne()) != n ull) { | |
| 58 | response .append(ou tput); | |
| 59 | } | |
| 60 | in.clo se(); | |
| 61 | ||
| 62 | // pri nting resu lt from re sponse | |
| 63 | System .out.print ln(respons e.toString ()); | |
| 64 | LOGGER .debug(res ponse.toSt ring()); | |
| 65 | } ca tch (IOExc eption e) { | |
| 66 | System .err.print ln(e.getMe ssage()); | |
| 67 | LOGGER .error(e.g etMessage( )); | |
| 68 | } | |
| 69 | } | |
| 70 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.