Cyberlink for Java v3.0 + (2015-02-15) from github:

Unmodified cybergarage-upnp from github rev 9499b03 2015-02-05
https://github.com/cybergarage/cybergarage-upnp/commits/master
which is the same as rev 3ed1af9 2014-07-28 except for
the addition of README.md which we aren't using.
This is post-version 3.0.

Omitted files:
  router/java/src/org/cybergarage/xml/parser/XercesParser.java
  router/java/src/org/cybergarage/xml/parser/XmlPullParser.java
  router/java/src/org/cybergarage/xml/parser/kXML2Parser.java
chmod all files back to 644.

Diverging from 2.1 checkin rev 59eae97dbb470d8c4a1e4dba3a9763e134bb0c53
in prep for merging.

License unchanged.
Compile tested only.
This commit is contained in:
zzz
2015-03-17 14:36:05 +00:00
parent 14ac5ac03e
commit 92daf4a8df
86 changed files with 6707 additions and 6311 deletions

View File

@@ -5,36 +5,36 @@
* Copyright (C) Satoshi Konno 2002
*
* File: HTTPHeader.java
*
* Revision;
*
* 11/19/02
* - first revision.
*
* Revision;
*
* 11/19/02
* - first revision.
* 05/26/04
* - Jan Newmarch <jan.newmarch@infotech.monash.edu.au> (05/26/04)
* - Fixed getValue() to compare using String::equals() instead of String::startWidth().
*
******************************************************************/
package org.cybergarage.http;
import java.io.IOException;
import java.io.LineNumberReader;
import java.io.StringReader;
import org.cybergarage.util.Debug;
public class HTTPHeader
public class HTTPHeader
{
private static int MAX_LENGTH = 1024;
private String name;
private String value;
public HTTPHeader(String name, String value)
{
setName(name);
setValue(value);
}
private static int MAX_LENGTH = 1024;
private String name;
private String value;
public HTTPHeader(String name, String value)
{
setName(name);
setValue(value);
}
public HTTPHeader(String lineStr)
{
@@ -50,30 +50,30 @@ public class HTTPHeader
setName(name.trim());
setValue(value.trim());
}
////////////////////////////////////////////////
// Member
////////////////////////////////////////////////
public void setName(String name)
{
this.name = name;
}
public void setValue(String value)
{
this.value = value;
}
public String getName()
{
return name;
}
public String getValue()
{
return value;
}
public void setName(String name)
{
this.name = name;
}
public void setValue(String value)
{
this.value = value;
}
public String getName()
{
return name;
}
public String getValue()
{
return value;
}
public boolean hasName()
{
@@ -81,68 +81,68 @@ public class HTTPHeader
return false;
return true;
}
////////////////////////////////////////////////
// static methods
////////////////////////////////////////////////
public final static String getValue(LineNumberReader reader, String name)
{
String bigName = name.toUpperCase();
try {
String lineStr = reader.readLine();
while (lineStr != null && 0 < lineStr.length()) {
HTTPHeader header = new HTTPHeader(lineStr);
if (header.hasName() == false) {
lineStr = reader.readLine();
continue;
}
String bigLineHeaderName = header.getName().toUpperCase();
// Thanks for Jan Newmarch <jan.newmarch@infotech.monash.edu.au> (05/26/04)
if (bigLineHeaderName.equals(bigName) == false) {
lineStr = reader.readLine();
continue;
}
return header.getValue();
}
}
catch (IOException e) {
Debug.warning(e);
return "";
}
return "";
}
public final static String getValue(String data, String name)
////////////////////////////////////////////////
// static methods
////////////////////////////////////////////////
public final static String getValue(LineNumberReader reader, String name)
{
/* Thanks for Stephan Mehlhase (2010-10-26) */
String bigName = name.toUpperCase();
try {
String lineStr = reader.readLine();
while (lineStr != null && 0 < lineStr.length()) {
HTTPHeader header = new HTTPHeader(lineStr);
if (header.hasName() == false) {
lineStr = reader.readLine();
continue;
}
String bigLineHeaderName = header.getName().toUpperCase();
// Thanks for Jan Newmarch <jan.newmarch@infotech.monash.edu.au> (05/26/04)
if (bigLineHeaderName.equals(bigName) == false) {
lineStr = reader.readLine();
continue;
}
return header.getValue();
}
}
catch (IOException e) {
Debug.warning(e);
return "";
}
return "";
}
public final static String getValue(String data, String name)
{
/* Thanks for Stephan Mehlhase (2010-10-26) */
StringReader strReader = new StringReader(data);
LineNumberReader lineReader = new LineNumberReader(strReader, Math.min(data.length(), MAX_LENGTH));
return getValue(lineReader, name);
}
public final static String getValue(byte[] data, String name)
{
return getValue(new String(data), name);
}
public final static int getIntegerValue(String data, String name)
return getValue(lineReader, name);
}
public final static String getValue(byte[] data, String name)
{
return getValue(new String(data), name);
}
public final static int getIntegerValue(String data, String name)
{
try {
return Integer.parseInt(getValue(data, name));
}
catch (Exception e) {
return 0;
}
}
public final static int getIntegerValue(byte[] data, String name)
{
}
}
public final static int getIntegerValue(byte[] data, String name)
{
try {
return Integer.parseInt(getValue(data, name));
}
catch (Exception e) {
return 0;
}
}
}
}