mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-05-23 19:04:32 +00:00
format proxy code, allow to change swf on the fly
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user