@Override public String createApplicationClientUrl(boolean isSecure, String path, ServerHttpConnection connection) { // Create the application path path = this.createApplicationClientPath(path); // Determine if appropriately secure if (connection.isSecure() == isSecure) { // Relative path return path; } else { // Full path back to server return connection.getServerLocation().createClientUrl(isSecure, path); } }
@Override public void write(ServerWriter writer, boolean isDefaultCharset, Object bean, ServerHttpConnection connection, String templatePath) throws HttpException { // Obtain the link path (determining if require secure link) if (this.isLinkSecure && (!connection.isSecure())) { templatePath = connection.getServerLocation().createClientUrl(this.isLinkSecure, templatePath); } try { // Write the content writer.write(templatePath); writer.write(this.linkPathSuffix); } catch (IOException ex) { throw new HttpException(ex); } }
@Override public void handle(HttpArgument pathArguments, ServerHttpConnection connection, ManagedFunctionContext<?, Indexed> context) { // Determine if secure connection is required if (this.isRequireSecure && (!connection.isSecure())) { // Non-secure, requiring secure - so redirect String path = connection.getRequest().getUri(); String securePath = connection.getServerLocation().createClientUrl(this.isRequireSecure, path); // Send redirect response to secure path HttpResponse response = connection.getResponse(); response.setStatus(HttpStatus.TEMPORARY_REDIRECT); response.getHeaders().addHeader(LOCATION, securePath); return; } // Undertake flow to service route context.doFlow(this.flowIndex, pathArguments, null); }
boolean isConnectionSecure = connection.isSecure(); if (!isConnectionSecure) {
if (this.isSecure && (!connection.isSecure())) {