⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mcharsetconverter.java

📁 httptunnel.jar httptunnel java 源码
💻 JAVA
字号:
package net.jumperz.app.MGuardian.plugin;

import java.io.*;
import java.util.*;
import net.jumperz.net.*;
import net.jumperz.util.*;

public class MCharsetConverter
extends MGuardianPlugin
{
//net.umperz....MCharsetConverter EUC_JP Shift_JIS
//--------------------------------------------------------------------------------
public Map execute( Map sessionInfo )
{
MHttpResponse response = ( MHttpResponse )sessionInfo.get( "response" );
if( response == null )
	{
	Exception e = new Exception( "Configuration Error. You need to call this plugin from 'RESPONSE-TYPE' rule like 'type=responseHeader'." );
	e.printStackTrace();
	return null;
	}

String arg = ( String )sessionInfo.get( "arg" );
String[] array = arg.split( "[ \\t]{1,}" );
if( array.length != 2 )
	{
	Exception e = new Exception( "Plugin Argument Error." );
	e.printStackTrace();
	return null;	
	}

String charFrom = array[ 0 ];
String charTo = array[ 1 ];

try
	{
	response.chunkToNormal();
	String bodyStr = response.getBodyAsString();
	bodyStr = MStringUtil.convertCharset( bodyStr, charFrom, charTo );
	response.setBody( bodyStr );
	response.setHeaderValue( "Content-Length", Integer.toString( bodyStr.length() ) );
	}
catch( IOException e )
	{
	e.printStackTrace();
	return null;
	}

return null;
}
//--------------------------------------------------------------------------------
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -