Changeset 3362


Ignore:
Timestamp:
08/12/13 12:34:36 (11 years ago)
Author:
teckart
Message:

Fixed broken Handle resolution. New implementation is omiting requests to resource server (fixing ticket #290). Enables tests again that were disabled in commit r2949(fixing ticket #319)

Location:
vlo/trunk/vlo_web_app/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • vlo/trunk/vlo_web_app/src/main/java/eu/clarin/cmdi/vlo/pages/LinkPanel.java

    r2829 r3362  
    9595                try{
    9696                    u = new URL(resourceLink);
    97                     System.out.println(resourceLink);
    9897                    URLConnection c = u.openConnection();
    9998                    if(c instanceof HttpURLConnection){
    10099                        con = (HttpURLConnection) c;
     100                        con.setInstanceFollowRedirects(false);
    101101                    }
    102102                    if(con != null){
    103103                        if(con.getResponseCode() == HttpURLConnection.HTTP_MOVED_PERM ||
    104104                                con.getResponseCode() == HttpURLConnection.HTTP_MOVED_TEMP ||
    105                                 con.getResponseCode() == HttpURLConnection.HTTP_SEE_OTHER){
    106                            result = con.getURL().toString();
    107 /*                            for (Map.Entry<String, List<String>> header : con.getHeaderFields().entrySet()) {
    108                                 if(header != null && header.getKey() != null){
    109                                     System.out.println("XXX:" + header.getKey());
    110                                     System.out.println(header.getValue().get(0));
    111                                     if(header.getKey().equals("Location")){
    112                                         result = header.getValue().get(0);
    113                                     }
    114                                 }
    115                             }*/
     105                                con.getResponseCode() == HttpURLConnection.HTTP_SEE_OTHER) {
     106                                String location = con.getHeaderField("location");
     107                                        if(location != null)
     108                                                result = location;
    116109                        }
    117110                    }
  • vlo/trunk/vlo_web_app/src/test/java/eu/clarin/cmdi/vlo/pages/ResourceLinkPanelTest.java

    r2988 r3362  
    3636
    3737        uit = totest.getNameFromLink(_RESOLVE_STRING);
    38         // from at least 29.05.2013 this was not working
    39         // Assert.assertTrue("Returns the resolved url of the handle pid", uit.equals(_RESOLVE_OUT));
     38        Assert.assertTrue("Returns the resolved url of the handle pid", uit.equals(_RESOLVE_OUT));
    4039    }
    4140}
Note: See TracChangeset for help on using the changeset viewer.