001/* 002 * Copyright 2020 Vonage 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package com.vonage.client.voice; 017 018import com.fasterxml.jackson.annotation.JsonInclude; 019import com.fasterxml.jackson.annotation.JsonProperty; 020import org.apache.http.NameValuePair; 021 022import java.util.List; 023 024@JsonInclude(value = JsonInclude.Include.NON_NULL) 025public class WebSocketEndpoint implements Endpoint { 026 private String uri; 027 private String type = "websocket"; 028 private String contentType; 029 private List<NameValuePair> headers; 030 031 public WebSocketEndpoint(String uri, String contentType, List<NameValuePair> headers) { 032 this.uri = uri; 033 this.contentType = contentType; 034 this.headers = headers; 035 } 036 037 @Override 038 public String getType() { 039 return type; 040 } 041 042 @Override 043 public String toLog() { 044 return "uri=" + uri + " content-type=" + contentType; 045 } 046 047 public String getUri() { 048 return uri; 049 } 050 051 @JsonProperty("content-type") 052 public String getContentType() { 053 return contentType; 054 } 055 056 public List<NameValuePair> getHeaders() { 057 return headers; 058 } 059 060 public void setUri(String uri) { 061 this.uri = uri; 062 } 063 064 public void setContentType(String contentType) { 065 this.contentType = contentType; 066 } 067 068 public void setHeaders(List<NameValuePair> headers) { 069 this.headers = headers; 070 } 071}