Example usage for org.apache.http.client HttpResponseException getStatusCode

List of usage examples for org.apache.http.client HttpResponseException getStatusCode

Introduction

In this page you can find the example usage for org.apache.http.client HttpResponseException getStatusCode.

Prototype

public int getStatusCode() 

Source Link

Usage

From source file:com.jaspersoft.studio.server.protocol.ProxyConnection.java

@Override
public List<RepositoryPermission> getPermissions(ResourceDescriptor rd, IProgressMonitor monitor,
        PermissionOptions options) throws Exception {
    try {/*from w  w w  . jav a 2 s . c  o  m*/
        return c.getPermissions(rd, monitor, options);
    } catch (Exception e) {
        if (e instanceof HttpResponseException) {
            HttpResponseException he = (HttpResponseException) e;
            if (he.getStatusCode() == 401 && !error401) {
                c.connect(monitor, getServerProfile());
                error401 = true;
                return c.getPermissions(rd, monitor, options);
            }
        }
        error401 = false;
        throw e;
    }
}

From source file:com.jaspersoft.studio.server.protocol.ProxyConnection.java

@Override
public List<RepositoryPermission> setPermissions(ResourceDescriptor rd, List<RepositoryPermission> perms,
        PermissionOptions options, IProgressMonitor monitor) throws Exception {
    try {/*from   ww w.j  av a2  s  .  c om*/
        return c.setPermissions(rd, perms, options, monitor);
    } catch (Exception e) {
        if (e instanceof HttpResponseException) {
            HttpResponseException he = (HttpResponseException) e;
            if (he.getStatusCode() == 401 && !error401) {
                c.connect(monitor, getServerProfile());
                error401 = true;
                return c.setPermissions(rd, perms, options, monitor);
            }
        }
        error401 = false;
        throw e;
    }
}

From source file:com.jaspersoft.studio.server.protocol.ProxyConnection.java

@Override
public ResourceDescriptor delete(IProgressMonitor monitor, ResourceDescriptor rd, ResourceDescriptor runit)
        throws Exception {
    try {/*from  w  w  w.j  av  a2 s  .c om*/
        c.delete(monitor, rd, runit);
    } catch (Exception e) {
        if (e instanceof HttpResponseException) {
            HttpResponseException he = (HttpResponseException) e;
            if (he.getStatusCode() == 401 && !error401) {
                c.connect(monitor, getServerProfile());
                error401 = true;
                return c.delete(monitor, rd, runit);
            }
        }
        error401 = false;
        throw e;
    }
    return null;
}

From source file:com.jaspersoft.studio.server.protocol.ProxyConnection.java

@Override
public ReportExecution runReport(IProgressMonitor monitor, ReportExecution repExec) throws Exception {
    try {/*from  www.ja v a  2 s  .co m*/
        return c.runReport(monitor, repExec);
    } catch (Exception e) {
        if (e instanceof HttpResponseException) {
            HttpResponseException he = (HttpResponseException) e;
            if (he.getStatusCode() == 401 && !error401) {
                c.connect(monitor, getServerProfile());
                error401 = true;
                return c.runReport(monitor, repExec);
            }
            repExec.setStatus("failed");
            return repExec;
        }
        error401 = false;
        throw e;
    }
}

From source file:com.jaspersoft.studio.server.protocol.ProxyConnection.java

@Override
public void reorderInputControls(String uri, List<ResourceDescriptor> rd, IProgressMonitor monitor)
        throws Exception {
    try {/*from w  w w.j  a  v a  2  s  .  c o  m*/
        c.reorderInputControls(uri, rd, monitor);
    } catch (Exception e) {
        if (e instanceof HttpResponseException) {
            HttpResponseException he = (HttpResponseException) e;
            if (he.getStatusCode() == 401 && !error401) {
                c.connect(monitor, getServerProfile());
                error401 = true;
                c.reorderInputControls(uri, rd, monitor);
                return;
            }
        }
        error401 = false;
        throw e;
    }
}

From source file:com.jaspersoft.studio.server.protocol.ProxyConnection.java

@Override
public ResourceDescriptor move(IProgressMonitor monitor, ResourceDescriptor rd, String destFolderURI)
        throws Exception {
    try {/*ww w .j  a v  a  2 s  . com*/
        rd = c.move(monitor, rd, destFolderURI);
    } catch (Exception e) {
        if (e instanceof HttpResponseException) {
            HttpResponseException he = (HttpResponseException) e;
            if (he.getStatusCode() == 401 && !error401) {
                c.connect(monitor, getServerProfile());
                error401 = true;
                return move(monitor, rd, destFolderURI);
            }
        }
        error401 = false;
        throw e;
    }
    rd.setChildrenDirty(false);
    return rd;
}

From source file:com.jaspersoft.studio.server.protocol.ProxyConnection.java

@Override
public ResourceDescriptor copy(IProgressMonitor monitor, ResourceDescriptor rd, String destFolderURI)
        throws Exception {
    try {/*from   w ww  . j  a v  a2  s .  c  o  m*/
        rd = c.copy(monitor, rd, destFolderURI);
    } catch (Exception e) {
        if (e instanceof HttpResponseException) {
            HttpResponseException he = (HttpResponseException) e;
            if (he.getStatusCode() == 401 && !error401) {
                c.connect(monitor, getServerProfile());
                error401 = true;
                return c.copy(monitor, rd, destFolderURI);
            }
        }
        error401 = false;
        throw e;
    }
    rd.setChildrenDirty(false);
    return rd;
}

From source file:com.jaspersoft.studio.server.protocol.ProxyConnection.java

@Override
public ResourceDescriptor addOrModifyResource(IProgressMonitor monitor, ResourceDescriptor rd, File inputFile)
        throws Exception {
    try {// w ww. j  a v a  2s  .c  o m
        rd = c.addOrModifyResource(monitor, rd, inputFile);
    } catch (Exception e) {
        if (e instanceof HttpResponseException) {
            HttpResponseException he = (HttpResponseException) e;
            if (he.getStatusCode() == 401 && !error401) {
                c.connect(monitor, getServerProfile());
                error401 = true;
                return c.addOrModifyResource(monitor, rd, inputFile);
            }
        }
        error401 = false;
        throw e;
    }
    rd.setChildrenDirty(false);
    return rd;
}

From source file:com.jaspersoft.studio.server.protocol.ProxyConnection.java

@Override
public ResourceDescriptor modifyReportUnitResource(IProgressMonitor monitor, ResourceDescriptor runit,
        ResourceDescriptor rd, File inFile) throws Exception {
    try {//  w w w.  j  ava2 s .co m
        rd = c.modifyReportUnitResource(monitor, runit, rd, inFile);
    } catch (Exception e) {
        if (e instanceof HttpResponseException) {
            HttpResponseException he = (HttpResponseException) e;
            if (he.getStatusCode() == 401 && !error401) {
                c.connect(monitor, getServerProfile());
                error401 = true;
                return c.modifyReportUnitResource(monitor, runit, rd, inFile);
            }
        }
        error401 = false;
        throw e;
    }
    rd.setChildrenDirty(false);
    return rd;
}

From source file:com.jaspersoft.studio.server.protocol.ProxyConnection.java

@Override
public ResourceDescriptor initInputControls(String uri, String type, IProgressMonitor monitor)
        throws Exception {
    try {//from   w  w  w. ja  v  a2 s .c  om
        return c.initInputControls(uri, type, monitor);
    } catch (Exception e) {
        if (e instanceof HttpResponseException) {
            HttpResponseException he = (HttpResponseException) e;
            if (he.getStatusCode() == 401 && !error401) {
                c.connect(monitor, getServerProfile());
                error401 = true;
                return c.initInputControls(uri, type, monitor);
            }
        }
        error401 = false;
        throw e;
    }
    // ResourceDescriptor rd = new ResourceDescriptor();
    // rd.setUriString(WSClientHelper.getReportUnitUri(uri));
    // rd.setWsType(ResourceDescriptor.TYPE_REPORTUNIT);
    // return rd;
}