|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpl.mbdev.openstage.push.HttpRequest
pl.mbdev.openstage.push.PostRequest
pl.mbdev.openstage.push.Push
public class Push
Push capability of the OpenStage phone can be utilised with use of this class. Push enables remote launching of the application that was previously defined in the XML Applications list of a given OpenStage phone.
Copyright 2011 Mateusz Bysiek, mb@mbdev.pl, http://mbdev.pl/ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Nested Class Summary | |
---|---|
static class |
Push.RequestType
Type of the push request that will be sent to the OpenStage phone. |
Field Summary | |
---|---|
private java.net.URL |
appAddr
Full URL to the application at the remote server. |
static java.lang.String |
PHONE_PORT
Default port at which the OpenStage phone listens for push requests. |
static java.lang.String |
PHONE_PUSH_SCRIPT
Default location at which the push-response application can be found in the OpenStage device. |
Fields inherited from class pl.mbdev.openstage.push.HttpRequest |
---|
out |
Constructor Summary | |
---|---|
Push(java.lang.String serverAddress,
int serverPort,
java.lang.String programName,
Push.RequestType requestType,
java.lang.String midletName,
java.lang.String serverProtocol,
java.lang.String serverContextKey,
java.lang.String serverContextValue)
Constructs new definition of push, in which all parameters are set directly. |
|
Push(java.lang.String applicationAddress,
java.lang.String midletName,
Push.RequestType requestType,
java.lang.String serverContextKey,
java.lang.String serverContextValue)
Creates a new push request, with quite convenient way of passing the arguments. |
|
Push(java.net.URL appAddr,
java.lang.String midletName,
Push.RequestType requestType,
java.lang.String serverContextKey,
java.lang.String serverContextValue)
Creates a new push request, with the most convenient way of passing the arguments. |
Method Summary | |
---|---|
java.net.URL |
getAppAddr()
Returns the full address to the application at the remote server. |
protected java.lang.String |
getResponse(java.lang.String phoneIP)
Sends the push request to the given OpenStage phone and reads the response. |
boolean |
sendTo(java.lang.String phoneIP)
Sends the push request to the given OpenStage phone. |
Methods inherited from class pl.mbdev.openstage.push.PostRequest |
---|
getResponse, sendTo |
Methods inherited from class pl.mbdev.openstage.push.HttpRequest |
---|
connectTo, disconnect, endInput, endOutput, getParameters, startInput, startOutput |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String PHONE_PORT
public static final java.lang.String PHONE_PUSH_SCRIPT
private final java.net.URL appAddr
Constructor Detail |
---|
public Push(java.lang.String serverAddress, int serverPort, java.lang.String programName, Push.RequestType requestType, java.lang.String midletName, java.lang.String serverProtocol, java.lang.String serverContextKey, java.lang.String serverContextValue) throws java.net.MalformedURLException
serverAddress
- IP address or domain, without port numberserverPort
- port numberprogramName
- path on the server that leads to the XML applicationrequestType
- type of the request, value from Push.RequestType
midletName
- program name, as defined in the OpenStage deviceserverProtocol
- protocol used by the serever, usually 'http' or 'https'serverContextKey
- key from key-value pair, which is sent back from the phone to the
application in the response to the push requestserverContextValue
- value from key-value pair, which is sent back from the phone to the
application in the response to the push request
java.net.MalformedURLException
- when given parameters do not describe a correct URLpublic Push(java.lang.String applicationAddress, java.lang.String midletName, Push.RequestType requestType, java.lang.String serverContextKey, java.lang.String serverContextValue) throws java.net.MalformedURLException
applicationAddress
- full address of the application on the remote servermidletName
- program name, as defined in the OpenStage devicerequestType
- type of the request, value from Push.RequestType
serverContextKey
- key from key-value pair, which is sent back from the phone to the
application in the response to the push requestserverContextValue
- value from key-value pair, which is sent back from the phone to the
application in the response to the push request
java.net.MalformedURLException
- when given address does not describe a correct URLpublic Push(java.net.URL appAddr, java.lang.String midletName, Push.RequestType requestType, java.lang.String serverContextKey, java.lang.String serverContextValue)
appAddr
- full URL of the application on the remote servermidletName
- program name, as defined in the OpenStage devicerequestType
- type of the request, value from Push.RequestType
serverContextKey
- key from key-value pair, which is sent back from the phone to the
application in the response to the push requestserverContextValue
- value from key-value pair, which is sent back from the phone to the
application in the response to the push requestMethod Detail |
---|
public java.net.URL getAppAddr()
protected java.lang.String getResponse(java.lang.String phoneIP) throws java.net.MalformedURLException, java.io.IOException
phoneIP
- IP address of the OpenStage phone that will be pushed
java.io.IOException
- thrown when the given URL caused a connection error, there was a protocol
exception or data transfer was interrupted
java.net.MalformedURLException
- when the provided phone IP is not a valid IPpublic boolean sendTo(java.lang.String phoneIP)
phoneIP
- IP address of the OpenStage phone that will be pushed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |