Search in sources :

Example 6 with IHttpResponse

use of de.janrufmonitor.service.commons.http.IHttpResponse in project janrufmonitor by tbrandt77.

the class ClientDialerCommand method isExecutable.

public boolean isExecutable() {
    // introduced since some TAPIs might reset and stop monitoring after calling GetDialExtension
    boolean isSecureMonitor = Boolean.parseBoolean(System.getProperty(IJAMConst.SYSTEM_MONITOR_SECURE, "false"));
    if (isSecureMonitor)
        return false;
    if (isConnected()) {
        IRequester r = this.getRequester(new GetDialExtensions());
        IHttpResponse resp = r.request();
        return (resp.getCode() != 404 && resp.getCode() != 500);
    }
    return false;
}
Also used : GetDialExtensions(de.janrufmonitor.service.client.request.handler.GetDialExtensions) IRequester(de.janrufmonitor.service.commons.http.IRequester) IHttpResponse(de.janrufmonitor.service.commons.http.IHttpResponse)

Example 7 with IHttpResponse

use of de.janrufmonitor.service.commons.http.IHttpResponse in project janrufmonitor by tbrandt77.

the class ClientClickDialAction method isEnabled.

public boolean isEnabled() {
    // introduced since some TAPIs might reset and stop monitoring after calling GetDialExtension
    boolean isSecureMonitor = Boolean.parseBoolean(System.getProperty(IJAMConst.SYSTEM_MONITOR_SECURE, "false"));
    if (isSecureMonitor)
        return false;
    if (isConnected()) {
        IRequester r = this.getRequester(new GetDialExtensions());
        IHttpResponse resp = r.request();
        return (resp.getCode() != 404 && resp.getCode() != 500);
    }
    return false;
}
Also used : GetDialExtensions(de.janrufmonitor.service.client.request.handler.GetDialExtensions) IRequester(de.janrufmonitor.service.commons.http.IRequester) IHttpResponse(de.janrufmonitor.service.commons.http.IHttpResponse)

Example 8 with IHttpResponse

use of de.janrufmonitor.service.commons.http.IHttpResponse in project janrufmonitor by tbrandt77.

the class ClientDialerDialog method getLines.

private String[] getLines() {
    IRequester r = this.getRequester(new GetDialExtensions());
    IHttpResponse resp = r.request();
    this.m_logger.info("GetExtensionsList returned " + resp.getCode());
    if (resp.getCode() == 200) {
        try {
            String lines = new String(resp.getContent());
            if (lines != null & lines.length() > 0) {
                this.m_logger.info("GetExtensionsList returned " + lines);
                return lines.split(",");
            }
        } catch (Exception e) {
            m_logger.log(Level.SEVERE, e.getMessage(), e);
            return null;
        }
    }
    return null;
}
Also used : GetDialExtensions(de.janrufmonitor.service.client.request.handler.GetDialExtensions) IRequester(de.janrufmonitor.service.commons.http.IRequester) UnsupportedEncodingException(java.io.UnsupportedEncodingException) IHttpResponse(de.janrufmonitor.service.commons.http.IHttpResponse)

Example 9 with IHttpResponse

use of de.janrufmonitor.service.commons.http.IHttpResponse in project janrufmonitor by tbrandt77.

the class HttpCallerManager method getCallers.

public ICallerList getCallers(IFilter[] filters, ISearchTerm[] searchTerms) {
    if (!this.isConnected()) {
        this.m_logger.warning("Client is not yet connected with the server.");
        return this.getRuntime().getCallerFactory().createCallerList();
    }
    IRequester r = this.getRequester(new CallerListGetHandler(this.getCallerManager(), filters, searchTerms));
    IHttpResponse resp = r.request();
    String xml = this.getXmlContent(resp);
    this.handleRequester(resp, r);
    ICallerList l = XMLSerializer.toCallerList(xml);
    if (l != null) {
        this.addCallerManagerAttribute(l);
        return l;
    }
    this.m_logger.warning("Callerlist from remote host was empty.");
    return this.getRuntime().getCallerFactory().createCallerList();
}
Also used : CallerListGetHandler(de.janrufmonitor.service.client.request.handler.CallerListGetHandler) ICallerList(de.janrufmonitor.framework.ICallerList) IRequester(de.janrufmonitor.service.commons.http.IRequester) IHttpResponse(de.janrufmonitor.service.commons.http.IHttpResponse)

Example 10 with IHttpResponse

use of de.janrufmonitor.service.commons.http.IHttpResponse in project janrufmonitor by tbrandt77.

the class HttpCallerManager method setCaller.

public void setCaller(ICallerList callerList) {
    if (!this.isConnected()) {
        this.m_logger.warning("Client is not yet connected with the server.");
        return;
    }
    IRequester r = null;
    IHttpResponse resp = null;
    r = this.getRequester(new CallerListSetHandler(callerList, this.getCallerManager()));
    resp = r.request();
    this.handleRequester(resp, r);
}
Also used : CallerListSetHandler(de.janrufmonitor.service.client.request.handler.CallerListSetHandler) IRequester(de.janrufmonitor.service.commons.http.IRequester) IHttpResponse(de.janrufmonitor.service.commons.http.IHttpResponse)

Aggregations

IHttpResponse (de.janrufmonitor.service.commons.http.IHttpResponse)15 IRequester (de.janrufmonitor.service.commons.http.IRequester)14 ICallerList (de.janrufmonitor.framework.ICallerList)3 GetDialExtensions (de.janrufmonitor.service.client.request.handler.GetDialExtensions)3 CallerListGetHandler (de.janrufmonitor.service.client.request.handler.CallerListGetHandler)2 IOException (java.io.IOException)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 Message (de.janrufmonitor.exception.Message)1 ICallList (de.janrufmonitor.framework.ICallList)1 ICaller (de.janrufmonitor.framework.ICaller)1 CallListCountGetHandler (de.janrufmonitor.service.client.request.handler.CallListCountGetHandler)1 CallListGetHandler (de.janrufmonitor.service.client.request.handler.CallListGetHandler)1 CallListRemoveHandler (de.janrufmonitor.service.client.request.handler.CallListRemoveHandler)1 CallListSetHandler (de.janrufmonitor.service.client.request.handler.CallListSetHandler)1 CallerGetHandler (de.janrufmonitor.service.client.request.handler.CallerGetHandler)1 CallerListRemoveHandler (de.janrufmonitor.service.client.request.handler.CallerListRemoveHandler)1 CallerListSetHandler (de.janrufmonitor.service.client.request.handler.CallerListSetHandler)1 CallerListUpdateHandler (de.janrufmonitor.service.client.request.handler.CallerListUpdateHandler)1 Dial (de.janrufmonitor.service.client.request.handler.Dial)1 IHttpRequest (de.janrufmonitor.service.commons.http.IHttpRequest)1