66 * mms:, cti:, javaapp: and localapp: |
64 * mms:, cti:, javaapp: and localapp: |
67 */ |
65 */ |
68 void PlatformRequestHandler::handleUri(const std::wstring& aUri) |
66 void PlatformRequestHandler::handleUri(const std::wstring& aUri) |
69 { |
67 { |
70 JELOG2(EJavaRuntime); |
68 JELOG2(EJavaRuntime); |
71 TRAPD(err,launchAppL(aUri);); |
69 TRAPD(err, launchAppL(aUri)); |
72 if (err != KErrNone) |
70 if (err != KErrNone) |
73 { |
71 { |
74 ELOG1(EJavaRuntime, "ERROR!!! PlatformRequestHandler::handleUri() %d", |
72 ELOG1(EJavaRuntime, "ERROR!!! PlatformRequestHandler::handleUri() %d", |
75 err); |
73 err); |
76 if (KErrNotFound == err) |
74 if (KErrNotFound == err) |
77 { |
75 { |
78 if ((aUri.find(L"localapp:jam/launch?") == 0) || |
76 if ((aUri.find(L"localapp:jam/launch?") == 0) || |
79 (aUri.find(L"localapp://jam/launch?") == 0) || |
77 (aUri.find(L"localapp://jam/launch?") == 0) || |
80 (aUri.find(L"javaapp:") == 0)) |
78 (aUri.find(L"javaapp:") == 0)) |
81 { |
79 { |
82 // The URI is supported but the MIDlet specified by the URI |
80 // The URI is supported but the MIDlet specified by the URI |
83 // does not exist. |
81 // does not exist. |
84 throw ExceptionBase(PlatformRequestInterface::UNEXPECTED_ERROR, |
82 throw ExceptionBase(PlatformRequestInterface::UNEXPECTED_ERROR, |
85 "Cannot start Java application",__FILE__,__FUNCTION__,__LINE__); |
83 "Cannot start Java application",__FILE__,__FUNCTION__,__LINE__); |
110 { |
108 { |
111 launchNativeAppL(aUri); |
109 launchNativeAppL(aUri); |
112 } |
110 } |
113 else |
111 else |
114 { |
112 { |
|
113 #ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS |
|
114 std::wstring uri; |
|
115 std::wstring okScheme(L"javaapp:"); |
|
116 if (aUri.find(L"localapp:jam/launch?") == 0) |
|
117 { |
|
118 // Remove the scheme not supported by the devices in 10.1 from the |
|
119 // beginning, replace it with okScheme that is supported |
|
120 uri = okScheme; |
|
121 uri += aUri.substr(20); // 20 == wstrlen(L"localapp:jam/launch?") |
|
122 } |
|
123 else if (aUri.find(L"localapp://jam/launch?") == 0) |
|
124 { |
|
125 uri = okScheme; |
|
126 uri += aUri.substr(22); // 22 == wstrlen(L"localapp://jam/launch?") |
|
127 } |
|
128 else if (aUri.find(L"javaapp://") == 0) |
|
129 { |
|
130 // TODO: after QtHighway has been fixed to that |
|
131 // it can recognize "javaapp://" scheme, remove this. |
|
132 // At 2010wk26 it recognizes only "javaapp:" |
|
133 uri = okScheme; |
|
134 uri += aUri.substr(10); // 10 == wstrlen(L"javaapp://") |
|
135 } |
|
136 else |
|
137 { |
|
138 uri = aUri; |
|
139 } |
|
140 LOG1(EJavaRuntime, EInfo, "Platform request. Converted uri: %S", uri.c_str()); |
|
141 |
|
142 TPtrC ptr((const TUint16 *)uri.c_str(), uri.length()); |
|
143 // Start javaqtrequest.exe so that url is command line argument. |
|
144 // javaqtrequest is a Qt application that will use Qt Highway API |
|
145 // to send the url request to correct XQServiceProvider |
|
146 _LIT(KJavaQtRequestExe, "javaqtrequest.exe"); |
|
147 RProcess rProcess; |
|
148 TInt err = rProcess.Create(KJavaQtRequestExe, ptr); |
|
149 if (KErrNone != err) |
|
150 { |
|
151 ELOG1(EJavaRuntime, |
|
152 "PlatformRequestHandler: launchAppL: Starting javaqtrequest.exe failed, err %d", |
|
153 err); |
|
154 User::Leave(err); |
|
155 } |
|
156 |
|
157 // Wait until javaqtrequest exits |
|
158 TRequestStatus status; |
|
159 rProcess.Logon(status); |
|
160 rProcess.Resume(); |
|
161 User::WaitForRequest(status); |
|
162 |
|
163 // Check the exit code of javaqtrequest |
|
164 err = status.Int(); |
|
165 rProcess.Close(); |
|
166 if (err != KErrNone) |
|
167 { |
|
168 ELOG1(EJavaRuntime, |
|
169 "PlatformRequestHandler: launchAppL: javaqtrequest.exe exited with err %d", |
|
170 err); |
|
171 User::Leave(err); |
|
172 } |
|
173 #else |
115 TPtrC ptr((const TUint16 *)aUri.c_str(), aUri.length()); |
174 TPtrC ptr((const TUint16 *)aUri.c_str(), aUri.length()); |
116 std::auto_ptr<CSchemeHandler> schemeHandler(CSchemeHandler::NewL(ptr)); |
175 std::auto_ptr<CSchemeHandler> schemeHandler(CSchemeHandler::NewL(ptr)); |
117 schemeHandler->HandleUrlStandaloneL(); // Process Uri in standalone mode. |
176 schemeHandler->HandleUrlStandaloneL(); // Process Uri in standalone mode. |
|
177 #endif |
118 } |
178 } |
119 } |
179 } |
120 |
180 |
121 /** |
181 /** |
122 * |
182 * |