View Javadoc
1   /*
2    * Copyright (C) 2013 4th Line GmbH, Switzerland
3    *
4    * The contents of this file are subject to the terms of either the GNU
5    * Lesser General Public License Version 2 or later ("LGPL") or the
6    * Common Development and Distribution License Version 1 or later
7    * ("CDDL") (collectively, the "License"). You may not use this file
8    * except in compliance with the License. See LICENSE.txt for more
9    * information.
10   *
11   * This program is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14   */
15  
16  package org.fourthline.cling.model.message;
17  
18  import java.net.URI;
19  import java.net.URL;
20  
21  /**
22   * A TCP (HTTP) stream request message.
23   *
24   * @author Christian Bauer
25   */
26  public class StreamRequestMessage extends UpnpMessage<UpnpRequest> {
27  
28      protected Connection connection;
29  
30      public StreamRequestMessage(StreamRequestMessage source) {
31          super(source);
32          this.connection = source.getConnection();
33      }
34  
35      public StreamRequestMessage(UpnpRequest operation) {
36          super(operation);
37      }
38  
39      public StreamRequestMessage(UpnpRequest.Method method, URI uri) {
40          super(new UpnpRequest(method, uri));
41      }
42  
43      public StreamRequestMessage(UpnpRequest.Method method, URL url) {
44          super(new UpnpRequest(method, url));
45      }
46  
47      public StreamRequestMessage(UpnpRequest operation, String body) {
48          super(operation, BodyType.STRING, body);
49      }
50  
51      public StreamRequestMessage(UpnpRequest.Method method, URI uri, String body) {
52          super(new UpnpRequest(method, uri), BodyType.STRING, body);
53      }
54  
55      public StreamRequestMessage(UpnpRequest.Method method, URL url, String body) {
56          super(new UpnpRequest(method, url), BodyType.STRING, body);
57      }
58  
59  
60      public StreamRequestMessage(UpnpRequest operation, byte[] body) {
61          super(operation, BodyType.BYTES, body);
62      }
63  
64      public StreamRequestMessage(UpnpRequest.Method method, URI uri, byte[] body) {
65          super(new UpnpRequest(method, uri), BodyType.BYTES, body);
66      }
67  
68      public StreamRequestMessage(UpnpRequest.Method method, URL url, byte[] body) {
69          super(new UpnpRequest(method, url), BodyType.BYTES, body);
70      }
71  
72      public URI getUri() {
73          return getOperation().getURI();
74      }
75      
76      public void setUri(URI uri) {
77          getOperation().setUri(uri);
78      }
79  
80  	public void setConnection(Connection connection) {
81  		this.connection = connection;
82  	}
83  	
84  	public Connection getConnection() {
85  		return connection;
86  	}
87      
88  }