We are posting data to a URL (https://website/rest/v2/executions) using an orchestration tool, which should return a number from the website. Data used to post is in json format. Occassionally we receive a html response instead of number. Header used in data is application/json. Validated json data, and it is fine. Below is the error, can someone help in identifying the cause?
HTML Response:
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Operations Orchestration</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="/oo/features/theme/css/oo-theme.css" rel="stylesheet">
<script type="text/javascript">
//this is a workaround to a defect in the glorious ie,
// apparently it throws an exception if we try to write to the console and the console is not open...
if (!window.console) {
window.console = {
log : function (obj) { /*do nothing here since the console is closed*/
}
};
};
</script>
</head>
<body>
<div class="modal login-container container-fluid">
<div class="row-fluid">
<div class="span5">
<img src = "/oo/features/theme/images/mfLogo-flat-200x26.png" style="margin-left:20px;"/>
</div>
<div class="container span8">
<div>
<div id="header" class="header-login" style="margin-left: 20px">Operations Orchestration</div>
<div class="modal-body form-container">
<div id="logout_label">A general error has occurred. Contact your administrator for more details.</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
Related
I have written an HTML file, in the same when I try to pass data to a .gs file in order to print or console.log then it doesn't give the log in the output of the console and instead, it reflects these statements in the console:
Net state changed from IDLE to BUSY
Net state changed from BUSY to IDLE
Attaching the code UI, HTML file, and .gs file below for reference.
HTML output:
HTML file:
<!DOCTYPE html>
<html>
<head>
<!--Import Google Icon Font-->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!-- Compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<!--Let browser know website is optimized for mobile-->
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<body>
<div class="container">
<div class="row">
<div class="input-field col s6">
<i class="material-icons prefix">insert_link</i>
<input id="zz" type="text" class="validate">
<label for="zz">Insert Text</label>
</div>
<div class="input-field col s12">
<button class="btn waves-effect waves-light" id="btn">Submit
<i class="material-icons right">send</i>
</button>
</div>
</div>
</div>
<!-- Compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<script src="testBox.gs"></script>
<script>
var gSheetUrl = document.getElementById("zz");
document.getElementById("btn").addEventListener("click",abc);
function abc(){
console.log("inside abc");
var data = {
zzz: zz.value
}
google.script.run.getData(data);
}
</script>
</body>
</html>
.gs file:
function openIndexDialog() {
var template = HtmlService.createTemplateFromFile("indexDialog");
var html = template.evaluate().setHeight(450).setWidth(600);
SlidesApp.getUi().showModalDialog(html,"Demo App");
}
function getData(data){
console.log(data)
console.log("data logged")
}
Console output:
Main Problem: Not able to print data when passed through getData(data)
Those are not error messages, they are information logs about the server- client communication .
Every time that your client code call a server-side function using google.script.run there will be a Net state changed from IDLE to BUSY log and when the server-side function ends will be a Net state changed from BUSY to IDLE.
Regarding
Main Problem: Not able to print data when passed through getData(data)
If you want to print data on the client side, you have use console.log on the client-side, not on the server-side. Logs printed from the server side can be found in the executions page.
Related
Unwanted Output In Console
I am a newbie of spring boot. The below image shows the folder location of my bootstrap css file and jquery js file on spring boot thymeleaf template.
And these are my home html scripts
<html xmlns:th="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head>
<div th:fragment="header-css">
<title>Spring Boot Blog</title>
<script th:src="#{/js/jquery-2.1.4.min.js}"></script>
<link rel="stylesheet" type="text/css" href="/css/bootstrap.min.css" th:href="#{/css/bootstrap.min.css}" />
<link rel="stylesheet" type="text/css" href="/css/main.css" th:href="#{/css/main.css}" />
</div>
</head>
<body>
<div th:fragment="header">
.....
But css and js scripts are not linked at all.
Any idea, please!
== UPDATED ==
I am evaluating the spring blog example. I think my problem is related to login controller. First this is the login controller codes.
#Controller
public class LoginController {
#GetMapping("/login")
public String login(Principal principal) {
String username = (principal != null ? principal.getName() : "ANONYMOUS");
if(principal != null) {
return "redirect:/home";
}
// ALWAYS PRINTING "ANONYMOUS is WRONG!!!!"
System.out.println(username + " is WRONG!!!!");
return "/login";
}
}
And even more
return "/login"
line brings wrong files. In below login.html file,
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
<div th:replace="/fragments/header :: header-css"/>
</head>
<body>
<div th:replace="/fragments/header :: header"/>
<div class="container">
<div class="row" style="margin-top:20px">
<div class="col-xs-12 col-sm-8 col-md-6 col-sm-offset-2 col-md-offset-3">
<form th:action="#{/login}" method="post">
<fieldset>
the controller call the following css file and display its contents.
<link rel="stylesheet" type="text/css" href="/css/main.css" th:href="#{/css/main.css}" />
When I paste this URL (below) into my web browser... Chrome
https://login.oracle.com/mysso/signon.jsp (Oracle login)
I get an error saying ...
Error! Do not use bookmarked URL.
Please type the URL you are trying to reach directly into your browser.
But when I put http://hudsonci.oraclecorp.com/jenkins/rgbu_jenkins/ I am redirected to Oracle Login .
But when I am trying to do the same using requests module in python it gives following :
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Single Sign-On</title>
<link rel='stylesheet' href='/oam/pages/css/login_page.css'/>
<link rel="stylesheet" type="text/css" href="/oam/pages/css/general.css" >
<!-- Start Disable frame hijacking Script-->
<style id="antiClickjack">body { display: none !important; }</style>
<script type="text/javascript">
if (self === top) {
var antiClickjack = document.getElementById("antiClickjack");
antiClickjack.parentNode.removeChild(antiClickjack);
} else {
top.location = self.location;
}
</script>
<!-- End Disable frame hijacking Script-->
<style>
body
{
background:url('/oam/pages/images/loginpage_bg.png');
background-repeat:repeat-x;
background-color:#185E87;
}
</style>
</head>
<body>
<div Style="position:absolute; visibility:show; left:0px; top:0px;z- index:1">
<img src="/oam/pages/images/login_logo.png" />
</div>
<div Style="position:relative; visibility:show; left:0px; top:0px;z-index:1">
<div id="top">
<div id="login-header">
</div>
<div id="content">
<div id="login">
<div id="title">Error</div>
<div class="message-row">
<p class="loginFailed">System error. Please re-try your action. If you continue to get this error, please contact the Administrator.</p>
</div>
</div>
</div>
</div>
</div>
<div class="login-footer-version">
<div class="info">
<p id="copyright">Copyright © 1996,2015, Oracle and/or its affiliates. All rights reserved.</p>
<p id="trademark">Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.</p>
</div>
</div>
Following is my python code:
import sys
import requests
def mprint(x):
sys.stdout.write(x)
return
URL = 'https://hudsonci.oraclecorp.com/jenkins/rgbu_jenkins'
mprint('[-] Initialization...')
s = requests.session()
print 'done'
mprint('[-] Trying loginSuccess.jsp...')
r = requests.get(URL)
if r.status_code != requests.codes.ok:
print 'error'
exit(1)
print 'done'
I want to know why is this not happening with requests, and what are the other methods I can use.
Thanks in advance!!
I have included a php file using javascript function getApi() it working properly in my intel-xdk emulator but when i load it in to my android device it will not working properly
so pleas tell me what's wrong with my code , and my device is also connected with internet so it may able to retrive data from the server ,but it can't
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="app_framework/css/af.ui.min.css">
<link rel="stylesheet" type="text/css" href="app_framework/css/icons.min.css">
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="css/index_main.less.css" class="main-less">
<title>Your New Application</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
<style type="text/css">
/* Prevent copy paste for all elements except text fields */
* { -webkit-user-select:none; -webkit-tap-highlight-color:rgba(255, 255, 255, 0); }
input, textarea { -webkit-user-select:text; }
</style>
<script src="intelxdk.js">
</script>
<script type="text/javascript">
/* This code is used to run as soon as Intel activates */
var onDeviceReady=function(){
//hide splash screen
intel.xdk.device.hideSplashScreen();
};
document.addEventListener("intel.xdk.device.ready",onDeviceReady,false);
function getApi() {
alert("Yes");
$.ajax({
type: "GET",
url: "http://exam.coreducation.in/api.php",
success: function(data){
var total = "";
var record = JSON.parse( data );
for(i=0; i<record.length; i++){
total += ("Contact: "+record[i]['contact']+", Name: "+record[i]['name']+", City: "+record[i]['city'] + "<br/>");
}
$('#ddata').html("<h4 style='text-align:center'>"+total+"</h4>")
}
});
}
</script>
<script type="application/javascript" src="app_framework/appframework.min.js"></script>
<script type="application/javascript" src="app_framework/appframework.ui.min.js"></script>
</head>
<body id="afui">
<!-- content goes here-->
<div class="uwrap" id="content">
<div class="upage panel" id="page0" data-header="none" data-footer="none">
<div class="upage-outer">
<div class="upage-content">
<div class="grid grid-pad urow uib_row_1 row-height-1" data-uib="layout/row">
<div class="col uib_col_1 col-0_12-12" data-uib="layout/col">
<div class="widget-container content-area vertical-col">
<a class="button widget uib_w_1 d-margins icon graph" data-uib="app_framework/button" onclick="return getApi();">GetApiData</a><span class="uib_shim">
</span>
<div id="ddata">DAta Will Show Here</div>
</div>
</div>
<span class="uib_shim"></span>
</div>
</div>
<!-- /upage-content -->
</div>
<!-- /upage-outer -->
</div>
</div>
<!-- /uwrap -->
</body>
</html>`enter code here`
The api is blocked due to Cross domain access, same reason why your code will not work in any browser. But there is a way to make it work in Intel XDK apps, just add <script src="xhr.js"></script> after your intelxdk.js script inclusion. It will then work on device.
More info about AJAX and XDK here: http://software.intel.com/en-us/html5/articles/how-to-access-JSON-data-in-HTML5-apps
I resolved similar problem using domain whitelistening.
In Intel XDK it can be done by following next steps:
Open Projects Tab
Expand Build Settings
Enter "*" (without quotes) to Domain List field.
Keep getting this error:
Uncaught TypeError: Cannot call method 'appendChild' of null main.js:24
makingMySelect main.js:24
(anonymous function)
here's the code:
window.addEventListener("DOMContentLoaded", function(){
function $(x){
var myElements = document.getElementById(x);
return myElements;
}
// create select field element and populate with options
function makingMySelect (){
var formTag = document.getElementsByTagName("form");// array
var selectLi = $("select");
var makeSelect = document.createElement("select");
makeSelect.setAttribute("id","peopleGoing");
for(i=0,j=reservePeopleGoing.length;i<j;i++){
var makeOption = document.createElement("option");
var optText = reservePeopleGoing[i];
makeOption.setAttribute("value", optText);
makeOption.innerHTML = optText;
makeSelect.appendChild(makeOption);
}
selectLi.appendChild(makeSelect);
}
var reservePeopleGoing = ["1","2","3","4","5"];
var placeToGo = ["Astrada's","AppleBees","Chili's","Outback","O'Charleys"]
makingMySelect ();
Use a check before you do this part:
if (selectLi)
selectLi.appendChild(makeSelect);
So, this checks whether selectLi is already good. Then adds the stuff. Also, are you sure have an element with ID as select? Don't get confused between tagname. :)
Working HTML Code
The issue was you didn't have an element with an id of select. So, I just added this code:
<div id="select"></div>
After the registration link and it works. Enjoy. Full code for your reference.
<!doctype html>
<html manifest="/cache.manifest">
<head>
<meta charset="utf-8" />
<meta keywords="Reserve,resteraunt,hotel" />
<meta description="This app will let you reserve a spot at your favorite location" />
<meta name="robots" content="index,follow" />
<meta name="viewport" content="user-scalable=no, width=device-width" />
<meta name="HandheldFriendly" content="True" />
<meta name="MobileOptimized" content="320" />
<meta name="viewport" content="target-densitydpi-dpi" />
<link href="css/style.css" rel="stylesheet"/>
<title>Make My Reservation</title>
</head>
<body>
<header>
<div class="container">
<h1>My Reservation App</h1>
<p>This app will let you make a reservation! </p>
</div>
</header>
<h3>Ready?</h3>
<p>Add A Reservation</p>
<div id="select"></div>
</body>
<footer>
<img src="img/Reservation_app_img.jpg"width= "100" height="100" title="Reservation Logo" />
<p1>6-3-2013, Brian Stacks</p1>
</footer>
<script type="text/javascript" src="js/main.js"></script>
</html>