sentence
stringlengths 1
1.38k
| label
stringclasses 3
values |
---|---|
Run a proxy process on the host itself that connects to the port, and encrypts the input and output from the socket.
|
o
|
3.
|
o
|
Run a proxy client on the debugging workstation that also encrypts/decrypts the input.
|
o
|
Have this connect to the server proxy.
|
o
|
Communication between them would be encrypted.
|
p
|
4.
|
o
|
Connect your debugger to the proxy client.
|
o
|
As a side note: Our production servers are behind a firewall, but they are exposed to some internal network segments.
|
o
|
Printing Java collections nicely (toString doesn't return pretty output).
|
p
|
I wish to print a CODETERM1 object as nicely as the Eclipse debugger does, i.e., CODETERM2 etc, but printing it with CODETERM3 doesn't return this nice result.
|
p
|
Just to clarify, I'm talking about Java's built-in collection so I can't override its CODETERM4 .
|
o
|
How can I get a nice printable version of the stack?
|
o
|
You could convert it to an array and then print that out with CODETERM1 : CODESNIPPET_JAVA1 .
|
o
|
I like it.
|
o
|
Simple, clean.
|
p
|
To be honest Collections needs a toString method too, but this works also.
|
p
|
@Tovi7 It probably doesn't because most OOTB Collections already provide readable toString()s, whereas arrays don't.
|
p
|
Implement toString() on the class.
|
o
|
I recommend the URL_http://commons.apache.org/proper/commons-lang/javadocs /api-release/org/apache/commons/lang3/builder/ToStringBuilder.html [Apache- Commons-ToStringBuilder] to make this easier.
|
p
|
With it, you just have to write this sort of method: CODESNIPPET_JAVA1 .
|
o
|
In order to get this sort of output:
Person@7f54[name=Stephen,age=29] There is also a URL_http://commons.apache.org/proper/commons-lang/javadocs /api-release/org/apache/commons/lang3/builder/ReflectionToStringBuilder.html [reflective-implementation] .
|
o
|
ToStringBuilder is usually more applicable for beans and objects that carry information, less so for complex data structures.
|
n
|
If the stack object doesn't print all stored items, this won't help.
|
o
|
usage of reflection ToStringBuilder, HashCodeBuilder and EqualsBuilder is highly inefective.
|
n
|
Though the output is ok, these classes are hardly the performance peak of the week...
|
n
|
Also, be careful.
|
o
|
ToStringBuilder uses threadlocal!?!
|
o
|
?
|
o
|
The question explicitly says the class is a built-in collection, so toString() can't be modified.
|
o
|
I agree with the above comments about overriding CODETERM1 on your own classes (and about automating that process as much as possible).
|
o
|
For classes you
define, you could write a CODETERM2 class with an overloaded method for each library class you want to have handled to your own tastes: CODESNIPPET_JAVA1 .
|
o
|
EDIT: Responding to the comment by xukxpvfzflbbld, here's a possible implementation for the cases mentioned previously.
|
o
|
CODESNIPPET_JAVA2 .
|
o
|
This isn't a full-blown implementation, but just a starter.
|
o
|
I know that DP.
|
o
|
But how can I easily print them in a readable format?
|
o
|
The MapUtils class offered by the Apache Commons project offers a MapUtils.debugPrint method which will pretty print your map.
|
o
|
Anything similar in Guava?
|
o
|
Not that I know of.
|
o
|
I'm not terribly familiar with the Guava library but I wouldn't be surprised if there was.
|
o
|
System.out.println(Collection c) already print any type of collection in readable format.
|
p
|
Only if collection contains user defined objects , then you need to implement toString() in user defined class to display content.
|
o
|
Just Modified the previous example to print even collection containing user defined objects.
|
o
|
CODESNIPPET_JAVA1 .
|
o
|
line 21: ToStringBuilder cannot be resolved.
|
o
|
If this is your own collection class rather than a built in one, you need to override its toString method.
|
o
|
Eclipse calls that function for any objects for which it does not have a hard-wired formatting.
|
o
|
And how does eclipse format those classes w/ hard-wired formatting?
|
o
|
That's what I'm looking for.
|
o
|
Be careful when calling Sop on Collection, it can throw CODETERM1 Exception.
|
n
|
Because internally CODETERM2 method of each Collection internally calls CODETERM3 over the Collection.
|
o
|
which java http client library is easy to use for programmatically doing posts, setting cookies and maybe ajax?
|
o
|
which java http client library is easy to use for programmatically doing posts, setting cookies and maybe ajax?
|
o
|
Apache HTTP Component (HttpClient 4.0), URL_http://hc.apache.org/httpcomponents-client-4.0.1/index.html [ URL_http://hc.apache.org/httpcomponents-client-4.0.1/index.html ] Normally, I would just use HttpURLConnection but its cookie handling is too weak to simulate browser behavior.
|
o
|
Looks like the URL has changed.
|
o
|
Try URL_http://hc.apache.org/httpcomponents - client-ga/index.html.
|
o
|
You can use URL_http://www.rexsl.com/rexsl- test/apidocs-0.10/com/rexsl/test/request/JdkRequest.html [CODETERM1] from URL_http://www.rexsl.com/rexsl-test [rexsl-test] (I'm a developer), which does all this work for you, decorating CODETERM2 , firing HTTP requests and parsing responses, for example: CODESNIPPET_JAVA1 .
|
o
|
Async request like AJAX: URL_http://hc.apache.org/httpcomponents-asyncclient- dev/ [ URL_http://hc.apache.org/httpcomponents-asyncclient-dev/ ] Sync request: URL_http://hc.apache.org/httpcomponents-client-4.0.1/index.html [ URL_http://hc.apache.org/httpcomponents-client-4.0.1/index.html ] Cookies is A kind of Header.
|
o
|
Add cookies like A Header: CODESNIPPET_JAVA1 .
|
o
|
Best solution for Java HTTP push (messaging).
|
p
|
We want to push data from a server to clients but can only use HTTP (port 80).
|
o
|
What is the best solution for messaging?
|
o
|
One idea is URL_http://en.wikipedia.org/wiki/Comet%5F%28programming%29 [Comet] .
|
o
|
Are there other ideas or frameworks which offer lets say JMS over HTTP.
|
o
|
(Yes, ActiveMQ supports it too, but waggly IMHO.
|
o
|
And JXTA supports it too but the configuration is complicated.
|
o
|
Something simple is preferred.
|
p
|
) .
|
o
|
The simplest solution for many, many reasons is to use a Comet based approach (like you mention).
|
p
|
This means the clients (to whom you want to "push" messages) open long-lived HTTP connections.
|
o
|
Those connections stay open until they time out or you send the client a message.
|
o
|
As soon as either happens the client opens a new connection.
|
o
|
Directly connecting to clients could be problematic for many reasons: they could be behind firewalls that disallow that, they could be behind proxies and so on.
|
n
|
Unless your clients are real servers (in which case you're really the client), have them contact you and send a response to mimic push.
|
o
|
Is that right?
|
o
|
When the message arrives at the browser a new connection is opened?
|
o
|
The client should be programmed to open a new connection.
|
o
|
If it doesn't the server has no way of communicating with the client.
|
o
|
I'm sorry.
|
n
|
Having trouble understanding.
|
o
|
The client has opened an long-lived HTTP connection.
|
o
|
Server sends messages up there - right?
|
o
|
You then say "Those connections stay open until they time out or you send the client a message.
|
o
|
As soon as either happens the client opens a new connection.
|
o
|
" Sounds like we are opening a second connection.
|
o
|
Why?
|
o
|
The message we just received contained the data we want, doesn't it?
|
o
|
The new connection is to listen for the next message.
|
o
|
The idea here is to keep an open connection to the server at all times that is just waiting for the server to do something with it.
|
o
|
This allows the server to (in effect) initiate communications.
|
o
|
Once the server uses the connection to send a message, a new connection needs to be opened up for the next message.
|
o
|
All of this assumes we have a client that the server needs to be able to push data to.
|
o
|
The alternative is to poll for changes at regular intervals, but that may create a delay in the event reaching a client.
|
o
|
(Apologies for labouring the point, but this simply doesn't correspond to my experience).
|
o
|
The connection is long lived, server squirts up data periodically, browser thread sucks that data and displays it.
|
n
|
I don't see why we need to keep opening more connections.
|
o
|
Right now, I've got real-time measurements updating in my browser, and just one connection (I think).
|
o
|
URL_https://github.com/Atmosphere/atmosphere [Atmosphere] and URL_http://directwebremoting.org/dwr/index.html [DWR] are both open source frameworks that can make Comet easy in Java.
|
p
|
I created an example app using Comet, Raphael, Bayeux, Java and Maven running PaaS Cloudbees and wrote a blog post about it, hopefully it will be helpful to someone.
|
p
|
URL_http://geeks.aretotally.in/thinking-in-reverse-not-taking-orders-from-yo [ URL_http://geeks.aretotally.in/thinking-in-reverse-not-taking-orders-from-yo ] .
|
o
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.