Here-API : How to create own Layer with custom places - here-api

I would like to get more info on how to create his own layer with custom places for using it on a corridor request like in this example : http://developer.here.com/api-explorer#cls/route-search
In all these Here examples, the layerId = 30 is used. Is there any example how to upload cml or json data to create its own layer ? Thanks for your help.
Nicolas

Importing data is covered in the Custom Location Extension User Guide. You will need to make a post request sending an attached file.
A minimal HTML web-page for data import can be found below:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>HERE - [Custom Location Service] - XML File Upload Example</title>
</head>
<body>
<h1>XML File Upload Example</h1>
<form action="http://stg.api.customlocation.nokia.com/v1/file/import/async/xml" enctype="multipart/form-data" method="post">
<label>xmlfile</label>
<input type="file" name="xmlfile"><br/>
<input type="submit" value="Send">
</form>
</body>
</html>
The administration of a layer is described in the Administrator's User Guide available here.

Related

Browser tab information for image created by servlet

I'm using a servlet to show images on page. The links looks like
http://webappname.com/getImage?p=imagename.jpg
But the resulting image in the browser tab shows
getImage (100x200)
I would like to output there more useful information like string, so how can I do it?
As the response is an image, it cannot contain additional information (such as the page title) as an HTML response could. One possible workaround to this would be to return a simple HMTL page with your image in it.
You could trigger then trigger the regular download (the existing behaviour) with an additional URL parameter. So for example:
http://webappname.com/getImage?p=imagename.jpg
Would return this HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" src="img-dl-style.css">
<script type="application/javascript">
// JavaScript to trigger image download when #dlButton is clicked
</script>
<title>Full Image Name</title>
</head>
<body>
<div class="container">
<h1>Full Image Name</h1>
<img src="http://webappname.com/getImage?p=imagename.jpg&dl=1>
<button id="dlButton" type="button">Download this image</button>
</div>
</body>
</html>
Any direct access to this URL:
http://webappname.com/getImage?p=imagename.jpg&dl=1
Would return the image directly, complete with the default browser title.
To see this in action, take a look at Dropbox's shared file viewer. A link such as:
https://www.dropbox.com/s/qmocfrco2t0d28o/Fluffbeast.docx
Returns a full webpage with a preview of the shared file and a download button. Clicking the button triggers the download with this URL:
https://www.dropbox.com/s/qmocfrco2t0d28o/Fluffbeast.docx?dl=1

title not populating from content page

I am using thymeleaf with spring-mvc to create template in my application. I have created 3 files (head, layout and content) as below;
head.html
<title>layout<title>
layout.html
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout">
<head th:include="head"></head>
</html>
content.html
<html layout:decorator="layout" xmlns="http://www.w3.org/1999/xhtml"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout">
<head>
<title>content</title>
</head>
</html>
Now with this setup, when I run my application and open content.html page I see title as "layout" instead of "content".
Am I doing something wrong in the configuration?
Specific answer
In the layout files title, make the title as content
<title layout:title-pattern="$CONTENT_TITLE"></title>
Further description
Lets assume the application main title is "My Web" and you are viewing the page content with the title "Content"
To make the page display the title as "My Web - Content"
Layout File
<title layout:title-pattern="$DECORATOR_TITLE - $CONTENT_TITLE">My Web</title>
ContentFile
<html layout:decorator="layout" xmlns="http://www.w3.org/1999/xhtml"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout">
<head>
<title>Content</title>
</head>
</html>

how to get Uploaded multiple files using multiple attribute in spring mvc

provide some sample code to upload multiple files in spring framework.
when i search solution for this everyone wrote jsp page like this :
<input type='file' name='files[]' multiple />
but this was not the scenario what i am really want
Here my jsp page code : multiFileSelect.jsp
<%# page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<form action="upload" enctype="multipart/form-data" method="post">
<input name="files" type="file" multiple/>
<button type="submit"/>
</form>
</body>
</html>
Please help me...
I think Chann has given the solution to your question.
<input type="file" name="img" multiple>
for more general one
<input type="file" multiple/>
Since you have asked an example usage of that, please refer this SO question (I don't know why you missed this) and the sample code example by SO user Costa.

Form HTML Validation error in asp.net webform 4.0

I am getting following validation error
Bad value for attribute action on element form: Must be non-empty.
<form method="post" action="" id="form1">
Below is my HTML Schema. I am using visual studio 2010, I previous i didnt has this kind of error as was using html 4 with strict html type....
This time i am using HTML5 type template but it keeps getting me this error even i tried adding action="" it still generates this error. I looked for solution but so far i am not able to find any fix am i doing anything wrong...
<%# Master Language="C#" AutoEventWireup="true" CodeFile="SiteMasterPage.master.cs" Inherits="SiteMasterPage" %>
<!DOCTYPE html >
<html lang="en-US">
<head id="Head1" runat="server">
<title></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="icon" href="favicon.ico" type="image/x-icon" />
</head>
<body>
<form id="form1" runat="server">
....
....
....
</body>
</html>
Update: I am getting HTML validation error on http://validator.w3.org
This is not a real error.
Please understand that master page is not run by himself, but with a page that use it.
Until you set him a page did not know what to place on action. On action is set the filename of the page that will be the post back. Master page not run by himself anyway, so did not know what to place there. So when you attach him a page to the master page, the action will be set.
Also you run the validation on the non rendering code ! that have no sense. Run the validation on the final page creation. The code that is used on code behind is not pass any html validation, because is simple did not have been fixed yet as final html page.

IFrame in content script. How to communicate with main.js?

My Firefox add-on opens Fancybox (type: "iframe") from a content script (page-mod). In the Fancybox I show my own HTML page (my_fancybox_stuff.html) that is located in my own server.
Now, from the my_fancybox_stuff.js (javascript of my_fancybox_stuff.html), can I send a message to the add-on's main.js? Or to the content script that opened the Fancybox?
I was hoping the global 'self' object to be accessible from my_fancybox_stuff.js as it is accessible from the content script that opened the Fancybox.
I am interested to hear about any potential workarounds to get this done.
In Chrome extension this is trivial. In my_fancybox_stuff.js I can call chrome.extension.sendMessage() and it works.
Thanks in advance!
EDIT: Adding some code to clarify my case. Simplified the code to save folks' time on reading it. This is simple as hello world.
From the contents_scipt.js (injected with page-mod) I call:
$.fancybox.open(
{
// Some irrelevant Fancybox options hidden for clarity
href:"http://www.mysite.com/my_fancybox_stuff.html
type: 'iframe'
}
);
my_fancybox_stuff.html would look something like this:
<!doctype html>
<head>
<meta charset="utf-8">
<title></title>
<script src="js/jquery.js"></script>
<script src="js/my_fancybox_stuff.js"></script>
</head>
<body>
<div id="my-wrapper">
<div id="my-form-div">
<form id="my-form" action="#">
<div>
<div><p>Name</p></div>
<div><input id="fullname" type="text" name="fullname" value=""></div>
</div>
<div>
<div><p><a id="my-button" href="#">Press this</a></p></div>
</div>
</form>
</div>
</div>
</body>
In my_fancybox_stuff.js, when button ("my_button") is pressed, I want to send out a message containing the value of the input field ("fullname") and listen it in content_script.js.
Yes, your my_fancybox_stuff.js can communicate with your add-on's content script using postMessage ().
See the documentation and examples at MDN.

Resources