Produced by Araxis Merge on 12/5/2017 12:06:36 PM Central 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 | IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\CacheWeb\src\gov\va\med\cache\rest | CacheItemServlet.java | Mon Dec 4 21:34:10 2017 UTC |
| 2 | IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\CacheWeb\src\gov\va\med\cache\rest | CacheItemServlet.java | Mon Dec 4 21:58:04 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 358 |
| 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.med.c ache.rest; | |
| 2 | ||
| 3 | import gov .va.med.ca che.CacheM anagementS ervice; | |
| 4 | import gov .va.med.ca che.gui.se rver.Imagi ngCacheMan agementSer viceImpl; | |
| 5 | import gov .va.med.ca che.gui.sh ared.CACHE _POPULATIO N_DEPTH; | |
| 6 | import gov .va.med.ca che.gui.sh ared.Cache ItemPath; | |
| 7 | import gov .va.med.im aging.stor age.cache. Cache; | |
| 8 | import gov .va.med.im aging.stor age.cache. Group; | |
| 9 | import gov .va.med.im aging.stor age.cache. Instance; | |
| 10 | import gov .va.med.im aging.stor age.cache. Region; | |
| 11 | import gov .va.med.im aging.stor age.cache. exceptions .CacheExce ption; | |
| 12 | ||
| 13 | import jav a.io.IOExc eption; | |
| 14 | ||
| 15 | import jav ax.managem ent.MBeanE xception; | |
| 16 | import jav ax.servlet .ServletEx ception; | |
| 17 | import jav ax.servlet .http.Http ServletReq uest; | |
| 18 | import jav ax.servlet .http.Http ServletRes ponse; | |
| 19 | ||
| 20 | import org .apache.lo gging.log4 j.LogManag er; | |
| 21 | import org .apache.lo gging.log4 j.Logger; | |
| 22 | ||
| 23 | /** | |
| 24 | * | |
| 25 | * @author
|
|
| 26 | * | |
| 27 | */ | |
| 28 | public cla ss CacheIt emServlet | |
| 29 | extends Ht tpMethodHa ckServlet | |
| 30 | { | |
| 31 | pr ivate stat ic final l ong serial VersionUID = 1L; | |
| 32 | pr ivate Imag ingCacheMa nagementSe rviceImpl cacheManag ement = nu ll; | |
| 33 | pr ivate fina l Logger l ogger = Lo gManager.g etLogger(t his.getCla ss()); | |
| 34 | ||
| 35 | /* * | |
| 36 | * Construct or of the object. | |
| 37 | * / | |
| 38 | pu blic Cache ItemServle t() | |
| 39 | { | |
| 40 | supe r(); | |
| 41 | } | |
| 42 | ||
| 43 | /* * | |
| 44 | * Initializ ation of t he servlet . <br> | |
| 45 | * | |
| 46 | * @throws S ervletExce ption if a n error oc curs | |
| 47 | * / | |
| 48 | pu blic void init() | |
| 49 | th rows Servl etExceptio n | |
| 50 | { | |
| 51 | cach eManagemen t = new Im agingCache Management ServiceImp l(); | |
| 52 | } | |
| 53 | ||
| 54 | /* * | |
| 55 | * @see http ://www.iet f.org/rfc/ rfc2616.tx t | |
| 56 | * | |
| 57 | * "The HEAD method is identical to GET ex cept that the server MUST NOT | |
| 58 | * return a message-bo dy in the response. The metain formation contained | |
| 59 | * in the HT TP headers in respon se to a HE AD request SHOULD be identical | |
| 60 | * to the in formation sent in re sponse to a GET requ est. This method can | |
| 61 | * be used f or obtaini ng metainf ormation a bout the e ntity impl ied by the | |
| 62 | * request w ithout tra nsferring the entity -body itse lf. This m ethod is | |
| 63 | * often use d for test ing hypert ext links for validi ty, access ibility, | |
| 64 | * and recen t modifica tion." | |
| 65 | * / | |
| 66 | @O verride | |
| 67 | pr otected vo id doHead( HttpServle tRequest r eq, HttpSe rvletRespo nse resp) | |
| 68 | th rows Servl etExceptio n, IOExcep tion | |
| 69 | { | |
| 70 | Cach eItemPath path = Ide ntifierUti lity.creat e(req); | |
| 71 | ||
| 72 | try | |
| 73 | { | |
| 74 | Cache cache = Ca cheManagem entService .getCache( path.getCa cheName()) ; | |
| 75 | switch (path.getE ndpointDep th()) | |
| 76 | { | |
| 77 | case C ACHE: | |
| 78 | resp.set ContentTyp e("applica tion/xml") ; | |
| 79 | resp.add DateHeader ("Last-Mod ified", Sy stem.curre ntTimeMill is()); | |
| 80 | break; | |
| 81 | case R EGION: | |
| 82 | resp.set ContentTyp e("applica tion/xml") ; | |
| 83 | Region r egion = ca che.getReg ion(path.g etRegionNa me()); | |
| 84 | resp.add DateHeader ("Last-Mod ified", Sy stem.curre ntTimeMill is()); | |
| 85 | resp.add Header("Co ntent-Leng th", Long. toString(r egion.getU sedSpace() )); | |
| 86 | break; | |
| 87 | case G ROUP0: | |
| 88 | case G ROUP1: | |
| 89 | case G ROUP2: | |
| 90 | case G ROUP3: | |
| 91 | case G ROUP4: | |
| 92 | case G ROUP5: | |
| 93 | case G ROUP6: | |
| 94 | case G ROUP7: | |
| 95 | case G ROUP8: | |
| 96 | case G ROUP9: | |
| 97 | resp.set ContentTyp e("applica tion/xml") ; | |
| 98 | Group gr oup = cach e.getGroup (path.getR egionName( ), path.ge tGroupName s()); | |
| 99 | resp.add DateHeader ("Last-Mod ified", gr oup.getLas tAccessed( ).getTime( )); | |
| 100 | resp.add Header("Co ntent-Leng th", Long. toString(g roup.getSi ze())); | |
| 101 | break; | |
| 102 | case I NSTANCE: | |
| 103 | Instance instance = cache.ge tInstance( path.getRe gionName() , path.get GroupNames (), path.g etInstance Name()); | |
| 104 | resp.add DateHeader ("Last-Mod ified", in stance.get LastAccess ed().getTi me()); | |
| 105 | resp.add Header("Co ntent-Leng th", Long. toString(i nstance.ge tSize())); | |
| 106 | resp.add Header("x- checksum", instance. getChecksu mValue()); | |
| 107 | resp.add Header("x- persistent ", Boolean .toString( instance.i sPersisten t())); | |
| 108 | resp.add Header("Co ntent-type ", instanc e.getMedia Type()); | |
| 109 | break; | |
| 110 | } | |
| 111 | } | |
| 112 | catc h (MBeanEx ception e) | |
| 113 | { | |
| 114 | e.prin tStackTrac e(); | |
| 115 | } | |
| 116 | catc h (CacheEx ception e) | |
| 117 | { | |
| 118 | e.prin tStackTrac e(); | |
| 119 | } | |
| 120 | } | |
| 121 | ||
| 122 | @O verride | |
| 123 | pr otected vo id doGet(H ttpServlet Request re q, HttpSer vletRespon se resp) | |
| 124 | th rows Servl etExceptio n, IOExcep tion | |
| 125 | { | |
| 126 | Cach eItemPath path = Ide ntifierUti lity.creat e(req); | |
| 127 | ||
| 128 | try | |
| 129 | { | |
| 130 | Cache cache = Ca cheManagem entService .getCache( path.getCa cheName()) ; | |
| 131 | } | |
| 132 | catc h (MBeanEx ception e) | |
| 133 | { | |
| 134 | e.prin tStackTrac e(); | |
| 135 | } | |
| 136 | catc h (CacheEx ception e) | |
| 137 | { | |
| 138 | e.prin tStackTrac e(); | |
| 139 | } | |
| 140 | } | |
| 141 | ||
| 142 | /* * | |
| 143 | * The doDel ete method of the se rvlet. <br > | |
| 144 | * | |
| 145 | * @param re quest the request se nd by the client to the server | |
| 146 | * @param re sponse the response send by th e server t o the clie nt | |
| 147 | * @throws S ervletExce ption if a n error oc curred | |
| 148 | * @throws I OException if an err or occurre d | |
| 149 | * / | |
| 150 | @O verride | |
| 151 | pu blic void doDelete(H ttpServlet Request re quest, Htt pServletRe sponse res ponse) | |
| 152 | th rows Servl etExceptio n, IOExcep tion | |
| 153 | { | |
| 154 | Cach eItemPath cacheItemP ath = Iden tifierUtil ity.create (request); | |
| 155 | ||
| 156 | logg er.info("D eleteCache ItemServle t.doGet() enter"); | |
| 157 | resp onse.setCo ntentType( "text/html "); | |
| 158 | resp onse.addHe ader("Cach e-Control" , "no-cach e"); | |
| 159 | resp onse.addHe ader("Prag ma", "no-c ache"); | |
| 160 | ||
| 161 | if( cacheItemP ath.getEnd pointDepth ().ordinal () < CACHE _POPULATIO N_DEPTH.GR OUP0.ordin al() ) | |
| 162 | throw new Servle tException ("Cache, r egion and at least o ne Group n ame must b e specifie d to delet e a cache item."); | |
| 163 | ||
| 164 | if(c acheItemPa th.getInst anceName() != null) | |
| 165 | cacheM anagement. deleteInst ance(cache ItemPath); | |
| 166 | else | |
| 167 | cacheM anagement. deleteGrou p(cacheIte mPath); | |
| 168 | ||
| 169 | resp onse.setSt atus(202); | |
| 170 | resp onse.getWr iter().wri te(CacheMa nagementSe rvice.buil dQueryStri ng(cacheIt emPath.cre ateParentP ath())); | |
| 171 | } | |
| 172 | ||
| 173 | /* * | |
| 174 | * Destructi on of the servlet. < br> | |
| 175 | * / | |
| 176 | pu blic void destroy() | |
| 177 | { | |
| 178 | supe r.destroy( ); | |
| 179 | } | |
| 180 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.