顯示具有 EPCIS 標籤的文章。 顯示所有文章
顯示具有 EPCIS 標籤的文章。 顯示所有文章

2010年4月12日 星期一

接收 EPCIS 傳來的 HTTP POST 內容成功了

接收 EPCIS 傳來的 HTTP POST 內容成功了, 並將內容存到 servlet 所在的 local disk。
明天趕快來做筆記。

工具:

tomcat + netbean

2010年4月11日 星期日

EPCIS 的訂閱查詢有成功的送到 指定的 url

EPCIS 的訂閱查詢有成功的送到 指定的 url

工具:
1. EPCIS repository 0.4.2
2. reader-rp-client-0.5.0.rar


收到 http header 的內容如下:
 POST / HTTP/1.1
content-type: text/xml
content-length: 7290
User-Agent: Java/1.5.0_17
Host: 192.168.0.195:9000
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive

來試看看 EPCIS 的 SUBSCRIBED QUERY RESULTS 是否能正確的傳到指定的 port

來試看看 EPCIS 的 SUBSCRIBED QUERY RESULTS 是否能正確的傳到指定的 port

看看這一端是否有問題。

工具: reader-rp-client-0.5.0.rar

感謝 ycchen

取得 HTTP post 的 body

要取得 HTTP POST 的 body 可以使用 ServletRequest interface 的兩個方法: 

BufferedReader getReader()
          Retrieves the body of the request as character data using a BufferedReader.

ServletInputStream getInputStream()
          Retrieves the body of the request as binary data using a ServletInputStream.


getReader() 方法用於字元資料, getInputStream() 方法用於 binary data

2010年4月10日 星期六

設定 tomcat 處理某個 request 所使用的 Charset

要設定 Tomcat 處理某個 request 時所使用的 Charset, 要使用 ServletRequest interface 中的方法:

void setCharacterEncoding(String env)
          Overrides the name of the character encoding used in the body of this request.

例如,要處理 UTF8 的 request:

request.setCharacterEncoding("UTF-8");

Tomcat 所預設的 Charset 為: ISO-8859-1.

接收 epcis 所傳來的 query result XML

EPCIS 傳回來的 query result 內容是以 xml 表示。 編碼格式為 utf8。

不知道接收內容時, 是否要將內容 encoding 成 utf 8 才能讀到正確的內容? 尚在研究中。

EPCIS 的 Callback interface

當 epcis 會利用 Query callback interface 來將 schedule query 的結果傳到指定的 url.