I'm programing in SAPUI5 for mobile application, and I'm using the SAPUI Tools developer.
I create a default project with XML application view.
I'm receiving the follow error:
2015-02-12 15:44:21 Device API logging initialized - DEVICE
sap-ui-core.js:80 2015-02-12 15:44:21 registerResourcePath ('', 'https://openui5.hana.ondemand.com/resources/') - sap.ui.ModuleSystem
sap-ui-core.js:80 2015-02-12 15:44:21 registerResourcePath ('com/maxinst', './') - sap.ui.ModuleSystem
sap-ui-core.js:80 2015-02-12 15:44:21 registerResourcePath ('com/maxinst/mobile', 'maxinstmobile/') - sap.ui.ModuleSystem
sap-ui-core.js:80 2015-02-12 15:44:21 URL prefixes set to: - sap.ui.ModuleSystem
sap-ui-core.js:80 2015-02-12 15:44:21 (default) : https://openui5.hana.ondemand.com/resources/ - sap.ui.ModuleSystem
sap-ui-core.js:80 2015-02-12 15:44:21 'com/maxinst' : ./ - sap.ui.ModuleSystem
sap-ui-core.js:80 2015-02-12 15:44:21 'com/maxinst/mobile' : maxinstmobile/ - sap.ui.ModuleSystem
sap-ui-core.js:27 Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.
sap-ui-core.js:27 XHR finished loading: GET "https://openui5.hana.ondemand.com/resources/sap/ui/thirdparty/jquery-mobile-custom.js".
sap-ui-core.js:27 XHR finished loading: GET "https://openui5.hana.ondemand.com/resources/sap/ui/core/library-preload.json".
sap-ui-core.js:27 XHR finished loading: GET "https://openui5.hana.ondemand.com/resources/sap/m/library-preload.json".
sap-ui-core.js:27 XHR finished loading: GET "https://openui5.hana.ondemand.com/resources/sap/ui/commons/library-preload.json".
sap-ui-core.js:27 XHR finished loading: GET "https://openui5.hana.ondemand.com/resources/sap/ui/layout/library-preload.json".
sap-ui-core.js:27 XHR finished loading: GET "https://openui5.hana.ondemand.com/resources/sap/ui/core/themes/sap_bluecrystal/library-parameters.json".
https://openui5.hana.ondemand.com/resources/sap-ui-core.js XHR finished loading: GET "https://openui5.hana.ondemand.com/resources/sap/m/themes/sap_bluecrystal/library-parameters.json".
https://openui5.hana.ondemand.com/resources/sap-ui-core.js XHR finished loading: GET "https://openui5.hana.ondemand.com/resources/sap/ui/layout/themes/sap_bluecrystal/library-parameters.json".
https://openui5.hana.ondemand.com/resources/sap-ui-core.js XHR finished loading: GET "https://openui5.hana.ondemand.com/resources/sap/ui/commons/themes/sap_bluecrystal/library-parameters.json".
https://openui5.hana.ondemand.com/resources/sap-ui-core.js XHR finished loading: GET "https://openui5.hana.ondemand.com/resources/sap/m/messagebundle_en_US.properties".
https://openui5.hana.ondemand.com/resources/sap-ui-core.js XHR finished loading: GET "http://localhost:8080/maxinstMobile/Component-preload.js".
https://openui5.hana.ondemand.com/resources/sap-ui-core.js XHR finished loading: GET "http://localhost:8080/maxinstMobile/Component.js".
https://openui5.hana.ondemand.com/resources/sap-ui-core.js XHR finished loading: GET "https://openui5.hana.ondemand.com/resources/sap/ui/thirdparty/signals.js".
https://openui5.hana.ondemand.com/resources/sap-ui-core.js XHR finished loading: GET "https://openui5.hana.ondemand.com/resources/sap/ui/thirdparty/hasher.js".
https://openui5.hana.ondemand.com/resources/sap-ui-core.js XHR finished loading: GET "https://openui5.hana.ondemand.com/resources/sap/ui/thirdparty/crossroads.js".
UIComponent.js:6 Uncaught Error: resource URL './' has unknown type (should be one of .properties,.hdbtextbundle)
How can I solve this?
The error message is misleading. It is thrown by the Bundle JavaScript function in sap-ui-core.js. That function is used to open a resource bundle file such as messageBundle_en_US.properties. That is, the error is not thrown when you register the path in the index.html initialization, but later in your code when you attempt to open a resource bundle file. Here is an example from the init() function in Components.js in the sample project:
const i18nModel = new sap.ui.model.resource.ResourceModel(
{bundleUrl : [rootPath, mConfig.resourceBundle].join("/")}
);
If the mConfig variable or the resourceBundle property is not defined, then you will see your error message. In this case, you can replace mConfig.resourceBundle with a literal string such as i18n/messageBundle.properties to test whether that is your issue.
In my case, mConfig was not defined. That's a different problem, and I'm off to troubleshoot that now.
Related
I'm writing an app in Heroku that sends push notifications to the web browser. I have this working 100%, except that Firefox is not receiving any push notifications. Chrome and Edge are, but Firefox isn't. I've made sure that Firefox allows notifications. So, my question isn't really around the coding part of it, since that appears to be working, but it's more of "is there anything with Firefox that I need to be aware of when developing a web push notification app for it"? I know that each major browser treats push notifications a bit differently, and that's what I suspect the issue is.
Here's the console output for Firefox on the site I subscribed to push notifications for. I get the same JSON syntax error in all browsers, by the way - but the JSON does parse correctly:
Service worker successfully registered. subscribeUser.js:22:13
email catpured = qaz#qaz.com test.html:33:17
Received PushSubscription: {"endpoint":"https://updates.push.services.mozilla.com/wpush/v2/gAAAAABesF3MuanJl_xHII9ya_KSkLSe0CmR4ZZqnlT5HNv4qwV24Zv1hkCe7eGuPsh3HLRm2g0u_vbw_-f6Nw4Gk_SpFW9QcGX3DQMSqX5z_bJUfV_Ws5oHY-A8Q_Nfqcv7iji-_89BtaM0wmde3gx2exJsXbE_uxfr6daFInUKgWLkb3BtmhI","keys":{"auth":"n8yCVyUqhYkOGamajx03Pg","p256dh":"BDgmGLotx4N2BQdqdsIkFjRhycZW1NisTktz-Lyvg094LbDDjMiZEQlLpeuDQCD030Lzx-FleNPewDglpnYS2Wo"}} subscribeUser.js:62:15
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
notificationText Object Stringified: {"notification":{"body":"this is coolfgsdfsfdsfdsdfsdfsfds","title":"Whoa","actions":[{"action":"Yes","title":"Yes","icon":"./images/notification_icon.png"},{"action":"No","title":"No","icon":"./images/notification_icon.png"}],"data":{"url":"http://www.yahoo.com"},"requireInteraction":true}} service-worker.js:9:11
NotificationText Object Not Stringified:
Object { notification: {…} }
service-worker.js:10:11
NotificationText.Notification Object:
Object { body: "this is coolfgsdfsfdsfdsdfsdfsfds", title: "Whoa", actions: (2) […], data: {…}, requireInteraction: true }
service-worker.js:11:11
TypeOf notificationText: object service-worker.js:12:11
Notification: Whoa
Here's the console output for Chrome:
email catpured = 4444#4444.com
subscribeUser.js:62 Received PushSubscription: {"endpoint":"https://fcm.googleapis.com/fcm/send/ekyiCymm_cE:APA91bGTjb4ccnWyiLZ5JIi99rIllciNnnVWt0DvL7emfgpP9Ft_CppxakL_xbB2lH-Xacu1rhov8LXbGCfes4ym0tvObNUSUvwDLA6cr9-0ANSUpUfmLBUq_WxV2DGNTBoDn93jFc8U","expirationTime":null,"keys":{"p256dh":"BMUz_sHi9NWQeuBy5gNmlkPv2PP04A_sbiee01EzuMdCrW14da4r0C2-eVA-tjzNDFxLF1wd1F-I852t8Hl7mb4","auth":"xDNUaKR8gMAhmSG6rbQS5w"}}
test.html:1 Uncaught (in promise) SyntaxError: Unexpected token O in JSON at position 0
Promise.then (async)
sendSubscriptionToBackEnd # subscribeUser.js:84
(anonymous) # subscribeUser.js:64
Promise.then (async)
subscribeUserToPush # subscribeUser.js:61
(anonymous) # subscribeUser.js:42
Promise.then (async)
askPermission # subscribeUser.js:41
(anonymous) # test.html:34
service-worker.js:9 notificationText Object Stringified: {"notification":{"body":"this is coolfgsdfsfdsfdsdfsdfsfds","title":"Whoa","actions":[{"action":"Yes","title":"Yes","icon":"./images/notification_icon.png"},{"action":"No","title":"No","icon":"./images/notification_icon.png"}],"data":{"url":"http://www.yahoo.com"},"requireInteraction":true}}
service-worker.js:10 NotificationText Object Not Stringified: {notification: {…}}
service-worker.js:11 NotificationText.Notification Object: {body: "this is coolfgsdfsfdsfdsdfsdfsfds", title: "Whoa", actions: Array(2), data: {…}, requireInteraction: true}
service-worker.js:12 TypeOf notificationText: object
service-worker.js:15 Notification: Whoa
And here's the notification I get for Chrome:
And here's the notification I get:
The answer is here: https://www.askvg.com/tip-enable-disable-mozilla-firefox-notifications-to-show-in-windows-10-action-center/. Turns out that notifications in Firefox to display in the Windows 10 Action Center is disabled by default.
I am making a bot that can grab a source.zip / source.targz from Github, then implement it into my app and new changes are applied, but I have not found a way to download a release because the #Octokit/Rest module I'm using only gets the release. Not download. Other npm packages don't work for me and if so, the node_modules folder can get really big, around 19mb. When I do a https GET request, Github requires me to use a USERAGENT, but I don't know how to tie in Octokit with plain HTTPS requests.
I want to be able to download releases by code, but what I get is the following in the zipfile I tie it to:
Request forbidden by administrative rules. Please make sure your request has a User-Agent header (http://developer.github.com/v3/#user-agent-required). Check https://developer.github.com for other possible causes.
var file = fs.createWriteStream('bot.zip')
var request = await https.get(releases[num].zipball_url, function(response) {
response.pipe(file)
})
//https://stackoverflow.com/questions/11944932/how-to-download-a-file-with-node-js-without-using-third-party-libraries
var octokit = new Octokit.Octokit({
userAgent: 'Github Bot Updater',
previews: ['jean-grey', 'symmetra'],
baseUrl: 'https://api.github.com',
log: {
debug: () => {},
info: () => {},
warn: console.warn,
error: console.error
},
request: {
agent: undefined,
fetch: undefined,
timeout: 0
}
})
var releases = await octokit.paginate("GET /repos/:owner/:repo/releases", { owner: username, repo: reponame})
//octokit has no method for downloading a release
What I did was instead of getting the zipball from the release, you can also get the same thing from going to the main repo page, then going to the branches button in the corner, going to tags and the desired release tag. Then after you click on that you can download that release. When I looked into that, instead of doing
releases[num].zipball_url in
var request = await https.get(releases[num].zipball_url, function(response) {
response.pipe(file)
})
You can do
https://codeload.github.com/${username}/${reponame}/zip/${releases[num].tag_name}
And that works.
i'm running a gradle build with vertx web. my library dependecies include
// for mock API serving https://mvnrepository.com/artifact/io.vertx/vertx-core
compile group: 'io.vertx', name: 'vertx-core', version: '3.5.3'
compile group: 'io.vertx', name: 'vertx-web', version: '3.5.3'
so in my groovy script code i do this
Vertx vertx = Vertx.vertx()
HttpServer server = vertx.createHttpServer()
...
I then declare a route to catch all requests on resource and process the request and form a response - trying to keep it simple - just return simple string as response
Router allRouter = Router.router(vertx)
allRouter.route ( "/api/now/table/incident")
.handler(BodyHandler.create())
.blockingHandler { routingContext ->
def request = routingContext.request()
HttpMethod method = request.method()
def response = routingContext.response()
response.putHeader ("content-type", "text/plain")
def uri = routingContext.request().absoluteURI()
switch (method) {
case HttpMethod.GET:
println "processing a resource GET on uri : $uri "
response.end ("(GET) howdi will")
break
case HttpMethod.POST:
String bodyEnc = routingContext.getBodyAsJson().encodePrettily()
println "processing a resource POST on uri : $uri"
println "post request received post data : " + bodyEnc
response.end ("(POST) howdi will")
break
}
}
I create a handler for BodyHandling, before the general handler in the route.
Then I start the server with the route
server.requestHandler(allRouter.&accept)
server.listen(8081, "localhost")
works all fine for a get request from postman.
when i use a post request with a request body data - the service hangs and i have to cancel - it never gets to the switch statement. All that happens in the console when i issue the post is
23:30:16.455 [vert.x-eventloop-thread-1] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.maxCapacityPerThread: 32768
23:30:16.455 [vert.x-eventloop-thread-1] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.maxSharedCapacityFactor: 2
23:30:16.455 [vert.x-eventloop-thread-1] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.linkCapacity: 16
23:30:16.455 [vert.x-eventloop-thread-1] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.ratio: 8
23:30:16.478 [vert.x-eventloop-thread-1] DEBUG io.netty.buffer.AbstractByteBuf - -Dio.netty.buffer.bytebuf.checkAccessible: true
23:30:16.482 [vert.x-eventloop-thread-1] DEBUG io.netty.util.ResourceLeakDetectorFactory - Loaded default ResourceLeakDetector: io.netty.util.ResourceLeakDetector#51d486
This is the nearest to being a related topic enter link description here
I have tried this countless ways now, set bodyHandler inside the request when i get it etc - can't get it to work.
my postman post looks like this - where the headers are set to Content-Type application/json, Content-Length is 296 bytes (length of bytes in utf16), and Accept is text/plain to receive simple response
The documentation is just not clear. Blown 12 hours trying to crack this.
Does any one know exactly how one should get the post data on a request when using vertx web please
It appears as though my problem was the size of bytes being sent. I had calculated the bytes of the reqBody string as 296 bytes (using UTF16 charset), and set this into the Postman request.
So the vertx server was trying to read that many when processing the body and hanged. When I just did reqBody.getBytes().size - effectively UTF8, this returned 147 bytes. When I changed the content-length to this in postman, it started to work.
There is a timing issue in where you setup the BodyHandler. I tried this is tin the switch case, and it fails with request has already been read.
However neither of these seem to work successfully.
option 1 : ' create body handler before the route (path) call'
allRouter.route().handler(BodyHandler.create())
//now try and setup the route for API path interception
allRouter.route ( "/api/now/table/incident")
.blockingHandler { routingContext -> ...
option 2 : 'chain the handlers but put the Body Handler first'
//now try and setup the route for API path interception, followed by body handler
allRouter.route ( "/api/now/table/incident")
.handler(BodyHandler.create())
.blockingHandler { routingContext ->...
This was setting the content-length, assuming UTF16 for internal byte size that was the real problem. Now back to trying to complete what I set out to do.
So I am making the web app on top of angular 5.
The problem is when I try to call the api endpoint from the server.
When I get an error response (400+), it seems like on Safari it always throws and breaks the app.
ERROR - TypeError: Type error
ERROR CONTEXT – DebugContext_ {view: Object, nodeIndex: 0, nodeDef: Object, …}
But on Chrome it can handle the error correctly like this.
GET https://api.xxxx.com/projectname/v1.0/validation/access-token 400 (Bad Request)
This is my source code
const baseUrl = environment.apiUrl;
const fullUrl = baseUrl + '/productname/v1.0/validation/access-token';
const headers = new HttpHeaders({
'X-Access-Token': access_token
});
this.http.get(fullUrl, {
headers: headers
}).subscribe((res: any) => {
console.log(res, 'http res');
},
(error: any) => {
console.log(error, 'http err');
});
Anyone has an idea how to fix this?
After a lots of debugging, I figured out the issue that was causing for me. In every request, I was sending the name of the mobile device and for my case it was, Shashank's iPhone.
Calling setRequestHeader with single quote in the header was failing and hence all the HTTP request broke.
I had a Flutter App using an Inapp_Webview that points to an Angular 1.X web application and was also receiving a TypeError for all XHR requests after changing my iOS device name to include an apostrophe.
(*wanted to leave a comment, but didn't have the rep yet)
I have a controller named CustomersInfoAPIController. I'm using Knock out, webapi2, asp.net mvc5 to build an application. I'm binding the data using knout JS. When I run the application and debug the knockout script, I don't see any error .When I try to insert data using AJAX I see error `"Failed to load resource: the server responded with a status of 500 (Internal Server Error)"
the ajax code is:
$.ajax({
url: '/api/CustomersInfo',
type: 'post',
data: dataObject,
contentType: 'application/json',
success: function (data) {
addCustomerViewModel.customerListViewModel.customers.push(new
Customer(data.Id,data.CustomerName, data.ContactName, data.Address,
data.City, data.PostalCode, data.Country));
self.Id(null);
self.CustomerName('');
self.ContactName('');
self.Address('');
self.City('');
self.PostalCode('');
self.Country('');
}
});