Examples of HttpContext


Examples of com.bj58.spat.gaea.server.core.communication.http.HttpContext

  @Test
  public void testGetActionHttpContext() throws Exception {
    init();

    HttpContext hc = new HttpContext();
    hc.setUri("/news/101001");
    hc.setMethod(HttpRequestMethod.GET);

    Action action = RequestMapping.getAction(hc);
    List<Parameter> paraList = action.getParamList();

    Assert.assertEquals("RestService", action.getLookup());
    Assert.assertEquals("getNews", action.getMethodName());
    Assert.assertEquals(1, paraList.size());
    Assert.assertEquals("newsID", paraList.get(0).getMapping());
    Assert.assertEquals(0, paraList.get(0).getMethodParaIndex());
    Assert.assertEquals(0, paraList.get(0).getUrlParaIndex());
    Assert.assertEquals(101001, paraList.get(0).getValue());
    Assert.assertEquals(HttpParameterType.PathParameter, paraList.get(0)
        .getParaType());

    hc.setUri("/newslist/101002/123");
    action = RequestMapping.getAction(hc);

    Assert.assertEquals("RestService", action.getLookup());
    Assert.assertEquals("getNews", action.getMethodName());
    Assert.assertEquals(2, action.getParamList().size());
View Full Code Here

Examples of com.liusoft.dlog4j.HttpContext

      final HttpServletResponse response, String s_photo_id) throws Exception  
  {
    int photo_id = Integer.parseInt(s_photo_id);
    _PhotoBase pbean = PhotoDAO.getPhotoOutlineByID(photo_id);
    if(pbean != null){
      HttpContext http_ctx = getHttpContext(mapping, form, request, response);
      rotate(http_ctx, pbean.getImageURL(), 8);
    }
    return null;
  }
View Full Code Here

Examples of com.liusoft.dlog4j.HttpContext

      final HttpServletResponse response, String s_photo_id) throws Exception  
  {
    int photo_id = Integer.parseInt(s_photo_id);
    _PhotoBase pbean = PhotoDAO.getPhotoOutlineByID(photo_id);
    if(pbean != null){
      HttpContext http_ctx = getHttpContext(mapping, form, request, response);
      rotate(http_ctx, pbean.getImageURL(), 6);
    }
    return null;
  }
View Full Code Here

Examples of com.liusoft.dlog4j.HttpContext

    //ɾ����Ƭ�ļ�
    int photo_id = Integer.parseInt(s_photo_id);
    PhotoBean pbean = PhotoDAO.getPhotoByID(photo_id);
    String ext = null;
    if(pbean != null){
      HttpContext context = getHttpContext(mapping, form, request, response);
      getPhotoSaver().delete(context, pbean.getImageURL());
      if(!pbean.getPreviewURL().equals(pbean.getImageURL()))
        getPhotoSaver().delete(context, pbean.getPreviewURL());
      //ɾ�����ݿ���Ϣ
      PhotoDAO.delete(pbean);
View Full Code Here

Examples of com.liusoft.dlog4j.HttpContext

 
  protected HttpContext getHttpContext(final ActionMapping mapping,
      final ActionForm form, final HttpServletRequest request,
      final HttpServletResponse response) {
    final ServletContext context = super.context();
    return new HttpContext() {
      public HttpServletRequest getRequest() {
        return request;
      }

      public HttpServletResponse getResponse() {
View Full Code Here

Examples of com.sun.jersey.api.core.HttpContext

    HttpRequestContext request = Mockito.mock(HttpRequestContext.class);
    Mockito.when(request.getUserPrincipal()).thenReturn(null);
    MultivaluedMap map = Mockito.mock(MultivaluedMap.class);
    Mockito.when(map.getFirst(UserProvider.USER_NAME_PARAM)).thenReturn(null);
    Mockito.when(request.getQueryParameters()).thenReturn(map);
    HttpContext context = Mockito.mock(HttpContext.class);
    Mockito.when(context.getRequest()).thenReturn(request);
    UserProvider up = new UserProvider();
    Assert.assertNull(up.getValue(context));
    Assert.assertNull(MDC.get("user"));
  }
View Full Code Here

Examples of com.sun.net.httpserver.HttpContext

       
        //make a new Server
        JettyHttpServer httpServer = new JettyHttpServer();
        httpServer.bind(new InetSocketAddress ("localhost", 8080), 0);
       
        HttpContext context = httpServer.createContext("/foo", new FooHandler());
        context.getAttributes().put("fooAttribute", "fooValue");
        context.getFilters().add(new FooFilter());
        context.getFilters().add(new BarFilter());      
        context.setAuthenticator(new FooBasicAuthenticator("foorealm"));
       
        httpServer.start()
      
        URL url = new URL("http://localhost:8080/foo");      
        HttpURLConnection httpConn = (HttpURLConnection)url.openConnection();
View Full Code Here

Examples of io.socket.http.HttpContext

        this.socketManager = socketManager;
    }

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        HttpContext context = createHttpContext(req, resp);
        service(context);
    }
View Full Code Here

Examples of javax.xml.ws.spi.http.HttpContext

    public void testMultiplePublishSameAddress() throws Exception {
        server.start();
        String contextPath = "/ctxt";
        String path = "/echo";
        //need to use the same HttpContext, otherwise Grizzly get confused
        HttpContext ctx = GrizzlyHttpContextFactory.createHttpContext(server, contextPath, path);
        for (int i = 0; i < 3; i++) {
            String address = "http://localhost:" + currentPort + contextPath + path;

            Endpoint endpoint = Endpoint.create(new EndpointBean());
            endpoint.publish(ctx); // Use grizzly HTTP context for publishing
View Full Code Here

Examples of juzu.request.HttpContext

  /** . */
  private final static String DOMAIN_ATTRIBUTE_NAME = "Domain";

  public static void rememberSerialized() {
    HttpContext context = Request.getCurrent().getHttpContext();
    if (context instanceof ServletWebBridge) {
      ServletWebBridge bridge = (ServletWebBridge) context;
 
      // base 64 encode it and store as a cookie:
      DefaultSerializer<PrincipalCollection> serializer = new DefaultSerializer<PrincipalCollection>();
      byte[] serialized = serializer.serialize(SecurityUtils.getSubject().getPrincipals());
      serialized = encrypt(serialized);
      String base64 = Base64.encodeToString(serialized);

      String name = DEFAULT_REMEMBER_ME_COOKIE_NAME;
      String value = base64;
      String domain = context.getServerName();
      String path = context.getContextPath();
      int maxAge = ONE_YEAR; // always zero for deletion
      final String headerValue = buildHeaderValue(name, value, domain.trim(), path.trim(), maxAge);
      bridge.getResponse().setHeader(COOKIE_HEADER_NAME, headerValue);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.