Lloyd:
Lloyd L Chambers wrote:
> Kedar,
>
> Looks good.
>
> Is it redundant to say the protocol?
>
It might be a good idea. I will try that. But most
of the confusion comes from port not being shown.
Also, if this code implements the redirection, with
GlassFish http/https redirection on client side, it might not be
required to state the protocol.
> Maybe put quotes around the host name? [ handy:
> com.sun.appserv.management.util.misc.StringUtil.quote(s) ]
>
This code probably can't depend on the rest of application server code
as indicated by a comment out there.
> How *does* the user check that the server is up an running? (give a
> suggestion?)
>
Connect to the admin GUI application in the browser, probably?
But it is best to be agnostic to that, I thought.
Thanks,
Kedar
> Lloyd
>
> On Dec 22, 2006, at 2:07 PM, Kedar Mhaswade wrote:
>
>> When asadmin fails to connect to admin server, it
>> does not clearly indicate in the message what server
>> and port it tried to connect. This confuses the users.
>>
>> Attached code changes attempt to display a little
>> better message.
>>
>> Can someone review? Timeout: 4.00 PM PDT - Friday, 22 Dec. 2006.
>>
>> Thanks,
>> Kedar
>>
>> (Please judge with respect to current state of the code).
>> Index: ServletConnection.java
>> ===================================================================
>> RCS file:
>> /cvs/glassfish/jmx-remote/rjmx-impl/src/java/com/sun/enterprise/admin/jmx/remote/comm/ServletConnection.java,v
>>
>> retrieving revision 1.4
>> diff -u -r1.4 ServletConnection.java
>> --- ServletConnection.java 25 Dec 2005 04:26:31 -0000 1.4
>> +++ ServletConnection.java 22 Dec 2006 22:00:48 -0000
>> @@ -63,13 +63,13 @@
>>
>> class ServletConnection implements IConnection, Runnable {
>> static final String UNKNOWN_HOST = "Unknown
>> host : ";
>> - static final String INVALID_HOST_PORT = "Unable to
>> connect to admin-server. Please check if the server is up and
>> running and that the host and port provided are correct.";
>> static final String UNAUTHORIZED_ACCESS =
>> "Invalid user or password";
>>
>> private URLConnection mConnection = null;
>> private ObjectOutputStream mObjectOutStream = null;
>> private ObjectInputStream mObjectInStream = null;
>> + private HttpConnectorAddress hca;
>>
>> /* BEGIN -- S1WS_MOD */
>> private static final Logger logger = Logger.getLogger(
>> @@ -90,6 +90,7 @@
>> uri =
>> DefaultConfiguration.DEFAULT_SERVLET_CONTEXT_ROOT;
>> mConnection = a.openConnection(uri);
>> /* END -- S1WS_MOD */
>> + this.hca = a;
>> }
>> catch (IOException ioe){
>> handleException(ioe);
>> @@ -212,7 +213,7 @@
>> e.getMessage());
>> }
>> else if (e instanceof java.net.ConnectException) {
>> - exception = new
>> java.net.ConnectException(INVALID_HOST_PORT);
>> + exception = new
>> java.net.ConnectException(createConnectExceptionMessage());
>> }
>> else {
>> int responseCode =
>> @@ -226,4 +227,15 @@
>> }
>> throw exception;
>> }
>> +
>> + private String createConnectExceptionMessage() {
>> + /* this is not internationalized yet -- this is because
>> there is a
>> + separate delivery of this code that cannot depend on
>> other parts
>> + of application server
>> + */
>> + final String h = hca.getHost();
>> + final int p = hca.getPort();
>> + final String msg = "Unable to connect to admin-server at
>> given host: " + h + " and port: " + p + ".\nPlease check if this
>> server is up and running and that the host and port provided are
>> correct.";
>> + return ( msg );
>> + }
>> }
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: admin-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: admin-help_at_glassfish.dev.java.net
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: admin-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: admin-help_at_glassfish.dev.java.net
>