get

http get request with body

馋奶兔 提交于 2019-11-28 10:58:51
问题 i know you shouldn't send a HTTP GET Request with a body, but ceilometer web api forces me to do so. I'm developing a ceilometer scala client, so I need a scala/java way to make a get request with a body. So far I tried with beeClient (http://www.bigbeeconsultants.co.uk) and in plain Java using httpConnection but I get a 404 error. In curl I can achieve the result in this way: curl -X GET -H "X-Auth-Token: ..long long token here.." -H "Content-Type: application/json" -d '{"q": [{"field":

passing variable between pages

别等时光非礼了梦想. 提交于 2019-11-28 10:22:05
问题 Is it good way to pass variable between pages using $_GET method with url: <a href="input_obj.php?id='$id'&method=plain and take it in file input_obj.php with such code: $id = $_GET['id']; $method = $_GET['method']; OR using session - has someone idea how? 回答1: It depends on your needs, really, If you are passing search arguments between pages, for example, and the variables should be both persistent and be available to the end user (via bookmarking, for example), then pass them in the URL

I can't use GET and POST at the same time in PHP

妖精的绣舞 提交于 2019-11-28 10:22:01
问题 Near the top of my page, I have this: <?php $id = $_GET['id']; ?> Then I have some form check conditionals that read from POST: if (isset($_POST['completeSubmit'])) { //code } And finally, I have an HTML form which looks like this: <form action="<?php echo $_SERVER['PHP_SELF']."?id=$id"; ?>" name="complete" method="post"> <input type="submit" id="textButton" name="completeSubmit" value="[mark as complete]"> </form> The page is initially accessed by using GET with an id variable like this:

JSF: Redirect to url as POST not as GET

冷暖自知 提交于 2019-11-28 10:10:51
I have an JSF page that redirects via context.getExternalContext().redirect(url); where the url is sth. like login.jsf?token=foobar What I want now is to send the token via POST not via GET request. So that it doesn´t show up in the url, is this possible with JSF? It's not possible with HTTP, so also not with JSF. There are however several ways to achieve the requirement. Put it in the session scope. In the bean behind the redirected page, read and remove it from the session scope. Or when you're using JSF 2.0, use the flash scope. Forward to a page containing a POST form pointing to the

How to grab URL parameters using PHP?

亡梦爱人 提交于 2019-11-28 10:00:57
问题 I'm trying to grab each URL parameter and display them from first to last, but I want to be able to display any of the parameters anywhere on the page. How can I do this? What do I have to add or modify on my script? Here is an example of a URL value. http://www.localhost.com/topics/index.php?cat=3&sub1=sub-1&sub2=sub-2&sub3=sub-3&sub4=sub-4 Here is my PHP script. $url = $_SERVER['QUERY_STRING']; $query = array(); if(!empty($url)){ foreach(explode('&', $url) as $part){ list($key, $value) =

return responseText from jQuery.get()

╄→尐↘猪︶ㄣ 提交于 2019-11-28 09:59:02
I tried to do something like this : var msg = $.get("my_script.php"); I thought msg would be set to the text returned by my_script.php,i.e. the responseText of the jqXHR object. It apparently doesn't work like that as msg is always set to "[object XMLHttpRequest]" Is there a quick 1 line way to do what I want? Thanks. After some testing, I ended up finding a solution. I need the call to be synchronous, $.get shorthand function is always asynchonous, so I will need to use $.ajax, like this: var msg = $.ajax({type: "GET", url: "my_script.php", async: false}).responseText; I don't think there is

Form Submit URL Formatting

江枫思渺然 提交于 2019-11-28 09:37:39
问题 I have a form which when submitted goes to the url "signup.php?username=xx" where xx is an input field. Instead of this I was wondering if I could get it to go to the following url "signup/xx" where xx is taken from the input field. 回答1: You need to use Javascript and some type of .htaccess for that. But why don't you use POST instead of GET ? I don't want singup?username=sawny&password=1234 in my history. EDIT: I had done something like this: $(document).ready(function() { $("submit[name=

Hibernate中Session.load与Session.get的区别

末鹿安然 提交于 2019-11-28 09:18:48
Session.load/get方法均可以根据指定的实体类和id从数据库读取记录,并返回与之对应的实体对象。 其区别在于: 如果未能发现符合条件的记录,get方法返回null,而load方法会抛出一个ObjectNotFoundException。 Load方法可返回实体的代理类实例,而get方法永远直接返回实体类。 load方法可以充分利用内部缓存和二级缓存中的现有数据,而get方法则仅仅在内部缓存中进行数据查找,如没有发现对应数据,将越过二级缓存,直接调用SQL完成数据读取。 Session在加载实体对象时,将经过的过程: 首先,Hibernate中维持了两级缓存。第一级缓存由Session实例维护,其中保持了Session当前所有关联实体的数据,也称为内部缓存。而第二级缓存则存在于SessionFactory层次,由当前所有由本SessionFactory构造的Session实例共享。出于性能考虑,避免无谓的数据库访问,Session在调用数据库查询功能之前,会先在缓存中进行查询。首先在第一级缓存中,通过实体类型和id进行查找,如果第一级缓存查找命中,且数据状态合法,则直接返回。 之后,Session会在当前“NonExists”记录中进行查找,如果“NonExists”记录中存在同样的查询条件,则返回null。“NonExists

Open a PDF in a new window of the browser with angularjs

你说的曾经没有我的故事 提交于 2019-11-28 09:14:19
I'm new to angular js and I wish to open a PDF document in a new window of the browser after pressing a button. I make a GET request with $http.get() at front end, at backend there is a Java rest service that respond to the GET and generates a PDF. I wish to open this PDF on the browser. If is not possible to open the PDF in this way then at least open any PDF with AngularJs, how could I do this? @GET @Path("/printPdf") public Response printService(){ //generates the pdf File reportFile = new File(filePath); String name = reportName + "." + "pdf"; ResponseBuilder response = Response.ok(new

How to handle a get request with node.js (express)

我的未来我决定 提交于 2019-11-28 09:14:01
问题 I'm a node.js newbie and I'm creating my first big app with it (I'm using express). I need to have my webpage perform some javascript canvas-drawing when the user loads an id with a get request, e.g. www.mywebsite.com/page?id=22 I know I can handle this with a simple var express = require("express"); var app = express(); app.get('handle',function(request,response){ //request.id }); but I don't know how to start my webpage with the asked drawing for that id. Every tutorial on the internet on