How to specify URLs from glassware .net application - google-mirror-api

I would like specify Urls as in the below code in my .net glassware application
{
IList<string> imageUrls = new List<string>();
imageUrls.Add (what is it here?")
Iconact.ImageUrls = imageUrls;
}
Currently this url will be used at the time of rendering at the device (or mirror api?), so web app, this url makes sense, how about .net client as a glassware, i have my image as part of the glassware app and how to pass this image as a url?
Similar question how to specify subscription endpoint url in .net app?, it makes sense in web app, but i could not get the concept in .net client.
Thanks

Those assets need to be hosted somewhere: they don't necessarily need to be within your Glassware and can be hosted separately. However, those URLs need to be publicly accessible for the Glass client to fetch them.
You could host them on a free Google App Engine app that only purpose would be to serve those images.
Regarding the subscription endpoint: it needs to be publicly accessible and support POST requests over HTTPS.

One solution could be that creating WebServiceHost and adding service end point such as:
WebServiceHost host = new WebServiceHost(typeof(Service), new Uri("http://localhost:8000/"));
ServiceEndpoint ep = host.AddServiceEndpoint(typeof(IService), new WebHttpBinding(), "");
host.Open();
Will it work?

Finally what I did was that as in the Alain's answer having a Java Servlet app running in Google App Engine which receives all the notification and maintains all the user account logic and sends the notification to specific client(part of glassware app) in the local system thru XML over XMPP.

Related

Sheets API from Google App Engine

I am trying to access my own sheets from Google App Engine. I followed the following tutorial
https://developers.google.com/sheets/quickstart/java
this code works fine as long as the code does not run inside the Google App Engine. The following line of code throws an exception (your are not allowed to use sockets)
Credential credential = new AuthorizationCodeInstalledApp(
flow, new LocalServerReceiver()).authorize("user");
So as you can I see, I have problems with the authorization between my app engine and my google sheets.
Has someone a working example how I can access the Google Sheets API from App Engine or can give me an example how the OAuth2 Autorization between App Engine and any other Google Service will work?
Regards
Michael
I think Google App Engine has guides with regard to connecting to your App like
Issuing HTTP(S) Requests:
To issue an outbound HTTP request, use java.net.URLConnection. App Engine implements the methods defined in this abstract class by using the URL Fetch API.
The following snippet demonstrates how to perform a basic HTTP GET request. The application creates a new URL object, then calls the object's openStream() method to retrieve the content at that URL:
URL url = new URL("http://api.icndb.com/jokes/random");
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuffer json = new StringBuffer();
String line;
while ((line = reader.readLine()) != null) {
json.append(line);
}
reader.close();
Since you received an error with regard to sockets, App Engine has a guide for that too:
Overview of Sockets API for Java
-Sockets are available only for paid apps.
-You cannot create a listen socket; you can only create outbound sockets.
-FTP is not supported.
-java.net.URL is still configured to use the URL Fetch API; there is currently no way around this.
-InetAddress.isReachable is a no-op, etc
Overview of App Identity API for Java
The App Identity API lets an application discover its application ID (also called the project ID). Using the ID, an App Engine application can assert its identity to other App Engine Apps, Google APIs, and third-party applications and services. The application ID can also be used to generate a URL or email address, or to make a run-time decision.

ACS Setup For Mobile App

I'm writing a mobile app that connects to Azure web services that use ACS access control for authentication. The mobile app is going to be a new version of a website that already exists. The website is already setup in ACS to connect to the web services.
Do I need to create a new entry in the ACS portal for the mobile app or can I just re-use the entry that the website has? If I create a new entry, what would I put in the realm and return URL? Mobile apps don't use URLs so I'm confused.
Thanks.
ACS supports a jsnotify protocol which basically will fire a JavaScript event that the host can listen. However this only works on Windows Phone. The other option you have is to poll the InApp browser (webview) until the URL is equal to whatever you put on the return url. Then inspect the result of the page to get the token, but that's not very easy. The truth is that ACS has not been updated for years and they are behind on mobile scenarios. You will probably spend a week or so trying to get something to work.
You can look at other services like Auth0 (disclaimer: I work at Auth0) which support the same protocol ACS supports (Ws-Fed) and have native support for lots of platforms (ios, wp, windows8, android, xamarin, etc.).

Automated creation of customer urls for GAE web application

i am new to GAE and currently evaluating if i can use GAE for deploying my java web application. When my application is finished a new user has to be able to register on my website for the usage and then he gets his private url ( user1.myapp.com) with an instance of my application. Is it difficult to realize this with GAE.
best regards
Peter
It should be possible according to the documentation:
https://developers.google.com/appengine/docs/domain#more_about_wildcard_subdomain_mapping
After that, it's up to your application. Any decent framework you use should be able to handle multiple domains and generate content based on them.

How does one google app engine app serve multiple domains?

Or can it be done?
For example, I want to help a few friends to setup their shopping cart websites. They have their website domain names already purchased. But I want to pay one google app engine application at www.mywebsite.com, and I want to "forward" their domain to www.mywebsite.com/friend1, www.mywebsite.com/friend2. In this way, I want their customers see their website which could be http://www.friend1.com, but they are actually served by one single app engine application.
In my application, I know how to get the path analyzed so I can go to datastore to serve diffrent pages, html. So the question is just how or can one google app engine be forwarded from different domains. Thanks!
I'm not quite sure what is your exact meaning of "forward", but I try to answer for different situations.
If you want the browser to keep displaying www.friend1.com all the way without ever showing www.mywebsite.com, you should have friend1.com setup as a Google App account, and add their domain into your application (just like you did for your own domain). This way, all traffic to www.friend1.com (or what ever subdomain they pick) goes to your appengine app. And your App should detect the domain of the http request and response accordingly.
If you just want a "redirect"... that means, user goes to www.friend1.com will have their browser auto goes to www.mywebsite.com/friend1 and displaying it in the URL bar , well, just setup one index.html page in www.friend1.com and add meta refresh header in the file. Or use any server side redirect method.

Backend instance at custom domain

I was unable to access my Backend Instance at custom domain.
For example, I have an app and I access the Normal Instance sucessfully at:
http://www.[my_app_id].appspot.com or http://[my_app_id].appspot.com
And I have a backend config name=test and I accessed Backend Instance successfully at:
http://test.[my_app_id].appspot.com
In admin interface, the "Instances" link show the instances of Backend and Normal Instance separately. The content show is the same, but is easy to see when a request go to the Backend Instance and when go to Normal Instance.
Then I configured the wildcard "test" in Google Apps to access my Backend Instance at a custom URL:
I continue access the Normal Instance sucessfully at:
http://www.[my_domain].com or http://[my_domain].com
But request at
http://test.[my_domain].com
redicted to the Normal Instance instead of Backend Instance.
The doc's said it should work but I cann't at this moment and I need uses custom domain because my app is multitenancy.
What I do wrong?
Your backed is really supposed to be accessed by the front end, as I understand it.
So when your application front end makes a request to it's back end (e.g. via a URL), it'll work as it's all done internally.
Have you set your back end to be publicly accessible?
https://developers.google.com/appengine/docs/python/backends/overview#Public_and_Private_Backends
Backends are private by default, since they typically function as a component inside an application, rather than acting as its public face. Private backends can be accessed by application administrators, instances of the application, and by App Engine APIs and services (such as Task Queue tasks and Cron jobs) without any special configuration. Backends are not primarily intended for user-facing traffic, but you can make a backend public for testing or for interacting with an external system.
I don't know why the redirection is not working, but perhaps you should modify your question to show what problem it is you are trying to solve here and get an answer to that instead?

Resources