根据交银施罗德真实环境已测试通过,此过程可以作为非J2EE部署的典型案例,主要是针对某些对安全性要求较高的解决方案:

基本的实现原理和部分代码如下:

1.客户端访问交银.net系统,由该系统发送请求,访问方式为:http://润乾报表服务器ip:9090/appsOnlineUms/index.jsp?token=b96335b0db0347bf9b98c4fb2a3fdb38


2.由index.jsp接收到传过来的token值(系统唯一值),

3.根据传过来的token值调用.net系统的定义的WebServices的http://portal.jysld.com/jyportalinterface/

reportrights.asmx方法,此方法里相关有用的信息

index.jsp部分代码:

<%

String token = request.getParameter(“token”);

System.out.println(“传过来的token:” + token);

ReportRightsClient client = new ReportRightsClient();

ReportRightsSoap service = client.getReportRightsSoap();

ReportRightResult reportResult=service.getRight(token);

String displayName= reportResult.getDisplayName();

String Account=reportResult.getAccount();

String raq= reportResult.getReportName();

boolean flag=reportResult.isRight();

session.setAttribute(“flag”, flag);

System.out.println(“别名:”+displayName);

System.out.println(“ACount:”+Account);

System.out.println(“报表名:”+raq);

System.out.println(“是否有权限:”+flag);

%>

4.对WebServices方法的处理两个基本java类:ReportRightsClient.java代码如下:

package com;

import java.net.MalformedURLException;

import java.util.Collection;

import java.util.HashMap;

import javax.xml.namespace.QName;

import org.codehaus.xfire.XFireRuntimeException;

import org.codehaus.xfire.aegis.AegisBindingProvider;

import org.codehaus.xfire.annotations.AnnotationServiceFactory;

import org.codehaus.xfire.annotations.jsr181.Jsr181WebAnnotations;

import org.codehaus.xfire.client.XFireProxyFactory;

import org.codehaus.xfire.jaxb2.JaxbTypeRegistry;

import org.codehaus.xfire.service.Endpoint;

import org.codehaus.xfire.service.Service;

import org.codehaus.xfire.soap.AbstractSoapBinding;

import org.codehaus.xfire.transport.TransportManager;

import org.tempuri.ReportRightResult;

public class ReportRightsClient {

private static XFireProxyFactory proxyFactory = new XFireProxyFactory();

private HashMap endpoints = new HashMap();

private Service service0;

public ReportRightsClient() {

create0();

Endpoint ReportRightsSoapLocalEndpointEP = service0 .addEndpoint(new QName(“http://tempuri.org/”, “ReportRightsSoapLocalEndpoint”), new QName(“http://tempuri.org/”, “ReportRightsSoapLocalBinding”), “xfire.local://ReportRights”);


endpoints.put(new QName(“http://tempuri.org/”, “ReportRightsSoapLocalEndpoint”), ReportRightsSoapLocalEndpointEP);


Endpoint ReportRightsSoapEP = service0 .addEndpoint(new QName(“http://tempuri.org/”, “ReportRightsSoap”), new QName(“http://tempuri.org/”, “ReportRightsSoap”), “http://portal.jysld.com/jyportalinterface/reportrights.asmx”);


endpoints.put(new QName(“http://tempuri.org/”, “ReportRightsSoap”), ReportRightsSoapEP);


public Object getEndpoint(Endpoint endpoint) {

try {

return proxyFactory.create((endpoint).getBinding(), (endpoint).getUrl());

} catch (MalformedURLException e) {

throw new XFireRuntimeException(“Invalid URL”, e);

public Object getEndpoint(QName name) {

Endpoint endpoint = ((Endpoint) endpoints.get((name)));

if ((endpoint) == null) {

throw new IllegalStateException(“No such endpoint!”);

return getEndpoint((endpoint));

public Collection getEndpoints() {

return endpoints.values();

private void create0() {

TransportManager tm = (org.codehaus.xfire.XFireFactory.newInstance().getXFire().getTransportManager());


HashMap props = new HashMap();

props.put(“annotations.allow.interface”, true);

AnnotationServiceFactory asf = new AnnotationServiceFactory(new Jsr181WebAnnotations(), tm, new AegisBindingProvider(new JaxbTypeRegistry()));


asf.setBindingCreationEnabled(false);

service0 = asf.create((com.ReportRightsSoap.class), props);

AbstractSoapBinding soapBinding = asf.createSoap11Binding(service0, new QName(“http://tempuri.org/”, “ReportRightsSoapLocalBinding”), “urn:xfire:transport:local”);


AbstractSoapBinding soapBinding = asf.createSoap11Binding(service0, new QName(“http://tempuri.org/”, “ReportRightsSoap”), “http://schemas.xmlsoap.org/soap/http”);


public ReportRightsSoap getReportRightsSoapLocalEndpoint() {

return ((ReportRightsSoap)(this).getEndpoint(new QName(“http://tempuri.org/”, “ReportRightsSoapLocalEndpoint”)));


public ReportRightsSoap getReportRightsSoapLocalEndpoint(String url) {

ReportRightsSoap var = getReportRightsSoapLocalEndpoint();

org.codehaus.xfire.client.Client.getInstance(var).setUrl(url);

return var;

public ReportRightsSoap getReportRightsSoap() {

return ((ReportRightsSoap)(this).getEndpoint(new QName(“http://tempuri.org/”, “ReportRightsSoap”)));


public ReportRightsSoap getReportRightsSoap(String url) {

ReportRightsSoap var = getReportRightsSoap();

org.codehaus.xfire.client.Client.getInstance(var).setUrl(url);

return var;

public static void main(String[] args) {

ReportRightsClient client = new ReportRightsClient();

//create a default service endpoint

ReportRightsSoap service = client.getReportRightsSoap();

//TODO: Add custom client code here

//

//service.yourServiceOperationHere();

ReportRightResult reportResult=service.getRight(“b96335b0db0347bf9b98c4fb2a3fdb38″);


String displayName= reportResult.getDisplayName();

String Account=reportResult.getAccount();

String reportName= reportResult.getReportName();

boolean flag=reportResult.isRight();

System.out.println(“别名:”+displayName);

System.out.println(“ACount:”+Account);

System.out.println(“报表名:”+reportName);

System.out.println(“是否有权限:”+flag);

//测试:

//http://localhost:9090/appsOnlineUms/index.jsp?token=b96335b0db0347bf9b98c4fb2a3fdb38


//http://localhost:9090/appsOnlineUms/index.jsp?token=b96335b0db0347bf9b98c4fb2a3fdb36


System.exit(0);

ReportRightsSoap.java代码如下:

package com;

import javax.jws.WebMethod;

import javax.jws.WebParam;

import javax.jws.WebResult;

import javax.jws.WebService;

import javax.jws.soap.SOAPBinding;

import org.tempuri.ReportRightResult;

@WebService(name = “ReportRightsSoap”, targetNamespace = “http://tempuri.org/”)

@SOAPBinding(use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)


public interface ReportRightsSoap {

@WebMethod(operationName = “GetRight”, action = “http://tempuri.org/GetRight”)

@WebResult(name = “GetRightResult”, targetNamespace = “http://tempuri.org/”)

public ReportRightResult getRight(

@WebParam(name = “token”, targetNamespace = “http://tempuri.org/”)

String token);

5.根据调用的WebServices对其返回的ReportRightResult结果集得到相关的信息

ReportRightResult reportResult=service.getRight(token);

String displayName= reportResult.getDisplayName();//别名

String Account=reportResult.getAccount();//ACount

String raq= reportResult.getReportName();//报表名

boolean flag=reportResult.isRight();//是否有权限

session.setAttribute(“flag”, flag);

6.由返回的权限判断通过Filter进行页面和数据的过滤

OnlineFilter.java的代码:

package filter;

import java.io.IOException;

import javax.servlet.Filter;

import javax.servlet.FilterChain;

import javax.servlet.FilterConfig;

import javax.servlet.RequestDispatcher;

import javax.servlet.ServletException;

import javax.servlet.ServletRequest;

import javax.servlet.ServletResponse;

import javax.servlet.http.*;

public class OnlineFilter extends HttpServlet implements Filter {

private static final long serialVersionUID = 1L;

// private String loginUrl = “”;

public void init(FilterConfig filterConfig) throws ServletException {

// loginUrl = filterConfig.getInitParameter(“exceptUrl”);

public void doFilter(ServletRequest request, ServletResponse response,

FilterChain chain) throws IOException, ServletException,

NullPointerException {

RequestDispatcher dispatcher = request

.getRequestDispatcher(“myErrorPage.jsp”);

HttpServletRequest req = (HttpServletRequest) request;

HttpServletResponse res = (HttpServletResponse) response;

HttpSession session = req.getSession(true);

// 从session里取的权限判断信息

boolean flag = (Boolean) session.getAttribute(“flag”);

System.out.println(“flag:” + flag);

if (!flag) {

// 跳转到登陆页面

dispatcher.forward(request, response);

res.setHeader(“Cache-Control”, “no-store”);

res.setDateHeader(“Expires”, 0);

res.setHeader(“Pragma”, “no-cache”);

System.out.println(“用户没有登陆,不允许操作”);

return;

} else {

chain.doFilter(request, response);

System.out.println(“用户已经登陆,允许操作”);

public void destroy() {

過濾器在web.xml配置如下:

<filter>

<filter-name>onlineFilter</filter-name>

<filter-class>filter.OnlineFilter</filter-class>

<!–

<init-param>

<param-name>exceptUrl</param-name>

<param-value>index.jsp</param-value>

</init-param>

–>

</filter>

<filter-mapping>

<filter-name>onlineFilter</filter-name>

<url-pattern>/reportJsp/*</url-pattern>

</filter-mapping>

<filter-mapping>

<filter-name>onlineFilter</filter-name>

<url-pattern>/jsp/*</url-pattern>

</filter-mapping>

<filter-mapping>

<filter-name>onlineFilter</filter-name>

<url-pattern>/reportServlet</url-pattern>

</filter-mapping>

7.通过获取的权限最终达到数据的完整交互 index.jsp部分代码:

<%

String realPath = “http://”

+ request.getServerName()

+ “:”

+ request.getServerPort()

+ request.getContextPath()

+ request.getServletPath().substring(0,

request.getServletPath().lastIndexOf(“/”) + 1);

String fullfilePath = realPath + “reportJsp/showReport.jsp?raq=”

+ raq;

System.out.println(“fullfilePath:” + fullfilePath);

response.sendRedirect(fullfilePath);

%>

优点:1.权限安全系数更高,只保证当前用户有权限操作,防止了部分通过新开IE记住URL的方式访问,包括

想通过查看源文件里对servlet的处理等,

2.权限的配置,操作完全交给.net系统处理,对报表的应用只要告诉我有没有权限执行当前的操作,要用的报

表,当前的用户信息即可,通用性好,耦合度低,易于集成

缺点:由于是跨语言,跨服务器集成操作,多多少少网络可能会阻止一些访问效率和响应时间等

难点:对WebServices代码的操作过程…

非J2EE部署解决方案的更多相关文章

  1. Eclipse(非J2EE版本)配置Extjs环境以及安装部署Tomcat

    Eclipse(非J2EE版本)配置Extjs环境(Spket) 1. 安装spket插件,帮助->安装新软件->http://www.agpad.com/update. 2. 设置Spk ...

  2. 部署解决方案包 (SharePoint Server 2010)

    转:http://technet.microsoft.com/zh-cn/library/cc262995(v=office.14).aspx 本文介绍各个解决方案包,及其在 Microsoft Sh ...

  3. 【G】开源的分布式部署解决方案(一) - 开篇

    做这个开源项目的意义是什么?(口水自问自答,不喜可略过) 从功能上来说,请参考 预告篇,因自知当时预告片没有任何含金量,所以并没有主动推送到首页,而是私下的给一些人发的. 从个人角度上来说,我希望.n ...

  4. 【G】开源的分布式部署解决方案 - 预告篇

    为什么想到要做分布式部署解决方案? 当项目越做越大以后,你会发现部署变成一件极其头疼的事情.当然头疼的绝不仅仅在部署一个环节,比如新服务器环境搭建当中就许多坑要踩.各种重复性的工作,包括但不仅限于增加 ...

  5. 【G】开源的分布式部署解决方案(三) - 一期规划定稿与初步剖析

    G.系列导航 [G]开源的分布式部署解决方案 - 预告篇 [G]开源的分布式部署解决方案(一) - 开篇 [G]开源的分布式部署解决方案(二) - 好项目是从烂项目基础上重构出来的 [G]开源的分布式 ...

  6. 【G】开源的分布式部署解决方案文档 - 手动安装

    G.系列导航 [G]开源的分布式部署解决方案 - 导航 序言 因各种原因,决定先写使用文档.也证明下项目没有太监.至于安装过程复杂,是因为还没有做一键安装,这个现阶段确实没精力. 项目进度 (点击图片 ...

  7. 【G】开源的分布式部署解决方案文档 - 使用手册

    G.系列导航 [G]开源的分布式部署解决方案 - 导航 已知问题 导航没有联动 因为权限只是做了基础的登录校验,考虑到后面导航要跟权限关联上暂时是写死的. 只有部分界面使用了Vue.js 因为刚开始没 ...

  8. 【G】开源的分布式部署解决方案文档 - Web Deploy

    G.系列导航 [G]开源的分布式部署解决方案 - 导航 微软官方部署方式 右键项目->发布 这个大家应该再熟悉不过,在部署前有个预览界面可以看本次更新到底更新哪些文件. 既然它可以预览部署结果, ...

  9. 【G】开源的分布式部署解决方案文档 - 部署Console & 控制负载均衡 & 跳转持续集成控制台

    G.系列导航 [G]开源的分布式部署解决方案 - 导航 设置项目部署流程 项目类型:选择Console,这个跟功能无关,只是做项目分类,后面会有后续功能 宿主:选择Console 部署方式:选择原始, ...

随机推荐

  1. WinForm—串口通讯

    ialPort(串行端口资源) 常用属性: BaudRate 此串行端口上要使用的波特率 DataBits 每发送/接收一个字节的数据位数目 DtrEnable 在通讯过程中是否启用数据终端就绪(St ...

  2. JavaScript中的垃圾回收机制与内存泄露

    什么是内存泄露? 任何编程语言,在运行时都需要使用到内存,比如在一个函数中, var arr = [1, 2, 3, 4, 5]; 这么一个数组,就需要内存. 但是,在使用了这些内存之后, 如果后面他 ...

  3. PHP CURL 抓取失败 自己调试

    蛋疼的一下午,物理机win7旗舰版+APACHE2 ,CURL抓取一直成功. 虚拟机ubuntu+apache2一直抓取失败. 晚上,问个仁兄才知道,CURL可以调试: 参考这位兄台: 地址 curl ...

  4. vue-cli 中的 webpack 配置详解

    本篇文章主要介绍了 vue-cli 2.8.2 中的 webpack 配置详解, 做个学习笔记 版本 vue-cli 2.8.1 (终端通过 vue -V 可查看) vue 2.2.2 webpack ...

  5. wp-postviews使用方法

    1.安装 2.头部引用<?php wp_head(); ?> 3.文章调用:<?php if(function_exists('the_views')) { the_views(); ...

  6. Linux中终端和控制台的一些不成熟的理解

    首先声明,这仅仅是在下一些不成熟的想法.是通过看网上的一些资料和自己实践的一些心得,应该都是些很不成熟甚至是不太正确的想法.但是我还是想记录下来,算是一个心路历程吧.等以后成熟了,再来修改. 首先说一 ...

  7. 玩转mongodb(六):索引,速度的引领(普通索引篇)

    数据库索引与书籍的索引类似,有了索引就不需要翻整本书,数据库可以直接在索引中查找,在索引中找到条目后,就可以直接跳到目标文档的位置,这可以让查找的速度提高几个数量级. 一.创建索引 我们在person ...

  8. Nginx+Memcached+Tomcat集群配置

    1.   Nginx Nginx是通过将多个Web Server绑定到同一个IP地址下,以实现多个WebServer间的负载均衡,降低单个Web Server的负荷,以提高整体的性能与稳定性. 安装和 ...

  9. 基于VUE的SPA单页应用开发-加载性能篇

    1.基于异步数据的vue页面刷新 先看看基于异步数据的vue页面刷新后,都发生了啥- 如图所示: 图1 基于异步数据的vue页面刷新 网络请求图 步骤如下: step1:请求页面: step2:请求页 ...

  10. MySQL中You can't specify target table for update in FROM clause异常

    mysql中You can't specify target table <tbl> for update in FROM clause错误的意思是说,不能先select出同一表中的某些值 ...