obtenga un nuevo boleto y vuelva a intentar la primera solicitud

Actualizar:

Extiendo la clase Http, cuando yodeleteDocument() Quiero manejar error entoncesgetTicket() luego vuelva a intentar mi solicituddeleteDocument() con nuevothis.TICKET :

@Injectable()
export class HttpService extends Http {
    public SERVER_URL: string = 'http://10.0.0.183:8080/alfresco/s/'
    public TICKET: string = ''

    constructor(backend: ConnectionBackend, defaultOptions: RequestOptions) {
        super(backend, defaultOptions);
    }


    post(url: string, body: any, options?: RequestOptionsArgs): Observable<Response> {
        return this.intercept(super.post(url,body, options));
    }

    intercept(observable: Observable<Response>): Observable<Response> {
        return observable.catch(initialError => {
            if (initialError.status === 401) {
                return this.getTicket()
                    .do(res => {
                        // HERE I WANT RETRY MY FIRST REQUEST
                        this.TICKET = res.json().data.ticket
                    })
            } else {
                return Observable.throw(initialError);
            }
        })
    }

    getTicket() {
        return this.post(this.SERVER_URL + 'api/login', JSON.stringify({username: 'admin', password: 'admin'}))
    }


    deleteDocument(idFile: number) {
        return this.post(this.SERVER_URL + 'dms/file/delfile?idfile=' + idFile + '&alf_ticket=' + this.TICKET, {}).map((data: Response) => data.json())
    }
}

Después de recibir mi nuevo boleto, quiero volver a intentar mi primera solicitud con una nueva URL. Gracias

Respuestas a la pregunta(1)

Su respuesta a la pregunta