I am having some trouble getting my dispatch.yaml file to run on the local devappserver. I have had two errors one seems to be related to indentation
expecting <block end>, but found ? I can fix this by removing the indentation as shown below in my dispatch file.
The second problem happens when I have removed the indentation I get Unexpected attribute 'service' of type DispachInfoExternal I have tried copying the example from the google docs but I get the same error, I have also tried changing the name service to module as I believe that was the old name and I get the same error. I am using Atom as my editor.
dispatch:
- url: '*/content/*'
service: default
- url: '*/admin/*'
service: admin-services
- url: '*/creator/*'
service: creator-services
- url: '*/social/*'
service: social-services
- url: '*/subs/*'
service: subscription-services
- url: '*/user/*'
service: user-services
You're missing the indentation from the yaml files.
It's different writing
dispatch:
- url: '*/content/*'
service: default
than
dispatch:
- url: '*/content/*'
service: default
Related
I have a application.yml file in my application
spring:
profiles:
active: default,dev
app:
properties:
lucene:
indexInfoFile: ${spring.jpa.properties.hibernate.search.default.indexBase}/index.properties
reindex: false
storage:
home: ${user.home}/xxx
basePath: ${app.properties.storage.home}/uploads/
staticFilesPrefix: /files/
appUrl: /app/
spring:
profiles: dev
http:
multipart:
max-file-size: 3MB
max-request-Size: 3MB
Now in my controller, I am trying to get the data from yml file and the code for the same is
$http.get('/resources/application.yml').then(function (response) {
console.log('entire data is ', response.data);
console.log('basePath is ', response.data.basePath);
});
Entire Data is printing perfectly ( the whole yml file is getting printed) but when ever I am trying to print a particular property like basePath, max-file-size etc I am getting "undefined error".
My question is how to get a particular property to be printed on the console.
I would not recommend to access the yml file directly in Angular.
The format is difficult to parse (hence your question) and you sooner or later you may not want to expose all your confguration details.
Instead create a rest controller in spring mapped to something like /config
Let spring inject all the configuration values you need using #Value and return a Map or a simple PoJo with exactly the attributes you need.
Spring will convert this to JSON which you can easily be consumed in Angular.
I want to publish my project to a folder in IIS but with the routes setup the way it is I get what looks like an internal loop and not finding the path.
I published the project in a folder already
angular.module("common.services", ["ngResource"])
.constant("appSettings",
{
//serverPath: "http://localhost:53967/"
//name of the computer and folder to which the project was published
serverPath:"http://ct-dx-ariang/AspNetWebApi/"
});
And have a resource setup as follow
angular.module("common.services").factory("productResource", ["$resource", "appSettings", productResource])
function productResource($resource, appSettings) {
//return $resource(appSettings.serverPath + "/api/products/:search");
return $resource(appSettings.serverPath + "/api/products/:id"
These are my routes
$urlRouterProvider.otherwise("/");//default url
$stateProvider.state("home", {
url: "/",
templateUrl: "/templates/welcomeView.html"
}).state("productList", {
url: "/products",
templateUrl: "/templates/productListView.html",
controller: "ProductListController"
}).
How can I modify this sample project so that it runs in the published folder on the IIS as opposed to in localhost on visual studio?
A slash at the beginning of a path makes that path relative to the root of the site. So in your case:
templateUrl: "/templates/productListView.html"
will always refer to http://myhostname/templates/productListView.html, no matter in which subpath is hosted your site.
Removing the first slash may solve your issue:
templateUrl: "templates/productListView.html"
Also looking at your $resource configuration:
return $resource(appSettings.serverPath + "/api/products/:id"
And your AppSettings constant:
serverPath:"http://ct-dx-ariang/AspNetWebApi/"
Seems to me that you are adding two consecutive slashes to your $resource path. The resulting path will be: http://ct-dx-ariang/AspNetWebApi//api/products/:id
These are my routes
Pretty hardcoded. Make sure that you use the same constant over there for all your templates as well.
templateUrl: appSettings.serverPath + "/templates/welcomeView.html"
My App Engine isn't loading php files in sub directory
Directory Structure is from the app.yaml file to the corresponding files.
I'm using Google's App Engine with PHP and my YAML code is below
handlers:
- url: /
script: soap/index.php
- url: /(.+)
script: soap/index.php
- url: /getGEO.php
script: soap/getGEO.php
- url: /tests/XML_GEOOffers.php
script: soap/tests/XML_GEOOffers.php "No handlers matched this URL."
- url: /tests/test.php
script: soap/tests/test.php "No handlers matched this URL."
I also having problem to past the parameters for GET in url
localhost:11080/trace ( my script shows false as no paramter sent )
but when i past the parameters into url, it shows blank page instead for true or false
localhost:11080/trace?Pub=0&Adv=0&SDK=0&HWD=c45f9a729cd349bdf3f21e96d305afde1028be99&OS=0&AV=nothing|nothing&BROWSER=IE&Sub=0&campaign=0&Demo=0
I'd greatly appreciate if anybody can help me with this.
You need to put / last, else it matches every url. Same for your /(.+) handler. Try this order:
handlers:
- url: /getGEO.php
script: soap/getGEO.php
- url: /tests/XML_GEOOffers.php
script: soap/tests/XML_GEOOffers.php #"No handlers matched this URL."
- url: /tests/test.php
script: soap/tests/test.php #"No handlers matched this URL."
- url: /(.+)
script: soap/index.php
- url: /
script: soap/index.php
You don't really need one of the last two, as they point to the same place.
I try to understand the different between:
The class ChatsRequestHandler generate a template with the name chats.html
template = self.generate('chats.html', template_values)
In the application view its is named getchats:
application = webapp.WSGIApplication(
[('/', MainRequestHandler),
('/getchats', ChatsRequestHandler)],
The same occurs to me at edit_user.html v.s ('/edituser', EditUserProfileHandler)
How is it that the application knows that the getchats is connected to the chats.html aldo they have not the same name? I would expect that it should be the same name chats.html and ('/chats', ChatsRequestHandler).
The flow of your request goes something like this.
App Engine looks up your app.yaml file. It should contain an entry that says /getchats should be handled by application in somefile.py.
It then goes to this "application view" and matches it to a Webapp Route. In this case, that route is ('/getchats', ChatsRequestHandler).
Then it calls get or post on ChatRequestHandler, passing it the request and response objects.
The output of that is sent back to the user's browser.
You are free to implement ChatRequestHandler as you'd like. In this case you're doing so by reading in a template named chats.html, populating it with some values, and then outputting it.
So the application knows that getchats is connected to ChatRequestHandler. The name of chats.html is pretty arbitrary - the ChatReqeustHandler has to know it, but that is all. You could rename it.
Thanks for helping me:
The example a came up with comes from codenvy.com as a examples app.
1 App Engine looks up your app.yaml file. It should contain an entry that says /getchats should be handled by application in somefile.py.
Here is the app.yaml file of this application
application: 3kus-apps
version: 1
runtime: python
api_version: 1
handlers:
- url: /css
static_dir: css
- url: /js
static_dir: js
- url: /.*
script: devchat.py
So as you can see it contain's no entry that says /getchats should be handled by application in somefile.py.
What i found there is a util.js file witch has a function updateChat(). function updateChat() {downloadUrl(getRandomUrl("/getchats"), "GET", null, onChatsReturned);}.
However, I would like to know - under (1) how this should be handled by a somefile.py.
I'm relatively new to GAE, and I'm having some difficulty understanding the URL mappings.
I have a set of data that is static (HTML templates, login forms, js etc), and a section that's dynamic.
My current app.yaml has as follows:
handlers:
- url: /.*
static_dir: /static
- url: /service/.*
script: _go_app
login: required
The idea here is that http://myapp/service/foo would route to the app, and that anything else like http://myapp/foo.html should serve /static/foo.html. However, I'm getting a 404 error on the static request.
Ideas?
According to the documentation,
url: A URL prefix. This value uses regular expression syntax (and so regexp special characters must be escaped), but it should not contain groupings. All URLs that begin with this prefix are handled by this handler, using the portion of the URL after the prefix as part of the file path.
In your case since you are specifying url: /.*, the prefix will be foo.html, and the file to fetch would have an empty filename.
Additionally, the handlers are evaluated from top to bottom so you need to change the order.
handlers:
- url: /service/.*
script: _go_app
login: required
- url: /
static_dir: static
Order is important so your /service/ handler is likely never going to be called unless you move it above the static handler. Also, the 404s are caused by incorrect syntax in your static declaration. Change your handlers to:
handlers:
- url: /service/.*
script: _go_app
login: required
- url: /
static_dir: static
A static_dir directive serves files by the name after the prefix that matches the given regular expression. If the RE ends in .*, the entire URL will be considered the prefix, so there will be nothing left over to use as the file path.
Try url: / instead.
Also, handlers are matched in order.
The regular expression /.* matches all URLs you can receive requests for, so anything after it will never match. Put it last.