format proxy code, allow to change swf on the fly

This commit is contained in:
honfika@gmail.com
2014-09-01 16:56:55 +02:00
parent 8325d07b24
commit ed53ba9d0f
37 changed files with 1847 additions and 2267 deletions

View File

@@ -1,70 +1,62 @@
package com.jpexs.proxy;
class HttpError
{
class HttpError {
StringBuffer content = null;
Reply reply = null;
HttpError(int code, String message)
{
String error;
switch (code)
{
case 400:
error = "Bad Request";
break;
case 403:
error = "Forbidden";
break;
HttpError(int code, String message) {
String error;
switch (code) {
case 400:
error = "Bad Request";
break;
case 404:
error = "Not found";
break;
case 403:
error = "Forbidden";
break;
case 503:
error = "Service Unavailable";
break;
case 404:
error = "Not found";
break;
default:
error = "Error";
break;
}
case 503:
error = "Service Unavailable";
break;
reply = new Reply();
reply.statusLine = "HTTP/1.0 " + code + " " + error;
reply.setHeaderField("Content-type", "text/html");
reply.setHeaderField("Server", ProxyConfig.appName+"/" +ProxyConfig.appVersion);
default:
error = "Error";
break;
}
content = new StringBuffer();
content.append(message);
reply = new Reply();
reply.statusLine = "HTTP/1.0 " + code + " " + error;
reply.setHeaderField("Content-type", "text/html");
reply.setHeaderField("Server", ProxyConfig.appName + "/" + ProxyConfig.appVersion);
content = new StringBuffer();
content.append(message);
}
Reply getReply()
{
return reply;
Reply getReply() {
return reply;
}
String getContent()
{
if (content == null)
{
return null;
}
return content.toString();
String getContent() {
if (content == null) {
return null;
}
return content.toString();
}
public String toString()
{
StringBuffer buf = new StringBuffer();
if (reply != null)
{
buf.append(reply.toString());
}
if (content != null)
{
buf.append(content.toString());
}
return buf.toString();
public String toString() {
StringBuffer buf = new StringBuffer();
if (reply != null) {
buf.append(reply.toString());
}
if (content != null) {
buf.append(content.toString());
}
return buf.toString();
}
}