クラス AbstractHttpAccess
java.lang.Object
jp.ne.mki.wedge.rule.base.AbstractBase
jp.ne.mki.wedge.rule.base.AbstractClient
jp.ne.mki.wedge.rule.client.httpaccess.AbstractHttpAccess
- すべての実装されたインタフェース:
ClientInterface,CommonInterface,PostInterface,jp.ne.mki.wedge.run.interfaces.RuleEngineInterface
- 直系の既知のサブクラス:
AbstractGet,AbstractPost
Http送受信抽象クラス
入力アイテムセットに設定された値をHttp送信します。
実行は以下の順番で行われます。
getIOParameterの実行- 前処理
whenBeforeHttpAccessの実行 - サーバアクセス
getUrlにて取得したURLにアクセスします。
getSendMethodにて取得したアクセス方法にて送信を行います。 - 新しいSessionの場合
whenNewSessionを実行 AdjustmentHttpResponseCodeを実行executeXsltを実行- 実行モードがTESTの場合、取得結果をトレースログに出力
- 結果に値が無い場合、
getHttpAccessErrorMessageのメッセージをダイアログに表示 xmlParseを実行し、アイテムに値を格納
[I/O RECORD]
| InputRecord | OutputRecord |
|---|---|
|
|
[RULE PARAMETER]
| Parameter | アクセスするサーバーのURL+;+xslファイルのURL(必要なければ指定なしでOK) |
|---|
- バージョン:
- 1.0
-
フィールドの概要
フィールドクラスから継承されたフィールド jp.ne.mki.wedge.rule.base.AbstractBase
controlRecord, engineManager, errorMessage, executeType, id, inputRecord, logicalName, logicClassDelegate, outputRecord, physicalName, ruleParameter, ruleType, serverParameter, userConstantインタフェースから継承されたフィールド jp.ne.mki.wedge.rule.base.interfaces.ClientInterface
FRAME_CLOSE, FRAME_QUIT, SKIP_ALL, STOP, STOP_SELECT_ALL, SYSTEM_EXIT, SYSTEM_QUIT, TIMING_AFTER, TIMING_BEFORE, TIMING_LOAD, TIMING_ROW_CLICK, TIMING_ROW_WCLICK, TIMING_UN_LOADインタフェースから継承されたフィールド jp.ne.mki.wedge.rule.base.interfaces.CommonInterface
CANCEL, ERROR, EXECUTE_BOTH, EXECUTE_CLIENT, EXECUTE_DEBUG, EXECUTE_HTMLGATEWAY, EXECUTE_SERVER, EXECUTE_SERVERDC, IO_ERROR, IO_ERROR_EXECUTE_PARAMETER, IO_ERROR_IN, IO_ERROR_IO_MUST_SAME_COUNT, IO_ERROR_ITEM_TYPE, IO_ERROR_OUT, IO_ERROR_PARAMETER, NONE, OK, PARAMETER_DELIMITER, SKIP, USER_ERROR -
コンストラクタの概要
コンストラクタ -
メソッドの概要
修飾子とタイプメソッド説明booleanAdjustmentHttpResponseCode(int code, InputStream is) Httpレスポンスコードのチェック デフォルトでは「200」以外の場合はエラーメッセージを表示して処理を中断します。final voidCookieクリアintexecute()入力引数に指定されたアイテムを物理名=値に変換しHTTP送信するbyte[]executeXslt(InputStream is, int contentLength, String xslFileName) サーバからの戻り値を指定のxslを使用しXslt行う xslFileNameがnullもしくは空の場合には、Xsltは行いません。voidexit()終了処理。static byte[]getByte(InputStream is, int contentLength) InputStreamよりバイト配列を取得final StringCookieを取得final StringgetEncodeName(String charset) charsetからEncode名称を取得 UTF-8,ISO-8859-1,US-ASCII,ISO-8859-9,SHIFT_JIS,EUC-JPを対象にしています。Http通信時にヘッダに設定する内容を String配列で取得します。HttpAccess時にエラーが発生した場合にダイアログに表示するメッセージ length()=0の場合ダイアログは表示しない メッセージを任意に変えたい場合にはこのメソッドを上書きしてください。intIOパラメータ取得。パラメータより取得したサーバアクセスURLパスを返します。パラメータより取得したXSLファイルURLパスを返します。final StringManageに紐づいた OptionalDataMapから、
REQESUT_BODYをtargetとするOptionalDataの一覧を取得し、 「Name=Data」の形式を「入力が無効です: '&'」で結合した、文字列で返しますfinal Properties[]Manageに紐づいた OptionalDataMapから、
REQESUT_HEADERをtargetとするOptionalDataの一覧を取得し、 Propertiesの配列で返します
それぞれのPropertiesには、"key","value"の二つの項目が設定されており、
それぞれに OptionalData.getName()、OptionalData.getData()の値が
格納された形となります。static byte[]getResponseByLength(InputStream is, int length) レスポンス取得:Content-Lengthが使用できる場合static byte[]レスポンス取得:Content-Lengthが使用できない場合送信Content-Typeを指定 空文字の場合にはContent-Typeの設定は行いません。final URLConnectionURLConnectionを取得getValueMethod(String name, int position) 値取得方法 Node以下のどの値を取得対象にするかを設定。protected final StringgetXmlView(Node nd, StringBuffer buf) 指定のNodeをStringに展開するfinal voidCookieを設定voidsetDefaultCharsetForLog(String charSet) ログ出力のためのデフォルトCharSetを設定する 設定なしの場合(null)は、SystemのデフォルトCharsetになります。voidsetFaultString(String message) エラーダイアログに表示するメッセージを設定します。static final voidsetItem(NodeIterator nl, jp.ne.mki.wedge.run.client.data.Item item) 指定のNodeIteratorのCDATA値からitemに値を設定するstatic final voidsetItem(NodeIterator nl, jp.ne.mki.wedge.run.client.data.Item item, String attributeName) 指定のNodeIteratorの属性値からitemに値を設定するfinal void出力Itemに値を設定する(CDATAの値を設定)final voidsetResult(int result) ロジッククラス戻り値を任意に指定booleanHTTPアクセスをする前の処理 サーバにアクセスする前に実行されます。booleanwhenNewSession(boolean isFirstAccess) 新しいSessionだった場合の処理 サーバアクセス後実行されます。final voidwriteTraceLog(String message) ログ出力booleanxmlParse(byte[] xml) サーバからの戻り値をパースし、OutItemに格納する XMLをパースしたくない場合などはこのメソッドを上書きして取得したデータ(byte[] xml)を任意のITEMに格納してください。クラスから継承されたメソッド jp.ne.mki.wedge.rule.base.AbstractClient
executeCurrentAfter, executeRule, executeRule, getAdapterName, getClientRuleObject, getComponent, getComponent, getComponents, getConfig, getConfImagePath, getContentPane, getCurrentComponent, getDesktop, getExecuteIndex, getExecuteParameter, getExecuteTiming, getExecutions, getExpectNextComponent, getFrame, getFrameRunner, getImageIcon, getInItem, getInItem, getItems, getLogicClassType, getManager, getMemory, getOutItem, getOutItem, getParameter, getReturnString, getRevision, isApplet, isApplication, isClientTraceMode, isConpiled, isJWS, isServerTraceMode, isWeb, log, loopInItem, loopInItemSub, loopInOutItem, loopInOutItemSub, loopOutItem, loopOutItemSub, setEngineManager, setErrorMessageMustInComp, setErrorMessageMustOutComp, setExecuteParameter, setFocus, setFocus, setFocus, setFrameRunnerErrorStatus, setPropertyFromEngine, setStatusBarText, showErrorDialog, showFrame, showFrame, showFrame, showFrame, terminate, writeErrorLog, writeErrorLog, writeErrorLog, writeTraceLogクラスから継承されたメソッド jp.ne.mki.wedge.rule.base.AbstractBase
callDispose, checkDelegate, createErrorMessage, createLogicErrorLogRecord, createLogicExceptionLogRecord, createLogicLogRecord, dataClearOfOutRecord, dataClearOfRecord, dispose, getAppAccount, getAppAuthority, getAppMenu, getAppPassword, getClassErrorName, getClientId, getConnectionId, getConnectionPoolId, getConstantKeys, getConstantValue, getConstantValueAsStringArray, getControlRecord, getDbAccessCount, getDbErrorCode, getDbErrorMessage, getDbStatus, getDbUpdatedRecordCount, getEngineManager, getErrorMessage, getErrorMessage, getErrorMessage, getExceptionMessage, getExecuteType, getId, getInputRecordIterator, getInRecord, getInRecord, getInRecord, getInRecordCount, getInRecordList, getIpAddress_G_Index, getIpAddress_P_Index, getLogicalErrorName, getLogicalName, getLogicClassDelegate, getOutputHtml, getOutputRecordIterator, getOutRecord, getOutRecord, getOutRecord, getOutRecordCount, getOutRecordList, getPhysicalErrorName, getPhysicalName, getProjectId, getQueryEndLine, getQueryMaxCount, getQueryPageCount, getQueryStartLine, getRowSize, getRowSizeOfInRecord, getRuleParameter, getRuleParameters, getRuleParameters, getRuleParameters, getRuleType, getRuleTypeName, getServerMessage, getServerParameter, getServerStatus, getServerSubName, getServerSubRevision, getServerTran, getUpdateErrorLine, getUpdateTargetCount, getWebServerIpAddress, isExecutable, isJDK15, log, logDebug, logError, logError, logFatal, logFatal, logInfo, logTrace, logWarn, logWarn, loopInOutRecord, loopInOutRecordSub, loopInRecord, loopInRecordSub, loopOutRecord, loopOutRecordSub, setControlRecord, setErrorMessage, setErrorMessageMustInRecord, setErrorMessageMustOutRecord, setErrorMessageMustParamIsNumber, setExecuteType, setFatalError, setId, setInRecord, setLogicalName, setLogicClassDelegate, setOutputHtml, setOutRecord, setPhysicalName, setRuleParameter, setRuleType, setServerParameter, setUserConstant, showErrorDialog, showErrorDialogAddRuleName, writeErrorLog, writeErrorLog, writeLog, writeLog, writeLogクラスから継承されたメソッド java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitインタフェースから継承されたメソッド jp.ne.mki.wedge.rule.base.interfaces.CommonInterface
dispose, getAppAccount, getAppAuthority, getAppMenu, getAppPassword, getClassErrorName, getClientId, getConnectionId, getConnectionPoolId, getDbAccessCount, getDbErrorCode, getDbErrorMessage, getDbStatus, getEngineManager, getExceptionMessage, getExecuteType, getId, getInRecord, getInRecord, getInRecord, getInRecordCount, getIpAddress_G_Index, getIpAddress_P_Index, getLogicalErrorName, getLogicalName, getOutRecord, getOutRecord, getOutRecord, getOutRecordCount, getPhysicalErrorName, getPhysicalName, getProjectId, getQueryEndLine, getQueryMaxCount, getQueryPageCount, getQueryStartLine, getRuleParameter, getRuleParameters, getRuleType, getRuleTypeName, getServerMessage, getServerParameter, getServerStatus, getServerSubName, getServerSubRevision, getServerTran, getUpdateErrorLine, getUpdateTargetCount, getWebServerIpAddress, isExecutable, logDebug, logError, logError, logFatal, logFatal, logInfo, logTrace, logWarn, logWarn, setExecuteType, setRuleType, setServerParameter, showErrorDialog, showErrorDialogAddRuleName, writeErrorLog, writeLog, writeLogインタフェースから継承されたメソッド jp.ne.mki.wedge.rule.client.httpaccess.PostInterface
getOutputString, getSendMethod, getUrl, getXPath, getXPathErrorNode, setErrorインタフェースから継承されたメソッド jp.ne.mki.wedge.run.interfaces.RuleEngineInterface
createLogicErrorLogRecord, createLogicExceptionLogRecord, createLogicLogRecord, getLogicClassDelegate, setControlRecord, setId, setInRecord, setLogicalName, setLogicClassDelegate, setOutRecord, setPhysicalName, setRuleParameter, setUserConstant
-
フィールド詳細
-
faultString
-
result
int result -
paramOfServerUrl
-
paramOfXslUrl
-
-
コンストラクタの詳細
-
AbstractHttpAccess
public AbstractHttpAccess()
-
-
メソッドの詳細
-
getIOParameter
public int getIOParameter()IOパラメータ取得。executeの前に実行される。 このロジッククラスはクライアントのみ実行可能です。 パラメータを;にて分割し、サーバURL,xslファイルURLを取得します。- 定義:
getIOParameterインタフェース内CommonInterface- 定義:
getIOParameterインタフェース内jp.ne.mki.wedge.run.interfaces.RuleEngineInterface- 戻り値:
- int OK=処理続行、ERROR=異常終了、CANCEL=処理を中断(正常終了)
-
exit
public void exit()- 定義:
exitインタフェース内CommonInterface- 定義:
exitインタフェース内jp.ne.mki.wedge.run.interfaces.RuleEngineInterface
-
setFaultString
エラーダイアログに表示するメッセージを設定します。 xmlをパース後、この値にメッセージが入っている場合にはエラーダイアログとして表示します- パラメータ:
String- メッセージ文字列
-
execute
入力引数に指定されたアイテムを物理名=値に変換しHTTP送信する- 定義:
executeインタフェース内CommonInterface- 定義:
executeインタフェース内jp.ne.mki.wedge.run.interfaces.RuleEngineInterface- 戻り値:
- int BusinessRuleの戻り値を参照
- 例外:
Throwable
-
getHttpAccessErrorMessage
HttpAccess時にエラーが発生した場合にダイアログに表示するメッセージ length()=0の場合ダイアログは表示しない メッセージを任意に変えたい場合にはこのメソッドを上書きしてください。- 戻り値:
- String エラーメッセージ
-
executeXslt
サーバからの戻り値を指定のxslを使用しXslt行う xslFileNameがnullもしくは空の場合には、Xsltは行いません。- パラメータ:
InputStream- サーバから取得した値int- サーバから取得した値の長さString- xslファイルURLパス- 戻り値:
- byte[] 変換結果のバイト配列
- 例外:
Throwable
-
getParamOfXslUrl
パラメータより取得したXSLファイルURLパスを返します。 パラメータを;にて分割した2番目の設定文字列になります。- 戻り値:
- String xslファイルURL
-
getParamOfServerUrl
パラメータより取得したサーバアクセスURLパスを返します。 パラメータを;にて分割した1番目の設定文字列になります。- 戻り値:
- String サーバアクセスURLパス
-
xmlParse
サーバからの戻り値をパースし、OutItemに格納する XMLをパースしたくない場合などはこのメソッドを上書きして取得したデータ(byte[] xml)を任意のITEMに格納してください。- 定義:
xmlParseインタフェース内PostInterface- パラメータ:
byte- [] サーバからの戻り値- 戻り値:
- boolean true:成功 false:失敗
- 例外:
Throwable
-
getValueMethod
値取得方法 Node以下のどの値を取得対象にするかを設定。 CDATAの場合には空文字を返す。属性の場合には属性名を返す XPathにて属性のNodeを指定すればこのメソッドを意識する必要はありません- 定義:
getValueMethodインタフェース内PostInterface- パラメータ:
String- Itemの物理名称- 戻り値:
- String 属性名
- 例外:
Throwable
-
setItems
出力Itemに値を設定する(CDATAの値を設定)- 定義:
setItemsインタフェース内PostInterface- パラメータ:
Document- ドキュメントルートVector- 格納するアイテム群- 例外:
Throwable
-
setItem
public static final void setItem(NodeIterator nl, jp.ne.mki.wedge.run.client.data.Item item, String attributeName) 指定のNodeIteratorの属性値からitemに値を設定する- パラメータ:
NodeIterator- itemタグ以下のNodeIteratorItem- 格納するアイテムString- 属性名称
-
setItem
指定のNodeIteratorのCDATA値からitemに値を設定する- パラメータ:
NodeIterator- itemタグ以下のNodeIteratorItem-
-
getXmlView
指定のNodeをStringに展開する- パラメータ:
Node-StringBuffer-- 戻り値:
- String
-
writeTraceLog
ログ出力- 定義:
writeTraceLogインタフェース内CommonInterface- オーバーライド:
writeTraceLogクラス内AbstractBase- パラメータ:
String- 出力するメッセージ
-
whenBeforeHttpAccess
public boolean whenBeforeHttpAccess()HTTPアクセスをする前の処理 サーバにアクセスする前に実行されます。 デフォルトでは何も行いません。 処理を記述する場合は上書きしてください。- 戻り値:
- boolean true:処理続行 false:処理キャンセル
-
whenNewSession
public boolean whenNewSession(boolean isFirstAccess) 新しいSessionだった場合の処理 サーバアクセス後実行されます。 デフォルトでは何も行いません。 処理を記述する場合は上書きしてください。- 戻り値:
- boolean true:処理続行 false:処理キャンセル
-
AdjustmentHttpResponseCode
Httpレスポンスコードのチェック デフォルトでは「200」以外の場合はエラーメッセージを表示して処理を中断します。 処理を記述する場合は上書きしてください。- 戻り値:
- boolean true:処理続行 false:処理キャンセル
-
getUrlConnection
URLConnectionを取得- 戻り値:
- URLConnectionを取得
-
setResult
public final void setResult(int result) ロジッククラス戻り値を任意に指定- パラメータ:
int- 戻り値
-
getCookie
Cookieを取得- 戻り値:
- String Cookie
-
clearCookie
public final void clearCookie()Cookieクリア -
setCookie
Cookieを設定 -
getSendContentType
送信Content-Typeを指定 空文字の場合にはContent-Typeの設定は行いません。 デフォルトでは空文字になります。 任意のContent-Typeにて送信したい場合は上書きしてください。- 戻り値:
- String コンテントタイプ名称
-
getEncodeName
charsetからEncode名称を取得 UTF-8,ISO-8859-1,US-ASCII,ISO-8859-9,SHIFT_JIS,EUC-JPを対象にしています。 対象外ものは正しいEncode名称が返らない場合があります。- パラメータ:
String- キャラクタセット名称- 戻り値:
- String エンコード名称
-
getByte
InputStreamよりバイト配列を取得- パラメータ:
InputStream- 読み込み対象のInputStreamint- InputStreamの長さ- 戻り値:
- byte[] バイト配列
- 例外:
Exception
-
getResponseByLength
レスポンス取得:Content-Lengthが使用できる場合- パラメータ:
InputStream- 読み込み対象のInputStreamint- InputStreamの長さ- 戻り値:
- byte[] バイト配列
- 例外:
Exception
-
getResponseByOutputStream
レスポンス取得:Content-Lengthが使用できない場合- パラメータ:
InputStream- 読み込み対象のInputStream- 戻り値:
- byte[] バイト配列
- 例外:
Exception
-
setDefaultCharsetForLog
ログ出力のためのデフォルトCharSetを設定する 設定なしの場合(null)は、SystemのデフォルトCharsetになります。 このメソッドは Ver1.1.0のパッチより新規追加されました。- パラメータ:
charSet-
-
getRequestHeaderOptionalValue
Manageに紐づいた OptionalDataMapから、
REQESUT_HEADERをtargetとするOptionalDataの一覧を取得し、 Propertiesの配列で返します
それぞれのPropertiesには、"key","value"の二つの項目が設定されており、
それぞれに OptionalData.getName()、OptionalData.getData()の値が
格納された形となります。- パラメータ:
URLEncode- URLエンコードを行うかどうか- 戻り値:
- OptionalDataをPropertiesの配列で取得
-
getRequestBodyOptionalValue
Manageに紐づいた OptionalDataMapから、
REQESUT_BODYをtargetとするOptionalDataの一覧を取得し、 「Name=Data」の形式を「入力が無効です: '&'」で結合した、文字列で返します- パラメータ:
URLEncode- URLエンコードを行うかどうか- 戻り値:
- OptionalDataを「Key=Name」の形式で さらに「入力が無効です: '&'」で結合した文字列
-
getHeaderValues
Http通信時にヘッダに設定する内容を String配列で取得します。
このメソッドは継承元でオーバライドして、URLConnectionに設定する
ヘッダを変更することができます。
オーバライドしなかった場合は getRequestHeaderOptionalValue() の値を
そのまま返します。- 戻り値:
- HttpRequestHeaderに設定するヘッダ
-