📄 mresponsewindow.java
字号:
package net.jumperz.app.MDoorman.windows;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.*;
import org.eclipse.swt.custom.*;
import org.eclipse.swt.layout.*;
import java.io.*;
import java.util.*;
import net.jumperz.app.MDoorman.*;
import net.jumperz.util.*;
import net.jumperz.net.*;
public class MResponseWindow
extends MAbstractTextWindow
{
private static final String WINDOW_NAME = "Response";
// --------------------------------------------------------------------------------
protected void init3()
{
type = MBreak.TYPE_RESPONSE;
}
//--------------------------------------------------------------------------------
public MResponseWindow()
{
super( WINDOW_NAME, new Shell( MDoorman.getInstance().mainShell, WINDOW_STYLE ) );
}
// --------------------------------------------------------------------------------
protected void onSendButtonClick()
{
MBaseSession session = doorman.selectedSession;
if( session != null )
{
String s = text.getText();
String s2 = s.substring( 0, 15 );
String s3 = MRegEx.getMatch( " ([0-9]{3})", s2 );
session.setStatusCode( s3 );
session.setResponseByte( MStringUtil.getBytes( s, doorman.getEnc() ) );
session.sendResponse();
}
}
// --------------------------------------------------------------------------------
protected void onDisconnectButtonClick()
{
MBaseSession session = doorman.selectedSession;
if( session != null )
{
session.errorClose();
}
}
// --------------------------------------------------------------------------------
public void updateGui()
{
MBaseSession session = doorman.selectedSession;
if( session == null )
{
text.setText( "" );
}
else
{
if( session.getState() >= MSession.RS_MODIFY )
{
text.setText( MStringUtil.byteArrayToString( session.getResponseByte(), doorman.getEnc() ) );
sendButton.setEnabled( ( session.getState() == MSession.RS_MODIFY ) );
disconnectButton.setEnabled( ( session.getState() == MSession.RS_MODIFY ) );
}
else
{
text.setText( "" );
}
}
updateMenus();
}
// --------------------------------------------------------------------------------
protected MHttpData getHttpData( byte[] buffer )
throws IOException
{
return new MHttpResponse( buffer );
}
// --------------------------------------------------------------------------------
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -