Search in sources :

Example 6 with IRequester

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

the class HttpImageProvider method getRequester.

private IRequester getRequester(IHttpRequest request) {
    IRequester r = RequesterFactory.getInstance().getRequester();
    r.setRequest(request);
    return r;
}
Also used : IRequester(de.janrufmonitor.service.commons.http.IRequester)

Example 7 with IRequester

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

the class HttpCallManager method setCalls.

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

Example 8 with IRequester

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

the class HttpCallManager method getCalls.

public synchronized ICallList getCalls(IFilter[] filters, int count, int offset, ISearchTerm[] searchTerms) {
    if (!this.isConnected()) {
        this.m_logger.warning("Client is not yet connected with the server.");
        return this.getRuntime().getCallFactory().createCallList();
    }
    IRequester r = this.getRequester(new CallListGetHandler(this.getCallManager(), filters, searchTerms));
    IHttpResponse resp = r.request();
    String xml = this.getXmlContent(resp);
    this.handleRequester(resp, r);
    if (xml != null && xml.length() > 0) {
        ICallList l = XMLSerializer.toCallList(xml);
        if (l != null)
            return l;
        this.m_logger.warning("Calllist from remote host was empty.");
        PropagationFactory.getInstance().fire(new Message(Message.ERROR, getNamespace(), "empty", new Exception("CallList from server has either a wrong format, contains forbidden characters or was empty.")));
    }
    return this.getRuntime().getCallFactory().createCallList();
}
Also used : CallListGetHandler(de.janrufmonitor.service.client.request.handler.CallListGetHandler) Message(de.janrufmonitor.exception.Message) ICallList(de.janrufmonitor.framework.ICallList) IRequester(de.janrufmonitor.service.commons.http.IRequester) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException) IHttpResponse(de.janrufmonitor.service.commons.http.IHttpResponse)

Example 9 with IRequester

use of de.janrufmonitor.service.commons.http.IRequester 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 10 with IRequester

use of de.janrufmonitor.service.commons.http.IRequester 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)

Aggregations

IRequester (de.janrufmonitor.service.commons.http.IRequester)21 IHttpResponse (de.janrufmonitor.service.commons.http.IHttpResponse)14 UnknownHostException (java.net.UnknownHostException)4 ICallerList (de.janrufmonitor.framework.ICallerList)3 GetDialExtensions (de.janrufmonitor.service.client.request.handler.GetDialExtensions)3 IHttpRequest (de.janrufmonitor.service.commons.http.IHttpRequest)3 IOException (java.io.IOException)3 CallerListGetHandler (de.janrufmonitor.service.client.request.handler.CallerListGetHandler)2 GetImageHandler (de.janrufmonitor.service.client.request.handler.GetImageHandler)2 FileNotFoundException (java.io.FileNotFoundException)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 MalformedURLException (java.net.MalformedURLException)2 Message (de.janrufmonitor.exception.Message)1 ICall (de.janrufmonitor.framework.ICall)1 ICallList (de.janrufmonitor.framework.ICallList)1 ICaller (de.janrufmonitor.framework.ICaller)1 IMsn (de.janrufmonitor.framework.IMsn)1 ClientHandler (de.janrufmonitor.service.client.http.simple.ClientHandler)1 CallListCountGetHandler (de.janrufmonitor.service.client.request.handler.CallListCountGetHandler)1 CallListGetHandler (de.janrufmonitor.service.client.request.handler.CallListGetHandler)1